User: rhaas Date: 2012/07/05 12:36 AM
Modified: /trunk/ schedule.ccl /trunk/src/ GRHydro_Boundaries.F90
Log: GRHydro: Sync ALL prinmitives after regridding. This ensures that all variables are known on the finer grid when sync_conserved_only = yes. This is fix only affects runs which use a microphysical EOS.
File Changes:
Directory: /trunk/src/ ======================
File [modified]: GRHydro_Boundaries.F90 Delta lines: +139 -1 =================================================================== --- trunk/src/GRHydro_Boundaries.F90 2012-07-05 05:36:34 UTC (rev 377) +++ trunk/src/GRHydro_Boundaries.F90 2012-07-05 05:36:36 UTC (rev 378) @@ -360,7 +360,7 @@
-subroutine GRHydro_SelectPrimitiveBoundaries(CCTK_ARGUMENTS) +subroutine GRHydro_SelectPrimitiveInitialGuessesBoundaries(CCTK_ARGUMENTS)
implicit none
@@ -490,6 +490,142 @@
if (ierr < 0) call CCTK_WARN(0, "problems with applying the chosen boundary condition")
+end subroutine GRHydro_SelectPrimitiveInitialGuessesBoundaries + + + + + + + + +subroutine GRHydro_SelectPrimitiveBoundaries(CCTK_ARGUMENTS) + + implicit none + + DECLARE_CCTK_ARGUMENTS + DECLARE_CCTK_PARAMETERS + DECLARE_CCTK_FUNCTIONS + + integer, dimension(3) :: sw + integer :: ierr = 0 + integer :: i,j,k + CCTK_INT :: GRHydro_UseGeneralCoordinates, general_coordinates + + CCTK_INT, parameter :: faces=CCTK_ALL_FACES + CCTK_INT, parameter :: ione=1 + + sw = GRHydro_stencil + + general_coordinates = GRHydro_UseGeneralCoordinates(cctkGH) + +!!$Flat boundaries if required + + if (verbose.eq.1) call CCTK_INFO("Selecting primitive BC") + + + if (CCTK_EQUALS(bound,"flat")) then + + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "HydroBase::w_lorentz", "Flat") + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "HydroBase::rho", "Flat") + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "HydroBase::press", "Flat") + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "HydroBase::eps", "Flat") + if (general_coordinates .ne. 0) then + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "GRHydro::lvel", "Flat") + else + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "HydroBase::vel", "Flat") + endif + if(evolve_mhd.ne.0) then + if (general_coordinates .ne. 0) then + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "GRHydro::lBvec", "Flat") + else + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "HydroBase::Bvec", "Flat") + endif + endif + + if(evolve_tracer.ne.0) then + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "GRHydro::GRHydro_tracers", "Flat") + endif + + if(evolve_y_e.ne.0) then + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "HydroBase::Y_e", "Flat") + endif + + if(evolve_temper.ne.0) then + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "HydroBase::temperature", "Flat") + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "HydroBase::entropy", "Flat") + endif + + + endif + + if (CCTK_EQUALS(bound,"none")) then + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "HydroBase::w_lorentz", "None") + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "HydroBase::rho", "None") + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "HydroBase::press", "None") + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "HydroBase::eps", "None") + if (general_coordinates .ne. 0) then + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "GRHydro::lvel", "None") + else + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "HydroBase::vel", "None") + endif + + if(evolve_mhd.ne.0) then + if (general_coordinates .ne. 0) then + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "GRHydro::lBvec", "None") + else + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "HydroBase::Bvec", "None") + endif + + endif + + if(evolve_tracer.ne.0) then + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "GRHydro::GRHydro_tracers", "None") + + endif + + if(evolve_y_e.ne.0) then + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "HydroBase::Y_e", "None") + + endif + + if(evolve_temper.ne.0) then + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "HydroBase::temperature", "None") + ierr = ierr + Boundary_SelectGroupForBC(cctkGH, faces, GRHydro_stencil, -ione, & + "HydroBase::entropy", "None") + endif + + end if + + if (CCTK_EQUALS(bound,"scalar")) then + call CCTK_WARN(0, "Until somebody uses this I see no reason to support it") + end if + + if (ierr < 0) call CCTK_WARN(0, "problems with applying the chosen boundary condition") + end subroutine GRHydro_SelectPrimitiveBoundaries
@@ -497,6 +633,8 @@
+ + subroutine GRHydro_SelectAtmosphereMaskBoundaries(CCTK_ARGUMENTS)
implicit none
Directory: /trunk/ ==================
File [modified]: schedule.ccl Delta lines: +53 -11 =================================================================== --- trunk/schedule.ccl 2012-07-05 05:36:34 UTC (rev 377) +++ trunk/schedule.ccl 2012-07-05 05:36:36 UTC (rev 378) @@ -1065,27 +1065,27 @@ # and symmetry boundaries (we need valid data for the initial guess in Con2Prim) schedule group GRHydro_PrimitiveBoundaries IN CCTK_POSTREGRID BEFORE MoL_PostStep { - } "Apply boundary conditions to primitives" + } "Apply boundary conditions to primitives used for initial guesses" schedule group GRHydro_PrimitiveBoundaries IN CCTK_POSTREGRIDINITIAL BEFORE MoL_PostStep { - } "Apply boundary conditions to primitives" + } "Apply boundary conditions to primitives used for initial guesses"
# Primitive sync is always necessary to provide initial guesses for Con2Prim in the buffer zones via prolongation. # Buffer zones are not guaranteed to have the correct values! Prolongation happens only in the last MoL poststep # so we only need to sync in the last MoL post step. - schedule group GRHydro_PrimitiveBoundaries IN HydroBase_PostStep BEFORE HydroBase_Boundaries IF GRHydro::InLastMoLPostStep + schedule group GRHydro_PrimitiveInitialGuessesBoundaries IN HydroBase_PostStep BEFORE HydroBase_Boundaries IF GRHydro::InLastMoLPostStep { - } "Apply boundary conditions to primitives" + } "Apply boundary conditions to all primitives"
if(CCTK_IsImplementationActive("Coordinates")) {
+ # Via prolongation, we only need to sync variables used for initial guesses! # With MP, we only need to sync primitives in LOCAL tensor base!! - schedule GRHydro_SelectPrimitiveBoundaries IN GRHydro_PrimitiveBoundaries + schedule GRHydro_SelectPrimitiveInitialGuessesBoundaries IN GRHydro_PrimitiveInitialGuessesBoundaries { LANG: Fortran OPTIONS: LEVEL - # do a sync to be very sure we have proper initial guesses everywhere # SYNC: HydroBase::w_lorentz # not used as initial guess and hence not needed! # SYNC: HydroBase::press # not used as initial guess and hence not needed! # SYNC: HydroBase::vel @@ -1098,16 +1098,36 @@ SYNC: hydrobase::temperature SYNC: lvel SYNC: lBvec + } "Select initial guess primitive variables for boudary conditions" + + # After regridding, we better sync every primitive! + # With MP, we only need to sync primitives in LOCAL tensor base!! + schedule GRHydro_SelectPrimitiveBoundaries IN GRHydro_PrimitiveBoundaries + { + LANG: Fortran + OPTIONS: LEVEL + SYNC: HydroBase::w_lorentz + SYNC: HydroBase::press +# SYNC: HydroBase::vel +# SYNC: HydroBase::Bvec + SYNC: hydrobase::entropy + SYNC: hydrobase::Y_e + SYNC: GRHydro_tracers + SYNC: HydroBase::rho + SYNC: HydroBase::eps + SYNC: hydrobase::temperature + SYNC: lvel + SYNC: lBvec } "Select primitive variables for boudary conditions" } else { + # Via prolongation, we only need to sync variables used for initial guesses! # Without MP, we only need to sync primitives in GLOBAL tensor base!! - schedule GRHydro_SelectPrimitiveBoundaries IN GRHydro_PrimitiveBoundaries + schedule GRHydro_SelectPrimitiveInitialGuessesBoundaries IN GRHydro_PrimitiveInitialGuessesBoundaries { LANG: Fortran OPTIONS: LEVEL - # do a sync to be very sure we have proper initial guesses everywhere # SYNC: HydroBase::w_lorentz # not used as initial guess and hence not needed! # SYNC: HydroBase::press # not used as initial guess and hence not needed! # SYNC: hydrobase::entropy # not used as initial guess and hence not needed! @@ -1120,13 +1140,35 @@ SYNC: HydroBase::vel SYNC: HydroBase::Bvec SYNC: hydrobase::temperature + } "Select initial guess primitive variables for boudary conditions" + + # After regridding, we better sync every primitive! + # Without MP, we only need to sync primitives in GLOBAL tensor base!! + schedule GRHydro_SelectPrimitiveBoundaries IN GRHydro_PrimitiveBoundaries + { + LANG: Fortran + OPTIONS: LEVEL + SYNC: HydroBase::w_lorentz # not used as initial guess and hence not needed! + SYNC: HydroBase::press # not used as initial guess and hence not needed! + SYNC: hydrobase::entropy # not used as initial guess and hence not needed! + SYNC: hydrobase::Y_e # not used as initial guess and hence not needed! + SYNC: GRHydro_tracers # not used as initial guess and hence not needed! + SYNC: HydroBase::rho + SYNC: HydroBase::eps + SYNC: HydroBase::vel + SYNC: HydroBase::Bvec + SYNC: hydrobase::temperature } "Select primitive variables for boudary conditions"
}
+ schedule group ApplyBCs AS GRHydro_ApplyPrimitiveInitialGuessBCs in GRHydro_PrimitiveInitialGuessesBoundaries AFTER GRHydro_SelectPrimitiveInitialGuessesBoundaries + { + } "Apply boundary conditions to initial guess primitive variables" + schedule group ApplyBCs AS GRHydro_ApplyPrimitiveBCs in GRHydro_PrimitiveBoundaries AFTER GRHydro_SelectPrimitiveBoundaries { - } "Apply boundary conditions to primitive variables" + } "Apply boundary conditions to all primitive variables"
} # sync_conserved_only
@@ -1191,12 +1233,12 @@ # Afterwards, reset mask! if (CCTK_Equals(Bvec_evolution_method,"GRHydro")) { - schedule GRHydro_AtmosphereResetM IN HydroBase_PostStep AFTER GRHydroPostSyncAtmosphereMask BEFORE (HydroBase_Boundaries,GRHydro_PrimitiveBoundaries) IF GRHydro::InLastMoLPostStep + schedule GRHydro_AtmosphereResetM IN HydroBase_PostStep AFTER GRHydroPostSyncAtmosphereMask BEFORE (HydroBase_Boundaries,GRHydro_PrimitiveInitialGuessesBoundaries) IF GRHydro::InLastMoLPostStep { LANG: Fortran } "Reset the atmosphere - MHD version" } else { - schedule GRHydro_AtmosphereReset IN HydroBase_PostStep AFTER GRHydroPostSyncAtmosphereMask BEFORE (HydroBase_Boundaries,GRHydro_PrimitiveBoundaries) IF GRHydro::InLastMoLPostStep + schedule GRHydro_AtmosphereReset IN HydroBase_PostStep AFTER GRHydroPostSyncAtmosphereMask BEFORE (HydroBase_Boundaries,GRHydro_PrimitiveInitialGuessesBoundaries) IF GRHydro::InLastMoLPostStep { LANG: Fortran } "Reset the atmosphere"