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

Cartesian aligned nested refinement for wind farm simulations #33

Merged
merged 3 commits into from
Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Add fix to reset global Geometry object
  • Loading branch information
sayerhs committed Mar 27, 2020
commit e5ac276f33d21d2666c513ba2df0bcd7c4fee890
12 changes: 12 additions & 0 deletions unit_tests/aw_test_utils/MeshTest.H
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,21 @@ public:
//! Create the mesh instance
virtual void create_mesh_instance();

template<typename T>
void create_mesh_instance()
{
if (!m_mesh) {
reset_prob_domain();
m_mesh.reset(new T());
}
}

//! Perform initialization actions
virtual void initialize_mesh();

//! Reset the problem domain for this test
virtual void reset_prob_domain();

amr_wind::SimTime& time()
{
if (!m_time)
Expand Down
21 changes: 20 additions & 1 deletion unit_tests/aw_test_utils/MeshTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ namespace amr_wind_tests {

void MeshTest::create_mesh_instance()
{
if (!m_mesh) m_mesh.reset(new AmrTestMesh());
if (!m_mesh) {
reset_prob_domain();
m_mesh.reset(new AmrTestMesh());
}
}

void MeshTest::initialize_mesh()
Expand All @@ -16,6 +19,22 @@ void MeshTest::initialize_mesh()
m_mesh->initialize_mesh(0.0);
}

void MeshTest::reset_prob_domain()
{
amrex::Vector<amrex::Real> problo(3), probhi(3);

amrex::ParmParse pp("geometry");
pp.getarr("prob_lo",problo,0,AMREX_SPACEDIM);
pp.getarr("prob_hi",probhi,0,AMREX_SPACEDIM);

amrex::RealBox rb(problo.data(), probhi.data());
amrex::Geometry* gg = amrex::AMReX::top()->getDefaultGeometry();

if (gg != nullptr) {
gg->ResetDefaultProbDomain(rb);
}
}

void MeshTest::populate_parameters()
{
pp_utils::default_time_inputs();
Expand Down
10 changes: 2 additions & 8 deletions unit_tests/utilities/test_refinement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,7 @@ class NestRefineMesh : public AmrTestMesh

//! Custom test fixture for Cartesian Box refinement
class NestRefineTest : public MeshTest
{
public:
void create_mesh_instance() override
{
if (!m_mesh) m_mesh.reset(new NestRefineMesh());
}
};
{};

TEST_F(NestRefineTest, box_refine)
{
Expand Down Expand Up @@ -75,7 +69,7 @@ TEST_F(NestRefineTest, box_refine)
ss << "-10.0 25.0 0.0 15.0 35.0 20.0" << std::endl;
ss << "-10.0 65.0 0.0 15.0 75.0 20.0" << std::endl;

create_mesh_instance();
create_mesh_instance<NestRefineMesh>();
std::unique_ptr<amr_wind::CartBoxRefinement> box_refine(new amr_wind::CartBoxRefinement);
box_refine->read_inputs(mesh(), ss);

Expand Down