17 integer,
dimension(2^D&),
intent(in) :: child_igrid, child_ipe
18 integer,
intent(in) :: igrid, ipe
19 logical,
intent(in) :: active
28 if ((time_advance .and. active).or.convert.or.reset_grid)
then
30 call prolong_grid(child_igrid,child_ipe,igrid,ipe)
34 call initial_condition(child_igrid(ic^d))
39 if(convert)
call dealloc_node(igrid)
43 subroutine prolong_grid(child_igrid,child_ipe,igrid,ipe)
49 integer,
dimension(2^D&),
intent(in) :: child_igrid, child_ipe
50 integer,
intent(in) :: igrid, ipe
52 double precision :: dxco^
d, xcomin^
d, dxfi^
d, xfimin^
d
53 integer :: ix^
l, ichild, ixco^
l, ic^
d
72 ichild=child_igrid(ic^
d)
80 call prolong_2nd(ps(igrid),ixco^
l,ps(ichild), &
81 dxco^
d,xcomin^
d,dxfi^
d,xfimin^
d,igrid,ichild)
86 if(
associated(phys_to_prolong))
then
87 call phys_from_prolong(ixg^ll,ix^l,ps(igrid)%w,ps(igrid)%x)
88 else if (prolongprimitive)
then
89 call phys_to_conserved(ixg^ll,ix^l,ps(igrid)%w,ps(igrid)%x)
92 end subroutine prolong_grid
95 subroutine prolong_2nd(sCo,ixCo^L,sFi,dxCo^D,xComin^D,dxFi^D,xFimin^D,igridCo,igridFi)
102 integer,
intent(in) :: ixco^
l, igridfi, igridco
103 double precision,
intent(in) :: dxco^
d, xcomin^
d, dxfi^
d, xfimin^
d
104 type(state),
intent(in) :: sco
105 type(state),
intent(inout) :: sfi
107 double precision :: slopel, sloper, slopec, signc, signr
108 double precision :: slope(nw,
ndim)
109 double precision :: eta^
d
110 integer :: ixco^
d, jxco^
d, hxco^
d, ixfi^
d, ix^
d, idim, iw, ixcg^
l, el
113 associate(wco=>sco%w, wfi=>sfi%w)
115 {
do ixco^db = ixcg^lim^db
117 ixfi^db=2*(ixco^db-ixcomin^db)+ixmlo^db\}
120 hxco^
d=ixco^
d-
kr(^
d,idim)\
121 jxco^
d=ixco^
d+
kr(^
d,idim)\
124 slopel=wco(ixco^
d,iw)-wco(hxco^
d,iw)
125 sloper=wco(jxco^
d,iw)-wco(ixco^
d,iw)
126 slopec=half*(sloper+slopel)
129 signr=sign(one,sloper)
130 signc=sign(one,slopec)
148 slope(iw,idim)=signc*max(zero,min(dabs(slopec), &
149 signc*slopel,signc*sloper))
155 {
do ix^db=ixfi^db,ixfi^db+1 \}
164 eta^
d=0.5d0*(dble(ix^
d-ixfi^
d)-0.5d0);
167 eta^
d=(dble(ix^
d-ixfi^
d)-0.5d0)*(one-sfi%dvolume(ix^dd) &
168 /sum(sfi%dvolume(ixfi^
d:ixfi^
d+1^
d%ix^dd))) \}
170 wfi(ix^
d,1:nw) = wco(ixco^
d,1:nw) &
171 + {(slope(1:nw,^
d)*eta^
d)+}
174 if(stagger_grid)
then
175 call already_fine(sfi,igridfi,fine_^l)
176 call prolong_2nd_stg(sco,sfi,ixco^l,ixm^ll,dxco^d,xcomin^d,dxfi^d,xfimin^d,.false.,fine_^l)
179 if(fix_small_values)
call phys_handle_small_values(prolongprimitive,wfi,sfi%x,ixg^ll,ixm^ll,
'prolong_2nd')
182 if(
associated(phys_from_prolong) .and.
associated(phys_wb_prolong))
then
188 call phys_from_prolong(ixg^ll,ixm^ll,wfi,sfi%x)
189 call phys_to_primitive(ixg^ll,ixm^ll,wfi,sfi%x)
190 call phys_wb_prolong(ixg^ll,ixm^ll,wfi,sfi%x)
191 call phys_to_conserved(ixg^ll,ixm^ll,wfi,sfi%x)
192 else if(
associated(phys_from_prolong))
then
194 call phys_from_prolong(ixg^ll,ixm^ll,wfi,sfi%x)
195 else if(
associated(phys_wb_prolong))
then
197 if(.not. prolongprimitive .and. .not.
associated(phys_to_prolong))
then
198 call phys_to_primitive(ixg^ll,ixm^ll,wfi,sfi%x)
200 call phys_wb_prolong(ixg^ll,ixm^ll,wfi,sfi%x)
201 call phys_to_conserved(ixg^ll,ixm^ll,wfi,sfi%x)
203 if(prolongprimitive)
call phys_to_conserved(ixg^ll,ixm^ll,wfi,sfi%x)
207 end subroutine prolong_2nd
210 subroutine prolong_1st(wCo,ixCo^L,wFi,xFi)
213 integer,
intent(in) :: ixco^
l
214 double precision,
intent(in) :: wco(ixg^t,nw), xfi(ixg^t,1:
ndim)
215 double precision,
intent(out) :: wfi(ixg^t,nw)
217 integer :: ixco^
d, ixfi^
d, iw
220 {
do ixco^db = ixco^lim^db
221 ixfi^db=2*(ixco^db-ixcomin^db)+ixmlo^db\}
222 forall(iw=1:nw) wfi(ixfi^
d:ixfi^
d+1,iw)=wco(ixco^
d,iw)
225 end subroutine prolong_1st
subroutine, public already_fine(sfi, ichild, fine_l)
This routine fills the fine faces before prolonging. It is the face equivalent of fix_conserve.
subroutine, public old_neighbors(child_igrid, child_ipe, igrid, ipe)
subroutine, public prolong_2nd_stg(sco, sfi, ixcolin, ixfilin, dxcod, xcomind, dxfid, xfimind, ghost, fine_lin)
This subroutine performs a 2nd order prolongation for a staggered field F, preserving the divergence ...
subroutine, public dealloc_node(igrid)
subroutine, public alloc_node(igrid)
allocate arrays on igrid node
This module contains definitions of global parameters and variables and some generic functions/subrou...
integer, dimension(3, 3) kr
Kronecker delta tensor.
integer, parameter ndim
Number of spatial dimensions for grid variables.
integer, parameter rpxmin
logical stagger_grid
True for using stagger grid.
integer block_nx
number of cells for each dimension in grid block excluding ghostcells
integer ixm
the mesh range of a physical block without ghost cells
double precision, dimension(:), allocatable, parameter d
logical prolongprimitive
prolongate primitive variables in level-jump ghost cells
double precision, dimension(:,:), allocatable rnode
Corner coordinates.
double precision, dimension(^nd) dxlevel
store unstretched cell size of current level
logical slab_uniform
uniform Cartesian geometry or not (stretched Cartesian)
subroutine, public initial_condition(igrid)
fill in initial condition
This module defines the procedures of a physics module. It contains function pointers for the various...
procedure(sub_convert), pointer phys_to_primitive
procedure(sub_small_values), pointer phys_handle_small_values
procedure(sub_wb_prolong), pointer phys_wb_prolong
procedure(sub_convert), pointer phys_to_prolong
procedure(sub_convert), pointer phys_to_conserved
procedure(sub_convert), pointer phys_from_prolong
subroutine, public refine_grids(child_igrid, child_ipe, igrid, ipe, active)
refine one block to its children blocks