16 type(state),
intent(inout) :: sfi, sco
17 integer,
intent(in) :: ixfig^
l, ixfi^
l, ixcog^
l, ixco^
l
19 integer :: ixco^
d, ixfi^
d, iw
20 double precision :: cofiratio
21 double precision :: b_energy_change(ixcog^s)
23 associate(wfi=>sfi%w(ixfig^s,1:nw), wco=>sco%w(ixcog^s,1:nw))
24 staggered: associate(wfis=>sfi%ws,wcos=>sco%ws)
30 cofiratio=one/dble(2**
ndim)
32 {
do ixco^db = ixco^lim^db
33 ixfi^db=2*(ixco^db-ixcomin^db)+ixfimin^db\}
34 wco(ixco^
d,iw)=sum(wfi(ixfi^
d:ixfi^
d+1,iw))*cofiratio
39 {
do ixco^db = ixco^lim^db
40 ixfi^db=2*(ixco^db-ixcomin^db)+ixfimin^db\}
42 sum(sfi%dvolume(ixfi^d:ixfi^d+1)*wfi(ixfi^d:ixfi^d+1,iw)) &
51 {
do ixco^db = ixcomin^db-kr(^db,iw),ixcomax^db
52 ixfi^db=2*(ixco^db-ixcomin^db+kr(^db,iw))+ixfimin^db-kr(^db,iw)\}
54 if (sco%surfaceC(ixco^d,iw)>1.0d-9*sco%dvolume(ixco^d))
then
55 wcos(ixco^d,iw)=sum(sfi%surfaceC(ixfi^d:ixfi^d+1-kr(iw,^d),iw)*wfis(ixfi^d:ixfi^d+1-kr(iw,^d),iw)) &
56 /sco%surfaceC(ixco^d,iw)
62 if(phys_total_energy.and. .not.coarsenprimitive)
then
63 b_energy_change(ixco^s)=0.5d0*sum(wco(ixco^s,iw_mag(:))**2,dim=ndim+1)
66 call phys_face_to_center(ixco^l,sco)
67 if(phys_total_energy.and. .not.coarsenprimitive)
then
68 wco(ixco^s,iw_e)=wco(ixco^s,iw_e)-b_energy_change(ixco^s)+&
69 0.5d0*sum(wco(ixco^s,iw_mag(:))**2,dim=ndim+1)
73 if(coarsenprimitive)
then
74 call phys_to_conserved(ixfig^l,ixfi^l,wfi,sfi%x)
75 call phys_to_conserved(ixcog^l,ixco^l,wco,sco%x)
77 end associate staggered
subroutine, public coarsen_grid(sFi, ixFiGL, ixFiL, sCo, ixCoGL, ixCoL)
coarsen one grid to its coarser representative
This module contains definitions of global parameters and variables and some generic functions/subrou...
integer, parameter ndim
Number of spatial dimensions for grid variables.
integer, dimension(:), allocatable, parameter d
logical slab_uniform
uniform Cartesian geometry or not (stretched Cartesian)
This module defines the procedures of a physics module. It contains function pointers for the various...
procedure(sub_convert), pointer phys_to_primitive