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
74 ichild=child_igrid(ic^
d)
82 call prolong_2nd(ps(igrid),ixco^
l,ps(ichild), &
83 dxco^
d,xcomin^
d,dxfi^
d,xfimin^
d,igrid,ichild)
89 if(
associated(phys_to_prolong))
then
90 call phys_from_prolong(ixg^ll,ix^l,ps(igrid)%w,ps(igrid)%x)
91 else if (prolongprimitive)
then
92 call phys_to_conserved(ixg^ll,ix^l,ps(igrid)%w,ps(igrid)%x)
95 end subroutine prolong_grid
98 subroutine prolong_2nd(sCo,ixCo^L,sFi,dxCo^D,xComin^D,dxFi^D,xFimin^D,igridCo,igridFi)
105 integer,
intent(in) :: ixco^
l, igridfi, igridco
106 double precision,
intent(in) :: dxco^
d, xcomin^
d, dxfi^
d, xfimin^
d
107 type(state),
intent(in) :: sco
108 type(state),
intent(inout) :: sfi
110 double precision :: slopel, sloper, slopec, signc, signr
111 double precision :: slope(nw,
ndim)
112 double precision :: eta^
d
113 integer :: ixco^
d, jxco^
d, hxco^
d, ixfi^
d, ix^
d, idim, iw, ixcg^
l, el
116 associate(wco=>sco%w, wfi=>sfi%w)
118 {
do ixco^db = ixcg^lim^db
120 ixfi^db=2*(ixco^db-ixcomin^db)+ixmlo^db\}
123 hxco^
d=ixco^
d-
kr(^
d,idim)\
124 jxco^
d=ixco^
d+
kr(^
d,idim)\
127 slopel=wco(ixco^
d,iw)-wco(hxco^
d,iw)
128 sloper=wco(jxco^
d,iw)-wco(ixco^
d,iw)
129 slopec=half*(sloper+slopel)
132 signr=sign(one,sloper)
133 signc=sign(one,slopec)
151 slope(iw,idim)=signc*max(zero,min(dabs(slopec), &
152 signc*slopel,signc*sloper))
158 {
do ix^db=ixfi^db,ixfi^db+1 \}
167 eta^
d=0.5d0*(dble(ix^
d-ixfi^
d)-0.5d0);
170 eta^
d=(dble(ix^
d-ixfi^
d)-0.5d0)*(one-sfi%dvolume(ix^dd) &
171 /sum(sfi%dvolume(ixfi^
d:ixfi^
d+1^
d%ix^dd))) \}
173 wfi(ix^
d,1:nw) = wco(ixco^
d,1:nw) &
174 + {(slope(1:nw,^
d)*eta^
d)+}
177 if(stagger_grid)
then
178 call already_fine(sfi,igridfi,fine_^l)
179 call prolong_2nd_stg(sco,sfi,ixco^l,ixm^ll,dxco^d,xcomin^d,dxfi^d,xfimin^d,.false.,fine_^l)
184 if(
associated(phys_from_prolong) .and.
associated(phys_wb_prolong))
then
190 call phys_from_prolong(ixg^ll,ixm^ll,wfi,sfi%x)
191 call phys_to_primitive(ixg^ll,ixm^ll,wfi,sfi%x)
192 call phys_wb_prolong(ixg^ll,ixm^ll,wfi,sfi%x)
193 call phys_to_conserved(ixg^ll,ixm^ll,wfi,sfi%x)
194 else if(
associated(phys_from_prolong))
then
196 call phys_from_prolong(ixg^ll,ixm^ll,wfi,sfi%x)
197 else if(
associated(phys_wb_prolong))
then
199 if(.not. prolongprimitive .and. .not.
associated(phys_to_prolong))
then
200 call phys_to_primitive(ixg^ll,ixm^ll,wfi,sfi%x)
202 call phys_wb_prolong(ixg^ll,ixm^ll,wfi,sfi%x)
203 call phys_to_conserved(ixg^ll,ixm^ll,wfi,sfi%x)
205 if(prolongprimitive)
call phys_to_conserved(ixg^ll,ixm^ll,wfi,sfi%x)
217 if(fix_small_values)
call phys_handle_small_values(prolongprimitive,wfi,sfi%x,ixg^ll,ixm^ll,
'prolong_2nd')
220 end subroutine prolong_2nd
223 subroutine prolong_1st(wCo,ixCo^L,wFi,xFi)
226 integer,
intent(in) :: ixco^
l
227 double precision,
intent(in) :: wco(ixg^t,nw), xfi(ixg^t,1:
ndim)
228 double precision,
intent(out) :: wfi(ixg^t,nw)
230 integer :: ixco^
d, ixfi^
d, iw
233 {
do ixco^db = ixco^lim^db
234 ixfi^db=2*(ixco^db-ixcomin^db)+ixmlo^db\}
235 forall(iw=1:nw) wfi(ixfi^
d:ixfi^
d+1,iw)=wco(ixco^
d,iw)
238 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...
type(state), pointer block
Block pointer for using one block and its previous state.
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