Skip to content

Commit

Permalink
Converging nozzle geom with breaking tile size
Browse files Browse the repository at this point in the history
  • Loading branch information
marchdf committed Sep 15, 2023
1 parent 77968a2 commit e92d479
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 0 deletions.
73 changes: 73 additions & 0 deletions Exec/SodPlusSphere/converging_nozzle.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
amrex.fpe_trap_invalid = 1
amrex.fpe_trap_zero = 1
amrex.fpe_trap_overflow = 1

max_step = 1
stop_time = 0.2

geometry.is_periodic = 0 0 0
geometry.coord_sys = 0 # 0 => cart, 1 => RZ 2=>spherical
geometry.prob_lo = 0.0 -6 -6
geometry.prob_hi = 18 6 6
amr.n_cell = 72 48 48

# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<<
# 0 = Interior 3 = Symmetry
# 1 = Inflow 4 = SlipWall
# 2 = Outflow 5 = NoSlipWall
# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<<
CAMR.lo_bc = Outflow SlipWall SlipWall
CAMR.hi_bc = Outflow SlipWall SlipWall

CAMR.cfl = 0.3 # cfl number for hyperbolic system

CAMR.do_mol = 1

CAMR.v = 2
amr.v = 1

CAMR.sum_interval = 1

CAMR.redistribution_type = FluxRedist
CAMR.redistribution_type = StateRedist

# LOAD BALANCE
amr.loadbalance_with_workestimates = 0

# REFINEMENT / REGRIDDING
amr.max_level = 0 # maximum level number allowed

amr.ref_ratio = 2 2 2 2 # refinement ratio
amr.regrid_int = 2 2 2 2 # how often to regrid
amr.blocking_factor = 8
amr.max_grid_size = 64
amr.n_error_buf = 0 0 0 0 # number of buffer cells in error est

# CHECKPOINT FILES
amr.checkpoint_files_output = 0
amr.check_file = chk # root name of checkpoint file
amr.check_int = 100 # number of timesteps between checkpoints

# PLOTFILES
amr.plot_files_output = 1
amr.plot_file = plt # root name of plotfile
amr.plot_int = 1 # number of timesteps between plotfiles
amr.derive_plot_vars = x_velocity y_velocity z_velocity vfrac

# EB
CAMR.geometry = "converging-nozzle"
converging_nozzle.d_inlet = 10.0
converging_nozzle.l_inlet = 4.5
converging_nozzle.l_nozzle = 9.0
converging_nozzle.d_exit = 7.0710678119
eb2.small_volfrac=1.e-6
# problem specific parameter
prob.rho_l = 3.6737153092795505
prob.u_l = 3.8260444105770732
prob.p_l = 22.613625000000006
prob.rho_r = 1.0
prob.u_r = 0.0
prob.p_r = 2.5
prob.interface = -10.0

CAMR.hydro_tile_size=1024 8 8
1 change: 1 addition & 0 deletions Source/EB/Make.package
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CEXE_sources += eb_cylinder.cpp
CEXE_sources += eb_regular.cpp
CEXE_sources += eb_sphere.cpp
CEXE_sources += eb_plane.cpp
CEXE_sources += eb_converging_nozzle.cpp
CEXE_sources += writeEBsurface.cpp

CEXE_headers += eb_if.H
Expand Down
55 changes: 55 additions & 0 deletions Source/EB/eb_converging_nozzle.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include <AMReX_EB2.H>
#include <AMReX_EB2_IF.H>
#include <AMReX_ParmParse.H>

#include <algorithm>
#include <CAMR.H>

using namespace amrex;

/********************************************************************************
* *
* Function to create a converging nozzle EB. *
* *
********************************************************************************/
void make_eb_converging_nozzle (const Geometry& geom, int required_coarsening_level)
{
amrex::Real d_inlet = 8;
amrex::Real l_inlet = 24;
amrex::Real l_nozzle = 5;
amrex::Real d_exit = 5;

amrex::ParmParse pp("converging_nozzle");
pp.query("d_inlet", d_inlet);
pp.query("l_inlet", l_inlet);
pp.query("l_nozzle", l_nozzle);
pp.query("d_exit", d_exit);

amrex::EB2::CylinderIF main(
0.5 * d_inlet, 0,
{AMREX_D_DECL(static_cast<amrex::Real>(0.5 * l_inlet), 0, 0)}, true);

amrex::Real slope_nozzle =
(0.5 * d_inlet - 0.5 * d_exit) / l_nozzle;
amrex::Real norm = -1.0 / slope_nozzle;
amrex::Real nmag = std::sqrt(1 + 1 / (norm * norm));
amrex::EB2::PlaneIF nozzle_plane(
{AMREX_D_DECL(0, 0, 0)},
{AMREX_D_DECL(
static_cast<amrex::Real>(1.0 / nmag), slope_nozzle / nmag, 0.0)},
true);
auto nozzle = amrex::EB2::translate(
amrex::EB2::rotate(amrex::EB2::lathe(nozzle_plane), 90 * M_PI / 180, 1),
{AMREX_D_DECL(
l_inlet + static_cast<amrex::Real>(0.5 * d_inlet / slope_nozzle),
0, 0)});

amrex::EB2::CylinderIF exit(
0.5 * d_exit, 0, {AMREX_D_DECL(l_inlet + l_nozzle, 0, 0)},
true);
auto nozzle_exit = amrex::EB2::makeIntersection(nozzle, exit);

auto polys = amrex::EB2::makeUnion(main, nozzle_exit);
auto gshop = amrex::EB2::makeShop(polys);
EB2::Build(gshop, geom, required_coarsening_level, required_coarsening_level);
}
5 changes: 5 additions & 0 deletions Source/EB/embedded_boundaries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ void make_eb_sphere(const Geometry& geom, int required_coarsening_level);
void make_eb_box(const Geometry& geom, int required_coarsening_level);
void make_eb_cylinder(const Geometry& geom, int required_coarsening_level);
void make_eb_plane(const Geometry& geom, int required_coarsening_level, amrex::Real time);
void make_eb_converging_nozzle(const Geometry& geom, int required_coarsening_level);

void
initialize_EB2 (const Geometry& geom, const int required_coarsening_level,
Expand Down Expand Up @@ -50,6 +51,10 @@ initialize_EB2 (const Geometry& geom, const int required_coarsening_level,
{
make_eb_plane(geom, max_coarsening_level, time);
}
else if(geom_type == "converging-nozzle")
{
make_eb_converging_nozzle(geom, max_coarsening_level);
}
else
{
amrex::Print() << "\n No EB geometry declared in inputs => "
Expand Down

0 comments on commit e92d479

Please sign in to comment.