Skip to content
Snippets Groups Projects
Commit a03a2d94 authored by Matthias Schmiddunser's avatar Matthias Schmiddunser
Browse files

Moving tracking cloud creation to update_trcloud

Since the refined octree is needed for the reinjection, the first
creation of the tracking cloud belongs there.
parent 5d2b9d30
No related branches found
No related tags found
No related merge requests found
......@@ -72,6 +72,9 @@ trcl%ntracks=0
allocate (trcl%x(params%ntrp), stat=err) ; if (err.ne.0) call stop_run ('Error alloc trcl%x in define_trcloud$')
allocate (trcl%y(params%ntrp), stat=err) ; if (err.ne.0) call stop_run ('Error alloc trcl%y in define_trcloud$')
allocate (trcl%z(params%ntrp), stat=err) ; if (err.ne.0) call stop_run ('Error alloc trcl%z in define_trcloud$')
allocate (trcl%x0(params%ntrp), stat=err) ; if (err.ne.0) call stop_run ('Error alloc trcl%x0 in define_trcloud$')
allocate (trcl%y0(params%ntrp), stat=err) ; if (err.ne.0) call stop_run ('Error alloc trcl%y0 in define_trcloud$')
allocate (trcl%z0(params%ntrp), stat=err) ; if (err.ne.0) call stop_run ('Error alloc trcl%z0 in define_trcloud$')
allocate (trcl%press(params%ntrp), stat=err) ; if (err.ne.0) call stop_run ('Error alloc trcl%press in define_trcloud$')
allocate (trcl%temp(params%ntrp), stat=err) ; if (err.ne.0) call stop_run ('Error alloc trcl%temp in define_trcloud$')
allocate (trcl%lsf0(params%ntrp), stat=err) ; if (err.ne.0) call stop_run ('Error alloc trcl%lsf0 in define_trcloud$')
......@@ -83,6 +86,9 @@ allocate (trcl%tracks(1,3), stat=err) ; if (err.ne.0) call stop_run ('Error allo
trcl%x = -1.d0
trcl%y = -1.d0
trcl%z = -1.d0
trcl%x0 = -1.d0
trcl%y0 = -1.d0
trcl%z0 = -1.d0
trcl%press = 0.d0
trcl%temp = -1.d0
trcl%lsf0 = -2.d0 !lsf's range from -1 to 1, 0 at the surface
......@@ -235,85 +241,6 @@ load: if (params%irestart > 0 .AND. params%irestart>=params%tr_activation) then
close (19)
else load
!if not loading from restart file, create tracking particles according to
!specifications in input file
ntrpx = params%ntrpx
ntrpy = params%ntrpy
ntrpz = params%ntrpz
injection: if (params%gridtrack) then
!Regularly gridded tracking cloud
trgridshape = mod(params%ntrpx,2)+mod(params%ntrpy,2)+mod(params%ntrpy,2)
reggrid: if (trgridshape==0) then
!simple cubic grid
dx = (params%trboxxmax-params%trboxxmin)/ntrpx
dy = (params%trboxymax-params%trboxymin)/ntrpy
dz = (params%trboxzmax-params%trboxzmin)/ntrpz
!create tracking particles
gridstep = 1
do i = 1,ntrpx
do j = 1,ntrpy
do k = 1,ntrpz
trcl%x(gridstep) = params%trboxxmin+(i-0.5d0)*dx
trcl%y(gridstep) = params%trboxymin+(j-0.5d0)*dy
trcl%z(gridstep) = params%trboxzmin+(k-0.5d0)*dz
gridstep = gridstep+1
end do
end do
end do
else reggrid
!tgridshape=3, bcc-type gric
dx = 2.d0*(params%trboxxmax-params%trboxxmin)/(ntrpx+1)
dy = 2.d0*(params%trboxymax-params%trboxymin)/(ntrpy+1)
dz = 2.d0*(params%trboxzmax-params%trboxzmin)/(ntrpz+1)
!create tracking particles
gridstep = 1
do i = 1,(ntrpx+1)/2
do j = 1,(ntrpy+1)/2
do k = 1,(ntrpz+1)/2
trcl%x(gridstep) = params%trboxxmin+(i-0.5d0)*dx
trcl%y(gridstep) = params%trboxymin+(j-0.5d0)*dy
trcl%z(gridstep) = params%trboxzmin+(k-0.5d0)*dz
gridstep = gridstep+1
end do
end do
end do
do i = 1,(ntrpx-1)/2
do j = 1,(ntrpy-1)/2
do k = 1,(ntrpz-1)/2
trcl%x(gridstep) = params%trboxxmin+i*dx
trcl%y(gridstep) = params%trboxymin+j*dy
trcl%z(gridstep) = params%trboxzmin+k*dz
gridstep = gridstep+1
end do
end do
end do
end if reggrid
if (gridstep-1 == params%ntrp) then
trcl%np = params%ntrp
else
call stop_run ('error in tracking cloud grid injection')
end if
else injection
!Randomly distributed tracking cloud
call random_number (trcl%x)
call random_number (trcl%y)
call random_number (trcl%z)
do i = 1,params%ntrp
trcl%x(i) = params%trboxxmin+(params%trboxxmax-params%trboxxmin)*trcl%x(i)
trcl%y(i) = params%trboxymin+(params%trboxymax-params%trboxymin)*trcl%y(i)
trcl%z(i) = params%trboxzmin+(params%trboxzmax-params%trboxzmin)*trcl%z(i)
end do
trcl%np = params%ntrp
end if injection
end if load
return
......
......@@ -470,18 +470,25 @@ module definitions
end type string
!=====[TRACKING-CLOUD]==========================================================
! type tr_cloud is to store volumetric cloud of points for storing pT-paths
! it is made of
! type tr_cloud is to store volumetric cloud of points for storing pT-paths.
! a track is the path in space and time a particle goes through. For every
! particle that reaches the surface, the start and finish timestep and particle
! ID for this track is stored, the the particle is reinjected to start a new
! track.
! The module is is made of
! np : number of particles
! ntracks: number of surfaced tracks
! x,y,z : current location
! x0,y0,z0 : initial location
! press,temp: pressure and temperature array
! lsf0 : level set function of surface
!
! no use of pointers since tracks are not copied back and forth
! trackstart: starting timestep of current particle track
! tracks: log of start and finish timestep of each surfaced particle
type tracking_cloud
integer np,ntracks
double precision,dimension(:),allocatable :: x,y,z,press,temp,lsf0
double precision,dimension(:),allocatable :: x0,y0,z0
integer,dimension(:),allocatable :: trackstart
integer,dimension(:,:),allocatable :: tracks
end type tracking_cloud
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment