86 CHARACTER(CHRLEN) :: RCSIdentString = &
87 '$RCSfile: PLAG_RFLU_ModFindCells.F90,v $ $Revision: 1.16 $'
132 TYPE(t_region
),
POINTER :: pregion
138 CHARACTER(CHRLEN) :: errorstring
140 REAL(RFREAL) :: xlocnew,xlocold,xtraj,ylocnew,ylocold,ytraj,zlocnew, &
143 TYPE(t_grid),
POINTER :: pgrid
144 TYPE(t_plag),
POINTER :: pplag
150 global => pregion%global
153 'PLAG_RFLU_ModFindCells.F90')
159 pgrid => pregion%grid
160 pplag => pregion%plag
166 DO ipcl = 1,pplag%nPcls
172 xlocnew = pplag%cv(cv_plag_xpos,ipcl)
173 ylocnew = pplag%cv(cv_plag_ypos,ipcl)
174 zlocnew = pplag%cv(cv_plag_zpos,ipcl)
176 xlocold = pplag%cvOld(cv_plag_xpos,ipcl)
177 ylocold = pplag%cvOld(cv_plag_ypos,ipcl)
178 zlocold = pplag%cvOld(cv_plag_zpos,ipcl)
180 xtraj = xlocnew - xlocold
181 ytraj = ylocnew - ylocold
182 ztraj = zlocnew - zlocold
184 pplag%arv(arv_plag_distot,ipcl) =
sqrt( xtraj*xtraj + ytraj*ytraj &
232 TYPE(t_region
),
POINTER :: pregion
239 CHARACTER(CHRLEN) :: errorstring
240 INTEGER :: errorflag,icg,ipcl
241 REAL(RFREAL) :: xloc,yloc,zloc
243 TYPE(t_grid),
POINTER :: pgrid
244 TYPE(t_plag),
POINTER :: pplag
250 global => pregion%global
253 'PLAG_RFLU_ModFindCells.F90')
259 pgrid => pregion%grid
260 pplag => pregion%plag
266 DO ipcl = 1,pplag%nPcls
272 xloc = pplag%cv(cv_plag_xpos,ipcl)
273 yloc = pplag%cv(cv_plag_ypos,ipcl)
274 zloc = pplag%cv(cv_plag_zpos,ipcl)
282 cellloop:
DO icg = 1,pgrid%nCells
284 pplag%aiv(aiv_plag_regini,ipcl) = pregion%iRegionGlobal
285 pplag%aiv(aiv_plag_icells,ipcl) = icg
297 IF ( foundflag .EQV. .false. )
THEN
298 WRITE(errorstring,
'(I6)') ipcl
299 CALL
errorstop(global,err_plag_pcl_not_found,__line__,trim(errorstring))
347 INTEGER,
INTENT(OUT) :: icgout
348 REAL(RFREAL),
INTENT(IN) :: xloc,yloc,zloc
349 TYPE(t_region
),
POINTER :: pregion
355 INTEGER :: errorflag,icg
357 TYPE(t_grid),
POINTER :: pgrid
363 global => pregion%global
366 'PLAG_RFLU_ModFindCells.F90')
372 pgrid => pregion%grid
378 icgout = crazy_value_int
380 cellloop:
DO icg = 1,pgrid%nCells
434 TYPE(t_region
),
POINTER :: pregion
440 CHARACTER(CHRLEN) :: errorstring
441 INTEGER :: errorflag,icg,ipcl
442 REAL(RFREAL) :: xloc,yloc,zloc
444 TYPE(t_grid),
POINTER :: pgrid
445 TYPE(t_plag),
POINTER :: pplag
451 global => pregion%global
454 'PLAG_RFLU_ModFindCells.F90')
460 pgrid => pregion%grid
461 pplag => pregion%plag
467 DO ipcl = 1,pplag%nPcls
473 icg = pplag%aivOld(aiv_plag_icells,ipcl)
475 xloc = pplag%cv(cv_plag_xpos,ipcl)
476 yloc = pplag%cv(cv_plag_ypos,ipcl)
477 zloc = pplag%cv(cv_plag_zpos,ipcl)
491 IF ( icg /= crazy_value_int )
THEN
492 pplag%aiv(aiv_plag_icells,ipcl) = icg
496 WRITE(*,*)
'timeCurrent,iPcl,xLocOld,yLocOld,zLocOld,xLoc,yLoc,zLoc = ',&
497 global%currentTime,ipcl,pplag%cvOld(cv_plag_xpos:cv_plag_zpos,ipcl),&
501 WRITE(errorstring,
'(I6)') ipcl
502 CALL
errorstop(global,err_plag_pcl_not_found,__line__,trim(errorstring))
510 pplag%aiv(aiv_plag_icells,ipcl) = icg
558 TYPE(t_region
),
POINTER :: pregion
564 LOGICAL :: testincell
565 CHARACTER(CHRLEN) :: errorstring
566 INTEGER :: c1,c1k,c2,c2k,errorflag,icg,icgout,ifg,iloc,ipcl,loopcounter
567 REAL(RFREAL) :: xloc,yloc,zloc
569 TYPE(t_grid),
POINTER :: pgrid
570 TYPE(t_patch),
POINTER :: ppatch
571 TYPE(t_plag),
POINTER :: pplag
577 global => pregion%global
580 'PLAG_RFLU_ModFindCells.F90')
586 pgrid => pregion%grid
587 pplag => pregion%plag
593 DO ipcl = 1,pplag%nPcls
596 xloc = pplag%cv(cv_plag_xpos,ipcl)
597 yloc = pplag%cv(cv_plag_ypos,ipcl)
598 zloc = pplag%cv(cv_plag_zpos,ipcl)
600 icg = pplag%aivOld(aiv_plag_icells,ipcl)
607 loopcounter = loopcounter + 1
622 IF ( testincell .EQV. .true. )
THEN
623 pplag%aiv(aiv_plag_icells,ipcl) = icg
633 IF ( iloc == 0 )
THEN
634 c1 = pgrid%f2c(1,ifg)
635 c2 = pgrid%f2c(2,ifg)
641 CASE ( face_kind_aa )
642 IF ( c1 == icg )
THEN
652 CALL
errorstop(global,err_reached_default,__line__)
658 ppatch => pregion%patches(iloc)
660 SELECT CASE ( ppatch%bcType )
662 CALL
errorstop(global,err_reached_default,__line__)
671 IF ( loopcounter >= limit_infinite_loop )
THEN
672 CALL
errorstop(global,err_infinite_loop,__line__)
729 TYPE(t_region
),
POINTER :: pregion
736 CHARACTER(CHRLEN) :: errorstring
737 INTEGER :: ccsize,errorflag,icg,ipcl
738 INTEGER,
DIMENSION(:),
ALLOCATABLE :: cc
739 REAL(RFREAL) :: delfrac,xdel,xloc,
xmax,
xmin,ydel,yloc,
ymax,
ymin,zdel,zloc, &
742 TYPE(t_grid),
POINTER :: pgrid
743 TYPE(t_plag),
POINTER :: pplag
749 global => pregion%global
752 'PLAG_RFLU_ModFindCells.F90')
758 pgrid => pregion%grid
759 pplag => pregion%plag
761 delfrac = 0.01_rfreal
763 ccsize =
min(100,pgrid%nCells)
765 ALLOCATE(cc(ccsize),stat=errorflag)
766 global%error = errorflag
767 IF ( global%error /= err_none )
THEN
768 CALL
errorstop(global,err_allocate,__line__,
'cc')
775 xmin = minval(pgrid%xyz(xcoord,1:pgrid%nVert))
776 xmax = maxval(pgrid%xyz(xcoord,1:pgrid%nVert))
777 ymin = minval(pgrid%xyz(ycoord,1:pgrid%nVert))
778 ymax = maxval(pgrid%xyz(ycoord,1:pgrid%nVert))
779 zmin = minval(pgrid%xyz(zcoord,1:pgrid%nVert))
780 zmax = maxval(pgrid%xyz(zcoord,1:pgrid%nVert))
800 pgrid%cofg(ycoord,1:pgrid%nCells), &
801 pgrid%cofg(zcoord,1:pgrid%nCells), &
808 DO ipcl = 1,pplag%nPcls
814 xloc = pplag%cv(cv_plag_xpos,ipcl)
815 yloc = pplag%cv(cv_plag_ypos,ipcl)
816 zloc = pplag%cv(cv_plag_zpos,ipcl)
833 cellloop:
DO icg = 1,ccsize
835 pplag%aiv(aiv_plag_regini,ipcl) = pregion%iRegionGlobal
836 pplag%aiv(aiv_plag_icells,ipcl) = cc(icg)
848 IF ( foundflag .EQV. .false. )
THEN
849 WRITE(errorstring,
'(I6)') ipcl
850 CALL
errorstop(global,err_plag_pcl_not_found,__line__, &
859 WRITE(errorstring,
'(I6)') ipcl
860 CALL
errorstop(global,err_plag_pcl_not_found,__line__,trim(errorstring))
870 DEALLOCATE(cc,stat=errorflag)
871 global%error = errorflag
872 IF ( global%error /= err_none )
THEN
873 CALL
errorstop(global,err_deallocate,__line__,
'cc')
930 INTEGER,
INTENT(INOUT) :: icgout
932 TYPE(t_region
),
POINTER :: pregion
939 INTEGER :: ccsize,errorflag,icgloop,ipcl
940 INTEGER,
DIMENSION(:),
ALLOCATABLE :: cc
942 TYPE(t_grid),
POINTER :: pgrid
948 global => pregion%global
951 'PLAG_RFLU_ModFindCells.F90')
957 pgrid => pregion%grid
962 ccsize =
min(50,pgrid%nCells)
965 ALLOCATE(cc(ccsize),stat=errorflag)
966 global%error = errorflag
967 IF ( global%error /= err_none )
THEN
968 CALL
errorstop(global,err_allocate,__line__,
'cc')
991 cellloop:
DO icgloop = 1,ccsize
1005 IF ( foundflag .EQV. .false. )
THEN
1006 icgout = crazy_value_int
1014 icgout = crazy_value_int
1021 DEALLOCATE(cc,stat=errorflag)
1022 global%error = errorflag
1023 IF ( global%error /= err_none )
THEN
1024 CALL
errorstop(global,err_deallocate,__line__,
'cc')
1079 TYPE(t_region
),
POINTER :: pregion
1085 LOGICAL :: foundflag
1086 CHARACTER(CHRLEN) :: errorstring
1087 INTEGER :: ccsize,errorflag,icg,ipcl
1088 INTEGER,
DIMENSION(:),
ALLOCATABLE :: cc
1089 REAL(RFREAL) :: delfrac,xdel,xloc,
xmax,
xmin,ydel,yloc,
ymax,
ymin,zdel,zloc, &
1092 TYPE(t_grid),
POINTER :: pgrid
1093 TYPE(t_plag),
POINTER :: pplag
1099 global => pregion%global
1102 'PLAG_RFLU_ModFindCells.F90')
1108 pgrid => pregion%grid
1109 pplag => pregion%plag
1111 delfrac = 0.01_rfreal
1116 ccsize =
min(50,pgrid%nCells)
1119 ALLOCATE(cc(ccsize),stat=errorflag)
1120 global%error = errorflag
1121 IF ( global%error /= err_none )
THEN
1122 CALL
errorstop(global,err_allocate,__line__,
'cc')
1129 xmin = minval(pgrid%xyz(xcoord,1:pgrid%nVert))
1130 xmax = maxval(pgrid%xyz(xcoord,1:pgrid%nVert))
1131 ymin = minval(pgrid%xyz(ycoord,1:pgrid%nVert))
1132 ymax = maxval(pgrid%xyz(ycoord,1:pgrid%nVert))
1133 zmin = minval(pgrid%xyz(zcoord,1:pgrid%nVert))
1134 zmax = maxval(pgrid%xyz(zcoord,1:pgrid%nVert))
1154 pgrid%cofg(ycoord,1:pgrid%nCells), &
1155 pgrid%cofg(zcoord,1:pgrid%nCells), &
1162 DO ipcl = 1,pplag%nPcls
1168 icg = pplag%aivOld(aiv_plag_icells,ipcl)
1170 xloc = pplag%cv(cv_plag_xpos,ipcl)
1171 yloc = pplag%cv(cv_plag_ypos,ipcl)
1172 zloc = pplag%cv(cv_plag_zpos,ipcl)
1195 cellloop:
DO icg = 1,ccsize
1197 pplag%aiv(aiv_plag_icells,ipcl) = cc(icg)
1207 IF ( foundflag .EQV. .false. )
THEN
1208 WRITE(errorstring,
'(I6)') ipcl
1209 CALL
errorstop(global,err_plag_pcl_not_found,__line__, &
1220 WRITE(*,*)
'timeCurrent,iPcl,xLocOld,yLocOld,zLocOld,xLoc,yLoc,zLoc = ',&
1221 global%currentTime,ipcl,pplag%cvOld(cv_plag_xpos:cv_plag_zpos,ipcl),&
1225 WRITE(errorstring,
'(I6)') ipcl
1226 CALL
errorstop(global,err_plag_pcl_not_found,__line__,trim(errorstring))
1234 pplag%aiv(aiv_plag_icells,ipcl) = icg
1244 DEALLOCATE(cc,stat=errorflag)
1245 global%error = errorflag
1246 IF ( global%error /= err_none )
THEN
1247 CALL
errorstop(global,err_deallocate,__line__,
'cc')
1298 INTEGER :: ipclbeg,ipclend
1299 TYPE(t_region
),
POINTER :: pregion
1305 LOGICAL :: incellcheckflag
1306 CHARACTER(CHRLEN) :: errorstring
1307 INTEGER :: c1,c1k,c2,c2k,errorflag,iborder,icg,ifg,ifgout,ifl,iloc,ilocout, &
1308 ipatch,ipcl,loopcounter
1309 REAL(RFREAL) ::
dist,disttot,disttotcutoff,eps,fnx,fny,fnz,imagtraj,theta, &
1310 xloc,xlocnew,xlocold,xtraj,yloc,ylocnew,ylocold,ytraj,zloc, &
1311 zlocnew,zlocold,ztraj
1314 TYPE(t_grid),
POINTER :: pgrid
1315 TYPE(t_patch),
POINTER :: ppatch
1316 TYPE(t_plag),
POINTER :: pplag
1322 global => pregion%global
1325 'PLAG_RFLU_ModFindCells.F90')
1331 pgrid => pregion%grid
1332 pplag => pregion%plag
1334 eps = epsilon(1.0_rfreal)
1335 disttotcutoff = 10*epsilon(1.0_rfreal)
1341 DO ipcl = ipclbeg,ipclend
1351 disttot = pplag%arv(arv_plag_distot,ipcl)
1353 IF ( disttot < disttotcutoff )
THEN
1357 xlocnew = pplag%cv(cv_plag_xpos,ipcl)
1358 ylocnew = pplag%cv(cv_plag_ypos,ipcl)
1359 zlocnew = pplag%cv(cv_plag_zpos,ipcl)
1361 xlocold = pplag%cvOld(cv_plag_xpos,ipcl)
1362 ylocold = pplag%cvOld(cv_plag_ypos,ipcl)
1363 zlocold = pplag%cvOld(cv_plag_zpos,ipcl)
1365 xtraj = xlocnew - xlocold
1366 ytraj = ylocnew - ylocold
1367 ztraj = zlocnew - zlocold
1369 imagtraj = 1.0_rfreal/(
sqrt(xtraj*xtraj + ytraj*ytraj + ztraj*ztraj) + eps)
1371 xtraj = imagtraj*xtraj
1372 ytraj = imagtraj*ytraj
1373 ztraj = imagtraj*ztraj
1379 xloc = xlocnew - disttot*xtraj
1380 yloc = ylocnew - disttot*ytraj
1381 zloc = zlocnew - disttot*ztraj
1383 icg = pplag%aivOld(aiv_plag_icells,ipcl)
1390 loopcounter = loopcounter + 1
1397 ztraj,icg,
dist,iloc,ifg)
1403 disttot = disttot -
dist
1411 IF ( disttot <= 0.0_rfreal )
THEN
1412 pplag%aiv(aiv_plag_icells,ipcl) = icg
1422 IF ( iloc == 0 )
THEN
1423 c1 = pgrid%f2c(1,ifg)
1424 c2 = pgrid%f2c(2,ifg)
1430 CASE ( face_kind_aa )
1431 IF ( c1 == icg )
THEN
1436 CASE ( face_kind_av )
1437 ifl = ifg - pgrid%nFaces + pgrid%nFacesAV
1439 iborder = pgrid%avf2b(1,ifl)
1441 pborder => pgrid%borders(iborder)
1443 pborder%nPclsSend = pborder%nPclsSend + 1
1445 IF ( pborder%nPclsSend > pborder%nPclsSendMax ) &
1448 pborder%iPclSend(1,pborder%nPclsSend) = ipcl
1449 pborder%iPclSend(2,pborder%nPclsSend) = pgrid%avf2b(2,ifl)
1451 pplag%aiv(aiv_plag_status,ipcl) = plag_status_comm
1452 pplag%arv(arv_plag_distot,ipcl) = disttot
1454 IF ( c1 == icg )
THEN
1460 pplag%aiv(aiv_plag_icells,ipcl) = icg
1462 ipatch = pgrid%avf2p(ifl)
1464 IF ( ipatch /= crazy_value_int )
THEN
1465 ppatch => pregion%patches(ipatch)
1467 IF ( ppatch%bcType == bc_periodic )
THEN
1473 CALL
errorstop(global,err_reached_default,__line__)
1479 CALL
errorstop(global,err_reached_default,__line__)
1485 ppatch => pregion%patches(iloc)
1487 fnx = ppatch%fn(xcoord,ifg)
1488 fny = ppatch%fn(ycoord,ifg)
1489 fnz = ppatch%fn(zcoord,ifg)
1491 theta = xtraj*fnx + ytraj*fny + ztraj*fnz
1493 SELECT CASE ( ppatch%bcType )
1494 CASE ( bc_slipwall:bc_slipwall+bc_range )
1495 IF ( ppatch%plotStatsFlag .EQV. .true. )
THEN
1500 ylocold,zlocold,xlocnew,ylocnew, &
1501 zlocnew,xtraj,ytraj,ztraj)
1502 CASE ( bc_noslipwall:bc_noslipwall+bc_range )
1503 IF ( ppatch%plotStatsFlag .EQV. .true. )
THEN
1508 ylocold,zlocold,xlocnew,ylocnew, &
1509 zlocnew,xtraj,ytraj,ztraj)
1510 CASE ( bc_injection:bc_injection+bc_range )
1511 IF ( ppatch%plotStatsFlag .EQV. .true. )
THEN
1516 ylocold,zlocold,xlocnew,ylocnew, &
1517 zlocnew,xtraj,ytraj,ztraj)
1518 CASE ( bc_outflow:bc_outflow+bc_range )
1519 IF ( ppatch%plotStatsFlag .EQV. .true. )
THEN
1524 pplag%aiv(aiv_plag_status,ipcl) = plag_status_delete
1526 CASE ( bc_farfield:bc_farfield+bc_range )
1527 pplag%aiv(aiv_plag_status,ipcl) = plag_status_delete
1529 CASE ( bc_symmetry:bc_symmetry+bc_range )
1531 ylocold,zlocold,xlocnew,ylocnew, &
1532 zlocnew,xtraj,ytraj,ztraj)
1533 CASE ( bc_virtual:bc_virtual+bc_range )
1535 ylocold,zlocold,xlocnew,ylocnew, &
1536 zlocnew,xtraj,ytraj,ztraj)
1538 CALL
errorstop(global,err_reached_default,__line__)
1548 IF ( loopcounter >= limit_infinite_loop )
THEN
1549 WRITE(stdout,
'(A,1X,A)') solver_name, &
1550 'Infinite loop encountered in particle cell search algorithm'
1551 WRITE(stdout,
'(A,3X,A)') solver_name,
'Module: Lagrangian Particle (PLAG).'
1553 WRITE(stdout,
'(A,3X,A,1X,1PE12.5)') solver_name,
'Current time:', &
1556 WRITE(stdout,
'(A,3X,A,1X,I5.5)') solver_name,
'Global region:', &
1557 pregion%iRegionGlobal
1558 WRITE(stdout,
'(A,6X,A,11(1X,A))') solver_name,
'#', &
1569 WRITE(stdout,
'(A,4X,4(1X,I8),6(1X,E13.6))') solver_name,ipcl, &
1570 pplag%aivOld(aiv_plag_pidini,ipcl), &
1571 pplag%aivOld(aiv_plag_regini,ipcl), &
1572 icg,xloc,yloc,zloc, &
1573 pplag%cv(cv_plag_ener,ipcl), &
1574 pplag%dv(dv_plag_diam,ipcl)
1576 CALL
errorstop(global,err_infinite_loop,__line__)
1584 IF ( (global%checkLevel == check_high) .AND. &
1585 (pplag%aiv(aiv_plag_status,ipcl) == plag_status_keep) )
THEN
1587 incellcheckflag,ilocout,ifgout)
1589 IF ( incellcheckflag .EQV. .false. )
THEN
1590 WRITE(stderr,
'(A,1X,A,1X,I6)') solver_name,
'Particle index:',ipcl
1591 WRITE(stderr,
'(A,1X,A,1X,I6)') solver_name,
'Cell which failed test:', &
1593 WRITE(stderr,
'(A,1X,A,2(1X,I6))') solver_name, &
1594 'Face which failed test:', &
1596 WRITE(stderr,
'(A,1X,A,3(1X,E23.16))') solver_name, &
1597 'Particle old location:', &
1598 xlocold,ylocold,zlocold
1599 WRITE(stderr,
'(A,1X,A,3(1X,E23.16))') solver_name, &
1600 'Particle new location:', &
1601 xlocnew,ylocnew,zlocnew
1603 WRITE(errorstring,
'(I6)') ipcl
1604 CALL
errorstop(global,err_plag_pcl_not_found,__line__, &
1614 pplag%cv(cv_plag_xpos,ipcl) = xlocnew
1615 pplag%cv(cv_plag_ypos,ipcl) = ylocnew
1616 pplag%cv(cv_plag_zpos,ipcl) = zlocnew
1618 pplag%cvOld(cv_plag_xpos,ipcl) = xlocold
1619 pplag%cvOld(cv_plag_ypos,ipcl) = ylocold
1620 pplag%cvOld(cv_plag_zpos,ipcl) = zlocold
1671 INTEGER :: ipclbeg,ipclend
1672 TYPE(t_region
),
POINTER :: pregion
1678 LOGICAL :: incellcheckflag
1679 CHARACTER(CHRLEN) :: errorstring
1680 INTEGER :: c1,c1k,c2,c2k,errorflag,iborder,icg,ifg,ifgout,ifl,iloc, &
1681 ilocout,ipatch,ipcl,loopcounter
1682 REAL(RFREAL) ::
dist,disttot,disttotcutoff,eps,fnx,fny,fnz,imagtraj,theta, &
1683 xloc,xlocnew,xlocold,xtraj,yloc,ylocnew,ylocold,ytraj,zloc, &
1684 zlocnew,zlocold,ztraj
1687 TYPE(t_grid),
POINTER :: pgrid
1688 TYPE(t_patch),
POINTER :: ppatch
1689 TYPE(t_plag),
POINTER :: pplag
1695 global => pregion%global
1698 'PLAG_RFLU_ModFindCells.F90')
1704 pgrid => pregion%grid
1705 pplag => pregion%plag
1707 eps = epsilon(1.0_rfreal)
1708 disttotcutoff = 10*eps
1714 DO ipcl = ipclbeg,ipclend
1724 disttot = pplag%arv(arv_plag_distot,ipcl)
1726 IF ( disttot < disttotcutoff )
THEN
1730 xlocnew = pplag%cv(cv_plag_xpos,ipcl)
1731 ylocnew = pplag%cv(cv_plag_ypos,ipcl)
1732 zlocnew = pplag%cv(cv_plag_zpos,ipcl)
1734 xlocold = pplag%cvOld(cv_plag_xpos,ipcl)
1735 ylocold = pplag%cvOld(cv_plag_ypos,ipcl)
1736 zlocold = pplag%cvOld(cv_plag_zpos,ipcl)
1738 xtraj = xlocnew - xlocold
1739 ytraj = ylocnew - ylocold
1740 ztraj = zlocnew - zlocold
1742 imagtraj = 1.0_rfreal/(
sqrt(xtraj*xtraj + ytraj*ytraj + ztraj*ztraj) + eps)
1744 xtraj = imagtraj*xtraj
1745 ytraj = imagtraj*ytraj
1746 ztraj = imagtraj*ztraj
1752 xloc = xlocnew - disttot*xtraj
1753 yloc = ylocnew - disttot*ytraj
1754 zloc = zlocnew - disttot*ztraj
1756 icg = pplag%aivOld(aiv_plag_icells,ipcl)
1763 loopcounter = loopcounter + 1
1770 ztraj,icg,
dist,iloc,ifg)
1776 disttot = disttot -
dist
1784 IF ( disttot <= 0.0_rfreal )
THEN
1785 pplag%aiv(aiv_plag_icells,ipcl) = icg
1795 IF ( iloc == 0 )
THEN
1796 c1 = pgrid%f2c(1,ifg)
1797 c2 = pgrid%f2c(2,ifg)
1803 CASE ( face_kind_aa )
1804 IF ( c1 == icg )
THEN
1809 CASE ( face_kind_av )
1810 ifl = ifg - pgrid%nFaces + pgrid%nFacesAV
1812 iborder = pgrid%avf2b(1,ifl)
1814 pborder => pgrid%borders(iborder)
1816 pborder%nPclsSend = pborder%nPclsSend + 1
1818 IF ( pborder%nPclsSend > pborder%nPclsSendMax ) &
1821 pborder%iPclSend(1,pborder%nPclsSend) = ipcl
1822 pborder%iPclSend(2,pborder%nPclsSend) = pgrid%avf2b(2,ifl)
1824 pplag%aiv(aiv_plag_status,ipcl) = plag_status_comm
1825 pplag%arv(arv_plag_distot,ipcl) = disttot
1827 IF ( c1 == icg )
THEN
1833 pplag%aiv(aiv_plag_icells,ipcl) = icg
1835 ipatch = pgrid%avf2p(ifl)
1837 IF ( ipatch /= crazy_value_int )
THEN
1838 ppatch => pregion%patches(ipatch)
1840 IF ( ppatch%bcType == bc_periodic )
THEN
1846 CALL
errorstop(global,err_reached_default,__line__)
1852 CALL
errorstop(global,err_reached_default,__line__)
1858 ppatch => pregion%patches(iloc)
1860 fnx = ppatch%fn(xcoord,ifg)
1861 fny = ppatch%fn(ycoord,ifg)
1862 fnz = ppatch%fn(zcoord,ifg)
1864 theta = xtraj*fnx + ytraj*fny + ztraj*fnz
1866 SELECT CASE ( ppatch%bcType )
1867 CASE ( bc_slipwall:bc_slipwall+bc_range )
1868 IF ( ppatch%plotStatsFlag .EQV. .true. )
THEN
1873 ylocold,zlocold,xlocnew,ylocnew, &
1874 zlocnew,xtraj,ytraj,ztraj)
1875 CASE ( bc_noslipwall:bc_noslipwall+bc_range )
1876 IF ( ppatch%plotStatsFlag .EQV. .true. )
THEN
1881 ylocold,zlocold,xlocnew,ylocnew, &
1882 zlocnew,xtraj,ytraj,ztraj)
1883 CASE ( bc_injection:bc_injection+bc_range )
1884 IF ( ppatch%plotStatsFlag .EQV. .true. )
THEN
1889 ylocold,zlocold,xlocnew,ylocnew, &
1890 zlocnew,xtraj,ytraj,ztraj)
1891 CASE ( bc_outflow:bc_outflow+bc_range )
1892 IF ( ppatch%plotStatsFlag .EQV. .true. )
THEN
1897 pplag%aiv(aiv_plag_status,ipcl) = plag_status_delete
1899 CASE ( bc_farfield:bc_farfield+bc_range )
1900 pplag%aiv(aiv_plag_status,ipcl) = plag_status_delete
1902 CASE ( bc_symmetry:bc_symmetry+bc_range )
1904 ylocold,zlocold,xlocnew,ylocnew, &
1905 zlocnew,xtraj,ytraj,ztraj)
1906 CASE ( bc_virtual:bc_virtual+bc_range )
1908 ylocold,zlocold,xlocnew,ylocnew, &
1909 zlocnew,xtraj,ytraj,ztraj)
1911 CALL
errorstop(global,err_reached_default,__line__)
1921 IF ( loopcounter >= limit_infinite_loop )
THEN
1922 WRITE(stdout,
'(A,1X,A)') solver_name, &
1923 'Infinite loop encountered in particle cell search algorithm'
1924 WRITE(stdout,
'(A,3X,A)') solver_name,
'Module: Lagrangian Particle (PLAG).'
1926 WRITE(stdout,
'(A,3X,A,1X,1PE12.5)') solver_name,
'Current time:', &
1929 WRITE(stdout,
'(A,3X,A,1X,I5.5)') solver_name,
'Global region:', &
1930 pregion%iRegionGlobal
1931 WRITE(stdout,
'(A,6X,A,11(1X,A))') solver_name,
'#', &
1942 WRITE(stdout,
'(A,4X,4(1X,I8),6(1X,E13.6))') solver_name,ipcl, &
1943 pplag%aivOld(aiv_plag_pidini,ipcl), &
1944 pplag%aivOld(aiv_plag_regini,ipcl), &
1945 icg,xloc,yloc,zloc, &
1946 pplag%cv(cv_plag_ener,ipcl), &
1947 pplag%dv(dv_plag_diam,ipcl)
1949 CALL
errorstop(global,err_infinite_loop,__line__)
1957 IF ( (global%checkLevel == check_high) .AND. &
1958 (pplag%aiv(aiv_plag_status,ipcl) == plag_status_keep) )
THEN
1960 incellcheckflag,ilocout,ifgout)
1962 IF ( incellcheckflag .EQV. .false. )
THEN
1963 WRITE(stderr,
'(A,1X,A,1X,I6)') solver_name,
'Particle index:',ipcl
1964 WRITE(stderr,
'(A,1X,A,1X,I6)') solver_name,
'Cell which failed test:', &
1966 WRITE(stderr,
'(A,1X,A,2(1X,I6))') solver_name, &
1967 'Face which failed test:', &
1969 WRITE(stderr,
'(A,1X,A,3(1X,E23.16))') solver_name, &
1970 'Particle old location:', &
1971 xlocold,ylocold,zlocold
1972 WRITE(stderr,
'(A,1X,A,3(1X,E23.16))') solver_name, &
1973 'Particle new location:', &
1974 xlocnew,ylocnew,zlocnew
1976 WRITE(errorstring,
'(I6)') ipcl
1977 CALL
errorstop(global,err_plag_pcl_not_found,__line__, &
1987 pplag%cv(cv_plag_xpos,ipcl) = xlocnew
1988 pplag%cv(cv_plag_ypos,ipcl) = ylocnew
1989 pplag%cv(cv_plag_zpos,ipcl) = zlocnew
1991 pplag%cvOld(cv_plag_xpos,ipcl) = xlocold
1992 pplag%cvOld(cv_plag_ypos,ipcl) = ylocold
1993 pplag%cvOld(cv_plag_zpos,ipcl) = zlocold
subroutine plag_reflectparticledata(pPatch, pPlag, ifl, iPcl, xLocOld, yLocOld, zLocOld, xLoc, yLoc, zLoc, xTraj, yTraj, zTraj)
subroutine, public plag_rflu_findcellsoctmod(pRegion)
subroutine, public rflu_queryoctree(XPT, YPT, ZPT, NUMP, NEIGHP)
subroutine, public rflu_ict_testincellfancy(pRegion, xLoc, yLoc, zLoc, icg, testInCell, iPatchOut, ifgOut)
subroutine, public plag_rflu_findcellstrajfast(pRegion, iPclBeg, iPclEnd)
INTEGER function, public rflu_getglobalcellkind(global, pGrid, icg)
subroutine, public rflu_ict_testincelllohner(pRegion, xLoc, yLoc, zLoc, icg, testInCell, iPatchOut, ifgOut)
subroutine, public plag_rflu_findcellsbrute(pRegion)
subroutine registerfunction(global, funName, fileName)
subroutine plag_rflu_findcellsbrutekernel(pRegion, xLoc, yLoc, zLoc, icgOut)
subroutine, public plag_rflu_findcellsbrutemod(pRegion)
subroutine, public rflu_buildoctree(XI, YI, ZI, XLOW, XUPP, YLOW, YUPP, ZLOW, ZUPP)
subroutine, public plag_gathersurfstats(pRegion, pPlag, pStatsPlag, ifl, iPcl, thetaAngle)
subroutine, public plag_rflu_findcellslohner(pRegion)
subroutine, public rflu_destroyoctree(global)
subroutine, public plag_rflu_computedisttot(pRegion)
INTEGER function, public rflu_getfacekind(global, c1k, c2k)
LOGICAL function, public rflu_ict_testincell(pRegion, xLoc, yLoc, zLoc, icg)
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
subroutine errorstop(global, errorCode, errorLine, addMessage)
subroutine, public plag_rflu_findcellsoct(pRegion)
long double dist(long double *coord1, long double *coord2, int size)
subroutine deregisterfunction(global)
subroutine, public rflu_createoctree(global, nPoints)
subroutine plag_rflu_findcellsoctkernel(pRegion, xLoc, yLoc, zLoc, xMin, xMax, yMin, yMax, zMin, zMax, icgOut)
subroutine, public rflu_mpi_recreatebufferipclsend(pRegion, pBorder)
subroutine, public plag_rflu_findcellstrajsafe(pRegion, iPclBeg, iPclEnd)