Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for EB checkpoint files #59

Merged
merged 2 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/embedded_boundaries/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ target_sources(incflo
eb_spherecube.cpp
eb_tuscan.cpp
eb_twocylinders.cpp
eb_chkptfile.cpp
writeEBsurface.cpp
eb_if.H
)
1 change: 1 addition & 0 deletions src/embedded_boundaries/Make.package
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CEXE_sources += eb_cylinder.cpp
CEXE_sources += eb_cyl_tuscan.cpp
CEXE_sources += eb_regular.cpp
CEXE_sources += eb_sphere.cpp
CEXE_sources += eb_chkptfile.cpp
ifeq ($(DIM), 3)
CEXE_sources += eb_spherecube.cpp
CEXE_sources += eb_tuscan.cpp
Expand Down
13 changes: 13 additions & 0 deletions src/embedded_boundaries/eb_chkptfile.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <AMReX_EB2.H>

#include <incflo.H>

using namespace amrex;

void incflo::make_eb_chkptfile()
{
// Build index space
int max_level_here = 0;
int max_coarsening_level = 100;
EB2::BuildFromChkptFile("geom_chk", geom.back(), max_level_here, max_level_here + max_coarsening_level);
}
11 changes: 11 additions & 0 deletions src/embedded_boundaries/embedded_boundaries.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <AMReX_ParmParse.H>
#include <AMReX_EB2.H>

#include <algorithm>
#include <incflo.H>
Expand Down Expand Up @@ -65,11 +66,21 @@ void incflo::MakeEBGeometry()
amrex::Print() << "\n Building JCAP geometry." << std::endl;
make_eb_cyl_tuscan();
}
else if(geom_type == "chkptfile")
{
make_eb_chkptfile();
}
else
{
amrex::Print() << "\n No EB geometry declared in inputs => "
<< " Will build all regular geometry." << std::endl;
make_eb_regular();
}
amrex::Print() << "Done making the geometry ebfactory.\n" << std::endl;

if (m_write_geom_chk) {
const auto& is = amrex::EB2::IndexSpace::top();
const auto& eb_level = is.getLevel(geom.back());
eb_level.write_to_chkpt_file("geom_chk", amrex::EB2::ExtendDomainFace(), amrex::EB2::max_grid_size);
}
}
3 changes: 3 additions & 0 deletions src/incflo.H
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,8 @@ private:
{}
};
EBFlow_t m_eb_flow;

bool m_write_geom_chk = false;
#else
// If using Godunov with no EB, default to PPM
bool m_godunov_ppm = true;
Expand Down Expand Up @@ -816,6 +818,7 @@ private:
void make_eb_spherecube ();
void make_eb_cyl_tuscan ();
void make_eb_tuscan ();
void make_eb_chkptfile ();
#endif

///////////////////////////////////////////////////////////////////////////
Expand Down
1 change: 1 addition & 0 deletions src/setup/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ void incflo::ReadParameters ()
amrex::Abort("redistribution type must be NoRedist, FluxRedist, or StateRedist");

if (m_advection_type == "Godunov" && m_godunov_ppm) amrex::Abort("Cant use PPM with EBGodunov");
pp.query("write_geom_chk", m_write_geom_chk);
#endif

if (m_advection_type == "MOL") m_godunov_include_diff_in_forcing = false;
Expand Down
89 changes: 89 additions & 0 deletions test_2d/benchmark.eb_chkptfile.read
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# SIMULATION STOP #
#.......................................#
stop_time = 0.025 # Max (simulated) time to evolve
max_step = -1 # Max number of time steps
steady_state = 0 # Steady-state solver?

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# TIME STEP COMPUTATION #
#.......................................#
incflo.fixed_dt = -1.0 # Use this constant dt if > 0
incflo.cfl = 0.45 # CFL factor

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# INPUT AND OUTPUT #
#.......................................#
amr.plot_per_exact = 0.01 # Steps between plot files
amr.check_int = 1000 # Steps between checkpoint files
amr.restart = "" # Checkpoint to restart from

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# PHYSICS #
#.......................................#
incflo.gravity = 0. 0. # Gravitational force (3D)
incflo.ro_0 = 1. # Reference density

