/*@@ @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 "cctk_Functions.h" #include "GRHydro_Macros.h" #include "SpaceMask.h" #define velx(i,j,k) vup(i,j,k,1) #define vely(i,j,k) vup(i,j,k,2) #define velz(i,j,k) vup(i,j,k,3) #define velx_p(i,j,k) vup_p(i,j,k,1) #define vely_p(i,j,k) vup_p(i,j,k,2) #define velz_p(i,j,k) vup_p(i,j,k,3) #define velx_p_p(i,j,k) vup_p_p(i,j,k,1) #define vely_p_p(i,j,k) vup_p_p(i,j,k,2) #define velz_p_p(i,j,k) vup_p_p(i,j,k,3) subroutine GRHydroUpdateAtmosphereMask(CCTK_ARGUMENTS) implicit none DECLARE_CCTK_ARGUMENTS DECLARE_CCTK_PARAMETERS DECLARE_CCTK_FUNCTIONS CCTK_INT :: i,j,k CCTK_REAL :: frac logical :: evolve_Bvec logical :: evolve_Avec frac = CCTK_DELTA_TIME evolve_Bvec = .false. evolve_Avec = .false. if (CCTK_EQUALS(Bvec_evolution_method,"GRHydro")) then evolve_Bvec = .true. elseif (CCTK_EQUALS(Bvec_evolution_method,"GRHydro_Avec") .or. CCTK_EQUALS(Bvec_evolution_method,"GRHydro_Avec_centered")) then evolve_Avec = .true. endif if(evolve_temper.ne.1.and.evolve_Y_e.ne.1) then !$OMP PARALLEL DO PRIVATE(k,j,i) do k = 1+GRHydro_stencil, cctk_lsh(3)-GRHydro_stencil do j = 1+GRHydro_stencil, cctk_lsh(2)-GRHydro_stencil do i = 1+GRHydro_stencil, cctk_lsh(1)-GRHydro_stencil if ( GRHydro_enable_internal_excision /= 0 .and. (hydro_excision_mask(i,j,k) .ne. 0) .or. & (atmosphere_mask(i,j,k) .ne. 0) .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 if (evolve_Bvec) then Bconsrhs(i,j,k,:) = 0.0d0 endif if (evolve_Avec) then Avecrhs(i,j,k,:) = 0.0d0 endif ! TODO: Need to set Avecrhs and Aphirhs to zero for centered / or staggered case if vector potential is evolved ! Set real-valued mask! This will be sync'ed and right after syncing translated to ! our standard integer based mask (so that atmosphere_mask is still valid!). atmosphere_mask_real(i,j,k) = 1 end if end do end do end do !$OMP END PARALLEL DO else ! allow negative total energy !$OMP PARALLEL DO PRIVATE(k,j,i) do k = 1+GRHydro_stencil, cctk_lsh(3)-GRHydro_stencil do j = 1+GRHydro_stencil, cctk_lsh(2)-GRHydro_stencil do i = 1+GRHydro_stencil, cctk_lsh(1)-GRHydro_stencil if ( GRHydro_enable_internal_excision /= 0 .and. (hydro_excision_mask(i,j,k) .ne. 0) .or. & (atmosphere_mask(i,j,k) .ne. 0) .or. & (dens(i,j,k) + frac * densrhs(i,j,k) .le. 0.d0) ) then y_e_con_rhs(i,j,k) = 0.0d0 densrhs(i,j,k) = 0.0d0 srhs(i,j,k,:) = 0.0d0 taurhs(i,j,k) = 0.0d0 if (evolve_Bvec) then Bconsrhs(i,j,k,:) = 0.0d0 endif if (evolve_Avec) then Avecrhs(i,j,k,:) = 0.0d0 endif ! TODO: Need to set Avecrhs and Aphirhs to zero for centered / or staggered case if vector potential is evolved ! Set real-valued mask! This will be sync'ed and right after syncing translated to ! our standard integer based mask (so that atmosphere_mask is still valid!). atmosphere_mask_real(i,j,k) = 1 end if end do end do end do !$OMP END PARALLEL DO endif end subroutine GRHydroUpdateAtmosphereMask subroutine GRHydroPostSyncAtmosphereMask(CCTK_ARGUMENTS) implicit none DECLARE_CCTK_ARGUMENTS DECLARE_CCTK_PARAMETERS CCTK_INT :: i,j,k !! This sets the integer atmo mask based on the real-valued (and sync'ed) atmo mask !$OMP PARALLEL DO PRIVATE(k,j,i) do k = 1, cctk_lsh(3) do j = 1, cctk_lsh(2) do i = 1, cctk_lsh(1) if ( abs(atmosphere_mask_real(i,j,k)) .gt. 0.5) then atmosphere_mask(i,j,k) = 1 end if end do end do end do !$OMP END PARALLEL DO end subroutine GRHydroPostSyncAtmosphereMask /*@@ @routine GRHydroCopyIntegerMask @date Wed Jul 4 15:40:16 PDT 2012 @author Roland Haas @desc Initializes real valued mask with integer valued one. @enddesc @calls @calledby @history @endhistory @@*/ subroutine GRHydroCopyIntegerMask(CCTK_ARGUMENTS) implicit none DECLARE_CCTK_ARGUMENTS DECLARE_CCTK_PARAMETERS CCTK_INT :: i,j,k !! This sets the real atmo mask based on the integer-valued atmo mask !$OMP PARALLEL DO PRIVATE(k,j,i) do k = 1, cctk_lsh(3) do j = 1, cctk_lsh(2) do i = 1, cctk_lsh(1) atmosphere_mask_real(i,j,k) = atmosphere_mask(i,j,k) end do end do end do !$OMP END PARALLEL DO end subroutine GRHydroCopyIntegerMask /*@@ @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 atmosphere_mask = 0 atmosphere_mask_real = 0 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 DECLARE_CCTK_PARAMETERS CCTK_INT :: i,j,k CCTK_REAL :: dummy1, dummy2 !$OMP PARALLEL DO PRIVATE(i,j,k, dummy1,dummy2) 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 IF_BELOW_ATMO(rho(i,j,k), GRHydro_rho_min, 0.0, r(i,j,k)) then atmosphere_mask(i,j,k) = 1 atmosphere_mask_real(i,j,k) = 1 end if end do end do end do !$OMP END PARALLEL DO call CCTK_INFO("Setting up the atmosphere mask: points with rho