/*@@ @file GRHydro_UpdateMask.F90 @date Wed Mar 13 14:18:38 2002 @author @desc Alter the update terms if inside the atmosphere or excision region @enddesc @@*/ #include "cctk.h" #include "cctk_Parameters.h" #include "cctk_Arguments.h" #include "GRHydro_Macros.h" #include "SpaceMask.h" #define velx(i,j,k) vel(i,j,k,1) #define vely(i,j,k) vel(i,j,k,2) #define velz(i,j,k) vel(i,j,k,3) #define velx_p(i,j,k) vel_p(i,j,k,1) #define vely_p(i,j,k) vel_p(i,j,k,2) #define velz_p(i,j,k) vel_p(i,j,k,3) #define velx_p_p(i,j,k) vel_p_p(i,j,k,1) #define vely_p_p(i,j,k) vel_p_p(i,j,k,2) #define velz_p_p(i,j,k) vel_p_p(i,j,k,3) subroutine GRHydroUpdateAtmosphereMask(CCTK_ARGUMENTS) implicit none DECLARE_CCTK_ARGUMENTS DECLARE_CCTK_PARAMETERS CCTK_INT :: i,j,k CCTK_REAL :: frac CCTK_INT :: type_bits, atmosphere call SpaceMask_GetTypeBits(type_bits, "Hydro_Atmosphere") call SpaceMask_GetStateBits(atmosphere, "Hydro_Atmosphere", "in_atmosphere") frac = CCTK_DELTA_TIME if(evolve_temper.ne.1) then !$OMP PARALLEL DO PRIVATE(j,i) do k = 1, cctk_lsh(3) do j = 1, cctk_lsh(2) do i = 1, cctk_lsh(1) if ( GRHydro_enable_internal_excision /= 0 .and. (hydro_excision_mask(i,j,k) .ne. 0) .or. & (SpaceMask_CheckStateBitsF90(space_mask, i, j, k, \ type_bits, atmosphere)) .or. & (tau(i,j,k) + frac * taurhs(i,j,k) .le. 0.d0) .or. & (dens(i,j,k) + frac * densrhs(i,j,k) .le. 0.d0) ) then densrhs(i,j,k) = 0.0d0 srhs(i,j,k,:) = 0.0d0 taurhs(i,j,k) = 0.0d0 atmosphere_mask(i,j,k) = 1 SpaceMask_SetStateBitsF90(space_mask, i, j, k, type_bits, atmosphere) end if end do end do end do !$OMP END PARALLEL DO else ! allow negative total energy !$OMP PARALLEL DO PRIVATE(j,i) do k = 1, cctk_lsh(3) do j = 1, cctk_lsh(2) do i = 1, cctk_lsh(1) if ( GRHydro_enable_internal_excision /= 0 .and. (hydro_excision_mask(i,j,k) .ne. 0) .or. & (SpaceMask_CheckStateBitsF90(space_mask, i, j, k, \ type_bits, atmosphere)) .or. & (dens(i,j,k) + frac * densrhs(i,j,k) .le. 0.d0) ) then densrhs(i,j,k) = 0.0d0 srhs(i,j,k,:) = 0.0d0 taurhs(i,j,k) = 0.0d0 atmosphere_mask(i,j,k) = 1 SpaceMask_SetStateBitsF90(space_mask, i, j, k, type_bits, atmosphere) end if end do end do end do !$OMP END PARALLEL DO endif end subroutine GRHydroUpdateAtmosphereMask /*@@ @routine GRHydro_SetupMask @date Thu Jun 20 13:27:28 2002 @author Ian Hawke @desc Initialize the mask to be zero. @enddesc @calls @calledby @history @endhistory @@*/ subroutine GRHydro_SetupMask(CCTK_ARGUMENTS) implicit none DECLARE_CCTK_ARGUMENTS DECLARE_CCTK_PARAMETERS CCTK_INT :: type_bits, not_atmosphere, i, j, k ! Initialize all rhs variables and the mask. ! The former vars need to be initialized since there is ! no rhs computation in CCTK_INITIAL or POSTINITIAL. densrhs = 0.0d0 taurhs = 0.0d0 srhs = 0.0d0 if (evolve_tracer .ne. 0) then cons_tracerrhs = 0.0d0 endif if (evolve_y_e .ne. 0) then y_e_con_rhs = 0.0d0 endif atmosphere_mask = 0 call SpaceMask_GetTypeBits(type_bits, "Hydro_Atmosphere") call SpaceMask_GetStateBits(not_atmosphere, & &"Hydro_Atmosphere", "not_in_atmosphere") do k = 1, cctk_lsh(3) do j = 1, cctk_lsh(2) do i = 1, cctk_lsh(1) SpaceMask_SetStateBitsF90(space_mask, i, j, k, type_bits, not_atmosphere) end do end do end do call CCTK_INFO("Setting up the atmosphere mask: all points are not_atmosphere") end subroutine GRHydro_SetupMask /*@@ @routine GRHydro_InitAtmosMask @date Thu Jun 20 13:27:28 2002 @author Ian Hawke @desc Initialize the mask based on rho_min. This is used only if wk_atmosphere=yes. @enddesc @calls @calledby @history @endhistory @@*/ subroutine GRHydro_InitAtmosMask(CCTK_ARGUMENTS) implicit none DECLARE_CCTK_ARGUMENTS CCTK_INT :: type_bits, atmosphere, i, j, k call SpaceMask_GetTypeBits(type_bits, "Hydro_Atmosphere") call SpaceMask_GetStateBits(atmosphere, & &"Hydro_Atmosphere", "in_atmosphere") do k = 1, cctk_lsh(3) do j = 1, cctk_lsh(2) do i = 1, cctk_lsh(1) if (rho(i,j,k) .le. GRHydro_rho_min) then SpaceMask_SetStateBitsF90(space_mask, i, j, k, type_bits, atmosphere) atmosphere_mask(i,j,k) = 1 end if end do end do end do call CCTK_INFO("Setting up the atmosphere mask: points with rho