-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into RRTMGP_Port
- Loading branch information
Showing
29 changed files
with
1,957 additions
and
561 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
target_include_directories( simplexacore PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>) | ||
|
||
target_sources( simplexacore PRIVATE | ||
eb.cpp | ||
eb_box.cpp | ||
eb_terrain.cpp | ||
eb_cut_cell.cpp | ||
eb_aux.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#ifndef ERF_EB_H_ | ||
#define ERF_EB_H_ | ||
|
||
#include <AMReX_Geometry.H> | ||
#include <AMReX_DistributionMapping.H> | ||
#include <AMReX_BoxArray.H> | ||
|
||
#include <AMReX_EB2.H> | ||
#include <AMReX_EBFabFactory.H> | ||
|
||
#include <ERF_EBAux.H> | ||
|
||
class eb_ { | ||
|
||
public: | ||
|
||
~eb_ (); | ||
|
||
eb_ (amrex::Geometry const& a_geom, | ||
amrex::FArrayBox const& terrain_fab, | ||
amrex::Gpu::DeviceVector<amrex::Real>& a_dz_stretched, | ||
bool is_anelastic); | ||
|
||
void make_factory ( amrex::Geometry const& a_geom, | ||
amrex::DistributionMapping const& a_dmap, | ||
amrex::BoxArray const& a_grids); | ||
|
||
int nghost_basic () const { return 2; } | ||
int nghost_volume () const { return 2; } | ||
int nghost_full () const { return 2; } | ||
|
||
amrex::EBFArrayBoxFactory const* get_const_factory () noexcept | ||
{ return m_factory.get(); } | ||
|
||
amrex::EB2::Level const* get_level () const noexcept | ||
{ return m_eb_level; } | ||
|
||
private: | ||
|
||
int m_has_eb; | ||
std::string m_type; | ||
|
||
amrex::EBSupport m_support_level; | ||
|
||
int m_write_eb_surface; | ||
|
||
//! EB level constructed from building GeometryShop | ||
amrex::EB2::Level const* m_eb_level; | ||
|
||
std::unique_ptr<amrex::EBFArrayBoxFactory> m_factory; | ||
|
||
eb_aux_ m_u_factory; | ||
eb_aux_ m_v_factory; | ||
eb_aux_ m_w_factory; | ||
|
||
void make_box (amrex::Geometry const& a_geom); | ||
void make_terrain (amrex::Geometry const& a_geom); | ||
|
||
//! Construct EB levels from Geometry shop. | ||
template<class F> | ||
void build_level (amrex::Geometry const& a_geom, | ||
amrex::EB2::GeometryShop<F> a_gshop) | ||
{ | ||
int const req_lev(0); | ||
int const max_lev(2); | ||
|
||
amrex::EB2::Build(a_gshop, a_geom, req_lev, max_lev); | ||
const amrex::EB2::IndexSpace& ebis = amrex::EB2::IndexSpace::top(); | ||
m_eb_level = &(ebis.getLevel(a_geom)); | ||
} | ||
|
||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#include <AMReX_ParmParse.H> | ||
#include <AMReX_Print.H> | ||
#include <AMReX_WriteEBSurface.H> | ||
|
||
#include <ERF_EBIFTerrain.H> | ||
#include <ERF_ProbCommon.H> | ||
|
||
#include <ERF_EB.H> | ||
|
||
using namespace amrex; | ||
|
||
eb_::~eb_() | ||
{ | ||
if (m_factory) { m_factory.reset(nullptr); } | ||
} | ||
|
||
eb_:: eb_ ( Geometry const& a_geom, amrex::FArrayBox const& terrain_fab, | ||
amrex::Gpu::DeviceVector<amrex::Real>& a_dz_stretched, | ||
bool is_anelastic) | ||
: m_has_eb(0), | ||
m_support_level(EBSupport::full), | ||
m_write_eb_surface(0) | ||
{ | ||
m_type = "terrain"; | ||
|
||
int max_coarsening_level; | ||
if (is_anelastic) { | ||
max_coarsening_level = 100; | ||
} else { | ||
max_coarsening_level = 0; | ||
} | ||
|
||
int max_level_here = 0; | ||
|
||
if (m_type == "terrain") | ||
{ | ||
Print() << "\nBuilding EB geometry based on terrain.\n"; | ||
|
||
TerrainIF ebterrain(terrain_fab, a_geom, a_dz_stretched); | ||
|
||
auto gshop = EB2::makeShop(ebterrain); | ||
|
||
EB2::Build(gshop, a_geom, max_level_here, max_level_here+max_coarsening_level); | ||
|
||
m_has_eb = 1; | ||
|
||
} else if (m_type == "box") { | ||
|
||
Print() << "\nBuilding box geometry.\n"; | ||
make_box(a_geom); | ||
m_has_eb = 1; | ||
|
||
} else { | ||
|
||
EB2::AllRegularIF regular; | ||
auto gshop = EB2::makeShop(regular); | ||
build_level(a_geom, gshop); | ||
} | ||
} | ||
|
||
void | ||
eb_:: | ||
make_factory ( Geometry const& a_geom, | ||
DistributionMapping const& a_dmap, | ||
BoxArray const& a_grids) | ||
{ | ||
Print() << "making EB factory\n"; | ||
m_factory = std::make_unique<EBFArrayBoxFactory>(*m_eb_level, a_geom, a_grids, a_dmap, | ||
Vector<int>{nghost_basic(), nghost_volume(), nghost_full()}, m_support_level); | ||
|
||
if (m_write_eb_surface) { | ||
WriteEBSurface(a_grids, a_dmap, a_geom, m_factory.get()); | ||
} | ||
|
||
{ int const idim(0); | ||
|
||
Print() << "making EB staggered u-factory\n"; | ||
//m_u_factory.set_verbose(); | ||
m_u_factory.define(idim, a_geom, a_grids, a_dmap, | ||
Vector<int>{nghost_basic(), nghost_volume(), nghost_full()}, | ||
m_factory.get()); | ||
} | ||
|
||
{ int const idim(1); | ||
Print() << "making EB staggered v-factory\n"; | ||
//m_v_factory.set_verbose(); | ||
m_v_factory.define(idim, a_geom, a_grids, a_dmap, | ||
Vector<int>{nghost_basic(), nghost_volume(), nghost_full()}, | ||
m_factory.get()); | ||
} | ||
|
||
{ int const idim(2); | ||
Print() << "making EB staggered w-factory\n"; | ||
//m_w_factory.set_verbose(); | ||
m_w_factory.define(idim, a_geom, a_grids, a_dmap, | ||
Vector<int>{nghost_basic(), nghost_volume(), nghost_full()}, | ||
m_factory.get()); | ||
} | ||
|
||
Print() << "\nDone making EB factory.\n\n"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#ifndef ERF_EB_AUX_H_ | ||
#define ERF_EB_AUX_H_ | ||
|
||
#include <AMReX_Geometry.H> | ||
#include <AMReX_DistributionMapping.H> | ||
#include <AMReX_BoxArray.H> | ||
|
||
#include <AMReX_EB2.H> | ||
#include <AMReX_EBFabFactory.H> | ||
|
||
class eb_aux_ | ||
{ | ||
public: | ||
|
||
eb_aux_ (); | ||
~eb_aux_ (); | ||
|
||
void define ( int const& a_idim, | ||
amrex::Geometry const& a_geom, | ||
amrex::BoxArray const& a_grids, | ||
amrex::DistributionMapping const& a_dmap, | ||
amrex::Vector<int> const& a_ngrow, | ||
amrex::EBFArrayBoxFactory const* a_factory); | ||
|
||
void set_verbose ( ) { m_verbose = 1; } | ||
|
||
private: | ||
|
||
int m_verbose; | ||
|
||
// int m_defined; | ||
|
||
amrex::FabArray<amrex::EBCellFlagFab>* m_cellflags = nullptr; | ||
|
||
amrex::MultiFab* m_volfrac = nullptr; | ||
|
||
// amrex::MultiCutFab* m_centroid = nullptr; | ||
// amrex::MultiCutFab* m_bndrycent = nullptr; | ||
// amrex::MultiCutFab* m_bndryarea = nullptr; | ||
// amrex::MultiCutFab* m_bndrynorm = nullptr; | ||
|
||
// amrex::Array<amrex::MultiCutFab*,AMREX_SPACEDIM> m_areafrac {{AMREX_D_DECL(nullptr, nullptr, nullptr)}}; | ||
// amrex::Array<amrex::MultiCutFab*,AMREX_SPACEDIM> m_facecent {{AMREX_D_DECL(nullptr, nullptr, nullptr)}}; | ||
// amrex::Array<amrex::MultiCutFab*,AMREX_SPACEDIM> m_edgecent {{AMREX_D_DECL(nullptr, nullptr, nullptr)}}; | ||
|
||
}; | ||
|
||
#endif |
Oops, something went wrong.