14 use discretelement
, only: des_pos_new
16 use discretelement
, only: des_vel_new
18 use discretelement
, only: des_radius
20 use discretelement
, only: max_pip
22 use discretelement
, only: dg_pijk, dtsolid
32 use discretelement
, only: dtsolid
34 use discretelement
, only: grav
54 DOUBLE PRECISION :: NORM_PLANE(3)
56 DOUBLE PRECISION :: LINE_T
59 DOUBLE PRECISION :: DIST(3), tPOS(3)
61 DOUBLE PRECISION :: DT_RBND, RADSQ
64 double precision :: vv(3)
71 dt_rbnd = 1.01d0*dtsolid
76 IF(is_nonexistent(np)) cycle
79 IF(facets_at_dg(dg_pijk(np))%COUNT < 1) cycle
81 radsq = des_radius(np)*des_radius(np)
84 lc1_lp:
DO lc1=1, facets_at_dg(dg_pijk(np))%COUNT
87 nf = facets_at_dg(dg_pijk(np))%ID(lc1)
98 IF(abs(line_t) <= dt_rbnd)
THEN 101 dist = line_t*des_vel_new(np,:)
102 tpos = des_pos_new(np,:) + dist
108 IF(dot_product(dist,dist) <= radsq .OR. &
110 des_pos_new(np,:) = des_pos_new(np,:) + dist(:) + &
111 des_radius(np)*norm_plane
130 DOUBLE PRECISION,
INTENT(IN) :: VERTS(3,3)
131 DOUBLE PRECISION,
INTENT(IN) :: POINT(3)
133 DOUBLE PRECISION :: V0(3), V1(3), V2(3)
134 DOUBLE PRECISION :: d00, d01, d02, d11, d12
136 DOUBLE PRECISION :: OoDEN, u, v
138 v0 = verts(3,:) - verts(1,:)
139 v1 = verts(2,:) - verts(1,:)
140 v2 = point - verts(1,:)
142 d00 = dot_product(v0,v0)
143 d01 = dot_product(v0,v1)
144 d02 = dot_product(v0,v2)
146 d11 = dot_product(v1,v1)
147 d12 = dot_product(v1,v2)
149 ooden = 1.0d0/(d00*d11 - d01*d01)
150 u = (d11*d02 - d01*d12)*ooden
151 v = (d00*d12 - d01*d02)*ooden
153 hit_facet = ((u>=0.0d0) .AND. (v>=0.0d0) .AND. (u+v < 1.0d0))
169 USE discretelement
, only : dimn, des_vel_new
182 INTEGER,
INTENT(IN) :: LL
183 DOUBLE PRECISION,
INTENT(IN) :: WALL_NORM(dimn)
188 DOUBLE PRECISION :: VEL_NORMMAG_APP
192 DOUBLE PRECISION :: VEL_NORM_APP(dimn), VEL_TANG_APP(dimn)
197 DOUBLE PRECISION :: VEL_NORM_SEP(dimn), VEL_TANG_SEP(dimn)
199 DOUBLE PRECISION :: COEFF_REST_EN, COEFF_REST_ET
203 DOUBLE PRECISION :: projGRAV(3)
213 vel_normmag_app = dot_product(wall_norm(:), des_vel_new(ll,:))
217 vel_norm_app(:) = vel_normmag_app*wall_norm(:)
218 vel_tang_app(:) = des_vel_new(ll,:) - vel_norm_app(:)
226 vel_norm_sep(:) = -coeff_rest_en*vel_norm_app(:)
227 vel_tang_sep(:) = coeff_rest_et*vel_tang_app(:)
229 des_vel_new(ll,:) = vel_norm_sep(:) + vel_tang_sep(:)
231 IF(dot_product(wall_norm,
minvel) > 0.0d0)
THEN 235 projgrav =
minvel*projgrav
237 IF(dot_product(projgrav, projgrav) <
minvel_mag)
THEN 240 des_vel_new(ll,lc)=max(des_vel_new(ll,lc),
minvel(lc))
242 des_vel_new(ll,lc)=min(des_vel_new(ll,lc),
minvel(lc))
266 integer,
INTENT(IN) :: lc
269 character(len=8) :: IDX
272 write(idx,
"(I8.8)") lc
273 inquire(file=
'geo_'//idx//
'.stl', exist=lexists)
277 open(unit=555, file=
'geo_'//idx//
'.stl', status=
'UNKNOWN')
278 write(555,*)
'solid vcg' 279 write(555,*)
' facet normal ',
norm_face(:,lc)
280 write(555,*)
' outer loop' 281 write(555,*)
' vertex ', vertex(1,1:3,lc)
282 write(555,*)
' vertex ', vertex(2,1:3,lc)
283 write(555,*)
' vertex ', vertex(3,1:3,lc)
284 write(555,*)
' endloop' 285 write(555,*)
' endfacet' 308 USE discretelement
, only: max_radius
317 DOUBLE PRECISION,
INTENT(IN) :: POS(3)
318 LOGICAL,
INTENT(OUT) :: OVERLAP_EXISTS
320 INTEGER I, J, K, IJK, NF, LC
323 DOUBLE PRECISION :: LINE_T
324 DOUBLE PRECISION :: DIST(3), RADSQ
325 double precision :: vv(3)
335 overlap_exists = .true.
338 radsq = (1.1d0*max_radius)**2
355 IF(line_t > zero .OR. dot_product(dist,dist) <= radsq)
RETURN 359 overlap_exists = .false.
387 double precision,
intent(in),
dimension(dimn) :: position, velocity
388 Integer,
intent(in) :: fid
389 Integer :: stl_unit, vtp_unit , k
390 CHARACTER(LEN=100) :: stl_fname, vtp_fname
391 real :: temp_array(3)
396 WRITE(vtp_fname,
'(A,"_OFFENDING_PARTICLE",".vtp")') trim(
run_name)
397 WRITE(stl_fname,
'(A,"_STL_FACE",".stl")') trim(
run_name)
399 open(vtp_unit, file = vtp_fname, form=
'formatted',convert=
'big_endian' 400 open(stl_unit, file = stl_fname, form=
'formatted',convert=
'big_endian' 402 write(vtp_unit,
"(a)")
'<?xml version="1.0"?>' 403 write(vtp_unit,
"(a,es24.16,a)")
'<!-- time =',s_time,
's -->' 404 write(vtp_unit,
"(a,a)")
'<VTKFile type="PolyData"',&
405 ' version="0.1" byte_order="LittleEndian">' 406 write(vtp_unit,
"(3x,a)")
'<PolyData>' 407 write(vtp_unit,
"(6x,a,i10.10,a,a)")&
408 '<Piece NumberOfPoints="',1,
'" NumberOfVerts="0" ',&
409 'NumberOfLines="0" NumberOfStrips="0" NumberOfPolys="0">' 410 write(vtp_unit,
"(9x,a)")&
411 '<PointData Scalars="Diameter" Vectors="Velocity">' 412 write(vtp_unit,
"(12x,a)")&
413 '<DataArray type="Float32" Name="Diameter" format="ascii">' 414 write (vtp_unit,
"(15x,es13.6)") (1.d0)
415 write(vtp_unit,
"(12x,a)")
'</DataArray>' 418 temp_array(1:dimn) = velocity(1:dimn)
419 write(vtp_unit,
"(12x,a,a)")
'<DataArray type="Float32" ',&
420 'Name="Velocity" NumberOfComponents="3" format="ascii">' 421 write (vtp_unit,
"(15x,3(es13.6,3x))")&
422 ((temp_array(k)),k=1,3)
423 write(vtp_unit,
"(12x,a,/9x,a)")
'</DataArray>',
'</PointData>' 425 write(vtp_unit,
"(9x,a)")
'<CellData></CellData>' 428 temp_array(1:dimn) = position(1:dimn)
429 write(vtp_unit,
"(9x,a)")
'<Points>' 430 write(vtp_unit,
"(12x,a,a)")
'<DataArray type="Float32" ',&
431 'Name="Position" NumberOfComponents="3" format="ascii">' 432 write (vtp_unit,
"(15x,3(es13.6,3x))")&
433 ((temp_array(k)),k=1,3)
434 write(vtp_unit,
"(12x,a,/9x,a)")
'</DataArray>',
'</Points>' 436 write(vtp_unit,
"(9x,a,/9x,a,/9x,a,/9x,a)")
'<Verts></Verts>',&
437 '<Lines></Lines>',
'<Strips></Strips>',
'<Polys></Polys>' 438 write(vtp_unit,
"(6x,a,/3x,a,/a)")&
439 '</Piece>',
'</PolyData>',
'</VTKFile>' 443 write(stl_unit,*)
'solid vcg' 445 write(stl_unit,*)
' facet normal ',
norm_face(1:3,fid)
446 write(stl_unit,*)
' outer loop' 447 write(stl_unit,*)
' vertex ',
vertex(1,1:3,fid)
448 write(stl_unit,*)
' vertex ',
vertex(2,1:3,fid)
449 write(stl_unit,*)
' vertex ',
vertex(3,1:3,fid)
450 write(stl_unit,*)
' endloop' 451 write(stl_unit,*)
' endfacet' 453 write(stl_unit,*)
'endsolid vcg' 455 close(vtp_unit, status =
'keep')
456 close(stl_unit, status =
'keep')
457 write(*,*)
'wrote a facet and a parcel. now waiting' type(facets_to_dg), dimension(:), allocatable facets_at_dg
double precision, parameter one
double precision, dimension(3, 3, dim_stl) vertex
character(len=60) run_name
logical function hit_facet(VERTS, POINT)
double precision, parameter undefined
subroutine intersectlnplane(ref_line, dir_line, ref_plane, norm_plane, line_param)
double precision oominvel_mag
double precision mppic_coeff_et_wall
subroutine check_if_parcel_overlaps_stl(POS, OVERLAP_EXISTS)
subroutine apply_wall_bc_pic
integer function iofpos(fpos)
double precision, parameter small_number
subroutine write_this_facet_and_parcel(FID, position, velocity)
double precision, dimension(3, dim_stl) norm_face
integer function kofpos(fpos)
double precision minvel_mag
double precision, dimension(3) minvel
integer function dg_funijk(fi, fj, fk)
integer function jofpos(fpos)
double precision mppic_coeff_en_wall
subroutine pic_reflect_part(LL, WALL_NORM)
double precision, parameter zero
subroutine out_this_stl(LC)