incflo.fluid_model = "newtonian" # Fluid model (rheology)
incflo.mu = 0.001 # Dynamic viscosity coefficient

incflo.constant_density = true #

incflo.ntrac = 1 # Number of tracers
incflo.advect_tracer = true # Should we update them?
incflo.mu_s = 0.001 # Scalar diffusion coefficient

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# ADAPTIVE MESH REFINEMENT #
#.......................................#
amr.n_cell = 96 32 # Grid cells at coarsest AMRlevel
amr.max_level = 1 # Max AMR level in hierarchy
amr.grid_eff = 0.7
amr.n_error_buf = 8
amr.max_grid_size_x = 1024
amr.max_grid_size_y = 1024
amr.max_grid_size_z = 1024

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# GEOMETRY #
#.......................................#
geometry.prob_lo = 0. 0. # Lo corner coordinates
geometry.prob_hi = 1.2 0.4 # Hi corner coordinates
geometry.is_periodic = 0 0 # Periodicity x y z (0/1)

# Boundary conditions
ylo.type = "nsw"
ylo.velocity = 0. 0. 0.
yhi.type = "nsw"
yhi.velocity = 0. 0. 0.

xlo.type = "mi"
xlo.velocity = 1. 0. 0.
xlo.tracer = 1.
xhi.type = "po"
xhi.pressure = 0.0

# Add cylinder
incflo.geometry = "chkptfile"
#sphere.internal_flow = false
#sphere.radius = 0.05000001
#sphere.center = 0.15 0.2 0.0

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# INITIAL CONDITIONS #
#.......................................#
incflo.probtype = 31
incflo.ic_u = 1.0 #
incflo.ic_v = 0.0 #
incflo.ic_p = 0.0 #

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# VERBOSITY #
#.......................................#
incflo.verbose = 1 # incflo itself
mac_proj.verbose = 1 # MAC Projector
nodal_proj.verbose = 1 # Nodal Projector
scalar_diffusion.verbose = 1 # Scalar Diffusion
tensor_diffusion.verbose = 1 # Tensor Diffusion

amr.plt_ccse_regtest = 1
91 changes: 91 additions & 0 deletions test_2d/benchmark.eb_chkptfile.write
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# SIMULATION STOP #
#.......................................#
stop_time = 0.025 # Max (simulated) time to evolve
max_step = -1 # Max number of time steps
steady_state = 0 # Steady-state solver?

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# TIME STEP COMPUTATION #
#.......................................#
incflo.fixed_dt = -1.0 # Use this constant dt if > 0
incflo.cfl = 0.45 # CFL factor

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# INPUT AND OUTPUT #
#.......................................#
amr.plot_per_exact = 0.01 # Steps between plot files
amr.check_int = 1000 # Steps between checkpoint files
amr.restart = "" # Checkpoint to restart from

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# PHYSICS #
#.......................................#
incflo.gravity = 0. 0. # Gravitational force (3D)
incflo.ro_0 = 1. # Reference density

incflo.fluid_model = "newtonian" # Fluid model (rheology)
incflo.mu = 0.001 # Dynamic viscosity coefficient

incflo.constant_density = true #

incflo.ntrac = 1 # Number of tracers
incflo.advect_tracer = true # Should we update them?
incflo.mu_s = 0.001 # Scalar diffusion coefficient

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# ADAPTIVE MESH REFINEMENT #
#.......................................#
amr.n_cell = 96 32 # Grid cells at coarsest AMRlevel
amr.max_level = 1 # Max AMR level in hierarchy
amr.grid_eff = 0.7
amr.n_error_buf = 8
amr.max_grid_size_x = 1024
amr.max_grid_size_y = 1024
amr.max_grid_size_z = 1024

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# GEOMETRY #
#.......................................#
geometry.prob_lo = 0. 0. # Lo corner coordinates
geometry.prob_hi = 1.2 0.4 # Hi corner coordinates
geometry.is_periodic = 0 0 # Periodicity x y z (0/1)

