MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / initialize_EB2

Function initialize_EB2

Tests/EB/CNS/Source/CNS_init_eb2.cpp:12–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace amrex;
11
12void
13initialize_EB2 (const Geometry& geom, int /*required_coarsening_level*/,
14 int max_coarsening_level)
15{
16 BL_PROFILE("initializeEB2");
17
18 ParmParse ppeb2("eb2");
19 std::string geom_type;
20 ppeb2.get("geom_type", geom_type);
21
22 if (geom_type == "combustor")
23 {
24 ParmParse pp("combustor");
25
26 Real fwl;
27 pp.get("far_wall_loc",fwl);
28
29 EB2::PlaneIF farwall({AMREX_D_DECL(fwl,0.,0.)},
30 {AMREX_D_DECL(1. ,0.,0.)});
31
32 Vector<Real> pl1pt, pl2pt, pl2nm, pl3pt;
33 pp.getarr("ramp_plane1_point", pl1pt);
34 pp.getarr("ramp_plane2_point", pl2pt);
35 pp.getarr("ramp_plane2_normal", pl2nm);
36 pp.getarr("ramp_plane3_point", pl3pt);
37
38 auto ramp = EB2::makeIntersection(EB2::PlaneIF({pl1pt[0], pl1pt[1], 0.},
39 { 0., -1., 0.}),
40 EB2::PlaneIF({pl2pt[0], pl2pt[1], 0.},
41 {pl2nm[0], pl2nm[1], 0.}),
42 EB2::PlaneIF({pl3pt[0], pl3pt[1], 0.},
43 { 1., 0., 0.}));
44
45 Vector<Real> pipelo, pipehi;
46 pp.getarr("pipe_lo", pipelo);
47 pp.getarr("pipe_hi", pipehi);
48
49 EB2::BoxIF pipe({pipelo[0], pipelo[1], -1.}, {pipehi[0], pipehi[1], 1.}, false);
50
51 // where does plane 1 and plane 2 intersect?
52 Real k2 = std::abs(pl2nm[0]/pl2nm[1]);
53 Real secty = pl2pt[1] + k2*(pl3pt[0]-pl2pt[0]);
54 // How much do we cut?
55 Real dx = geom.CellSize(0);
56 Real dycut = 4.*(1.+max_coarsening_level)*std::min(dx, k2*dx);
57 EB2::BoxIF flat_corner({pl3pt[0], 0., -1.}, {1.e10, secty+dycut, 1.}, false);
58
59 auto polys = EB2::makeUnion(farwall, ramp, pipe, flat_corner);
60
61 Real lenx = geom.ProbLength(0);
62 Real leny = geom.ProbLength(1);
63 auto pr = EB2::translate(EB2::lathe(polys), {lenx*0.5, leny*0.5, 0.});
64
65 auto gshop = EB2::makeShop(pr);
66 EB2::Build(gshop, geom, max_coarsening_level, max_coarsening_level, 4);
67 }
68 else
69 {

Callers 1

mainFunction · 0.70

Calls 11

makeIntersectionFunction · 0.85
PlaneIFClass · 0.85
makeUnionFunction · 0.85
translateFunction · 0.85
latheFunction · 0.85
makeShopFunction · 0.85
ProbLengthMethod · 0.80
BuildFunction · 0.50
getMethod · 0.45
getarrMethod · 0.45
CellSizeMethod · 0.45

Tested by

no test coverage detected