Skip to content

Commit 6db2cec

Browse files
union of boxes for EB
1 parent aa233ae commit 6db2cec

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

ExampleCodes/EB/NodalPoisson/inputs

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ verbose = 2
44
n_cell = 128
55
max_grid_size = 32
66

7-
eb2.geom_type = sphere
8-
eb2.sphere_center = 0.5 0.5 0.5
9-
eb2.sphere_radius = 0.25
10-
eb2.sphere_has_fluid_inside = 1
7+
eb2.geom_type = merge
8+
#eb2.geom_type = sphere
9+
#eb2.sphere_center = 0.5 0.5 0.5
10+
#eb2.sphere_radius = 0.25
11+
#eb2.sphere_has_fluid_inside = 1
1112

ExampleCodes/EB/NodalPoisson/main.cpp

+32-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@
44
#include <AMReX_EBMultiFabUtil.H>
55
#include <AMReX_EB2.H>
66
#include <AMReX_EB2_IF.H>
7+
8+
9+
#include <AMReX_EB2_IF_Union.H>
10+
#include <AMReX_EB2_IF_Intersection.H>
11+
#include <AMReX_EB2_IF_Complement.H>
12+
#include <AMReX_EB2_IF_Scale.H>
13+
#include <AMReX_EB2_IF_Translation.H>
14+
#include <AMReX_EB2_IF_Lathe.H>
15+
#include <AMReX_EB2_IF_Box.H>
16+
#include <AMReX_EB2_IF_Cylinder.H>
17+
#include <AMReX_EB2_IF_Ellipsoid.H>
18+
#include <AMReX_EB2_IF_Sphere.H>
19+
#include <AMReX_EB2_IF_Plane.H>
20+
21+
#include <AMReX_ParmParse.H>
722
#include <AMReX_MLEBABecLap.H>
823
#include <AMReX_MLEBNodeFDLaplacian.H>
924
#include <AMReX_PlotFileUtil.H>
@@ -50,7 +65,23 @@ int main (int argc, char* argv[])
5065
int required_coarsening_level = 0; // typically the same as the max AMR level index
5166
int max_coarsening_level = 100; // typically a huge number so MG coarsens as much as possible
5267
// build a simple geometry using the "eb2." parameters in the inputs file
53-
EB2::Build(geom, required_coarsening_level, max_coarsening_level);
68+
ParmParse pp("eb2");
69+
std::string geom_type;
70+
pp.get("geom_type", geom_type);
71+
if (geom_type == "merge") {
72+
EB2::SphereIF sphere1(0.25,{AMREX_D_DECL(0.5,0.5,0.5)},true);
73+
EB2::SphereIF sphere2(0.1,{AMREX_D_DECL(0.5,0.5,0.5)},true);
74+
auto twospheres = EB2::makeUnion(sphere1,sphere2);
75+
EB2::BoxIF box1({AMREX_D_DECL(0.25,0.0,0)},
76+
{AMREX_D_DECL(0.75, 0.25,0)},false);
77+
EB2::BoxIF box2({AMREX_D_DECL(0.25,0.75,0)},
78+
{AMREX_D_DECL(0.75,1. ,0)},false);
79+
auto twoboxes = EB2::makeUnion(box1,box2);
80+
auto gshop = EB2::makeShop(twoboxes);
81+
EB2::Build(gshop, geom, required_coarsening_level, max_coarsening_level);
82+
} else {
83+
EB2::Build(geom, required_coarsening_level, max_coarsening_level);
84+
}
5485

5586
const EB2::IndexSpace& eb_is = EB2::IndexSpace::top();
5687
const EB2::Level& eb_level = eb_is.getLevel(geom);

0 commit comments

Comments
 (0)