# Boundary conditions
ylo.type = "nsw"
ylo.velocity = 0. 0. 0.
yhi.type = "nsw"
yhi.velocity = 0. 0. 0.

xlo.type = "mi"
xlo.velocity = 1. 0. 0.
xlo.tracer = 1.
xhi.type = "po"
xhi.pressure = 0.0

# Add cylinder
incflo.geometry = "sphere"
sphere.internal_flow = false
sphere.radius = 0.05000001
sphere.center = 0.15 0.2 0.0

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# INITIAL CONDITIONS #
#.......................................#
incflo.probtype = 31
incflo.ic_u = 1.0 #
incflo.ic_v = 0.0 #
incflo.ic_p = 0.0 #

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# VERBOSITY #
#.......................................#
incflo.verbose = 1 # incflo itself
mac_proj.verbose = 1 # MAC Projector
nodal_proj.verbose = 1 # Nodal Projector
scalar_diffusion.verbose = 1 # Scalar Diffusion
tensor_diffusion.verbose = 1 # Tensor Diffusion

amr.plt_ccse_regtest = 1

incflo.write_geom_chk = 1
88 changes: 88 additions & 0 deletions test_3d/benchmark.eb_chkptfile.read
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# SIMULATION STOP #
#.......................................#
stop_time = 0.025 # Max (simulated) time to evolve
max_step = -1 # Max number of time steps
steady_state = 0 # Steady-state solver?

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# TIME STEP COMPUTATION #
#.......................................#
incflo.fixed_dt = -1.0 # Use this constant dt if > 0
incflo.cfl = 0.45 # CFL factor

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# INPUT AND OUTPUT #
#.......................................#
amr.plot_per_exact = 0.01 # Steps between plot files
amr.check_int = 1000 # Steps between checkpoint files
amr.restart = "" # Checkpoint to restart from

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# PHYSICS #
#.......................................#
incflo.gravity = 0. 0. 0. # Gravitational force (3D)
incflo.ro_0 = 1. # Reference density

incflo.fluid_model = "newtonian" # Fluid model (rheology)
incflo.mu = 0.001 # Dynamic viscosity coefficient

incflo.ntrac = 1 # Number of tracers
incflo.advect_tracer = true # Should we update them?
incflo.mu_s = 0.001 # Scalar diffusion coefficient

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# ADAPTIVE MESH REFINEMENT #
#.......................................#
amr.n_cell = 96 32 8 # Grid cells at coarsest AMRlevel
amr.max_level = 1 # Max AMR level in hierarchy
amr.grid_eff = 0.7
amr.n_error_buf = 8
amr.max_grid_size_x = 1024
amr.max_grid_size_y = 1024
amr.max_grid_size_z = 1024

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# GEOMETRY #
#.......................................#
geometry.prob_lo = 0. 0. 0. # Lo corner coordinates
geometry.prob_hi = 1.2 0.4 0.1 # Hi corner coordinates
geometry.is_periodic = 0 0 1 # Periodicity x y z (0/1)

# Boundary conditions
ylo.type = "nsw"
ylo.velocity = 0. 0. 0.
yhi.type = "nsw"
yhi.velocity = 0. 0. 0.
xlo.type = "mi"
xlo.velocity = 1. 0. 0.
xlo.tracer = 1.
xhi.type = "po"
xhi.pressure = 0.0

# Add cylinder
incflo.geometry = "chkptfile"
#cylinder.internal_flow = false
#cylinder.radius = 0.05000001
#cylinder.direction = 2
#cylinder.center = 0.151 0.2 0.0

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# INITIAL CONDITIONS #
#.......................................#
incflo.probtype = 31
incflo.ic_u = 1.0 #
incflo.ic_v = 0.0 #
incflo.ic_w = 0.0 #
incflo.ic_p = 0.0 #

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# VERBOSITY #
#.......................................#
incflo.verbose = 1 # incflo itself
mac_proj.verbose = 1 # MAC Projector
nodal_proj.verbose = 1 # Nodal Projector
scalar_diffusion.verbose = 1 # Scalar Diffusion
tensor_diffusion.verbose = 1 # Tensor Diffusion

amr.plt_ccse_regtest = 1
Loading