computes cell corner (xC) and cell center (xCC) coordinates
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | igrid | |||
| double precision, | intent(out) | :: | xC(ixMlo1-1:ixMhi1,ixMlo2-1:ixMhi2,ixMlo3-1:ixMhi3,ndim) | |||
| double precision, | intent(out) | :: | xCC(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo3:ixMhi3,ndim) |
subroutine calc_x(igrid,xC,xCC) use mod_global_parameters use mod_geometry, only: r_of_s integer, intent(in) :: igrid double precision, intent(out) :: xC(ixMlo1-1:ixMhi1,ixMlo2-1:ixMhi2,& ixMlo3-1:ixMhi3,ndim) double precision, intent(out) :: xCC(ixMlo1:ixMhi1,ixMlo2:ixMhi2,& ixMlo3:ixMhi3,ndim) integer :: ixCmin1,ixCmin2,ixCmin3,ixCmax1,& ixCmax2,ixCmax3, idims, level, ix level=node(plevel_,igrid) ! coordinates of cell centers xCC(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo3:ixMhi3,:)=ps(igrid)%x(ixMlo1:ixMhi1,& ixMlo2:ixMhi2,ixMlo3:ixMhi3,:) ! coordinates of cell corners ixCmin1=ixMlo1-1;ixCmin2=ixMlo2-1;ixCmin3=ixMlo3-1; ixCmax1=ixMhi1 ixCmax2=ixMhi2;ixCmax3=ixMhi3; if(slab_uniform)then do idims=1,ndim xC(ixCmin1:ixCmax1,ixCmin2:ixCmax2,ixCmin3:ixCmax3,& idims)=ps(igrid)%x(ixCmin1:ixCmax1,ixCmin2:ixCmax2,ixCmin3:ixCmax3,& idims)+0.5d0*dx(idims,level) end do else ! Any non-Cartesian coordinate. ps%x is the cell's volume barycentre, ! not the midpoint of its faces, so x + dx/2 is not a corner: build the ! coordinate faces analytically from the block corner instead, which is ! both exact and the same expression fill_geometry_device uses. Cell ix ! spans the logical interval [xmin + (ix-nghostcells-1)*d, ! xmin + (ix-nghostcells)*d], and xC(ix) is its upper face - so the ! range starting at ixMlo-1 delivers the lower face of the first mesh ! cell as its first entry, exactly as before. do ix=ixCmin1,ixCmax1 xC(ix,ixCmin2:ixCmax2,ixCmin3:ixCmax3,1)= & rnode(rpxmin1_,igrid)+dble(ix-nghostcells)*rnode(rpdx1_,igrid) end do do ix=ixCmin2,ixCmax2 xC(ixCmin1:ixCmax1,ix,ixCmin3:ixCmax3,2)= & rnode(rpxmin2_,igrid)+dble(ix-nghostcells)*rnode(rpdx2_,igrid) end do do ix=ixCmin3,ixCmax3 xC(ixCmin1:ixCmax1,ixCmin2:ixCmax2,ix,3)= & rnode(rpxmin3_,igrid)+dble(ix-nghostcells)*rnode(rpdx3_,igrid) end do endif end subroutine calc_x