Alamo
Wedge.H
Go to the documentation of this file.
1 #ifndef IC_WEDGE_H_
2 #define IC_WEDGE_H_
3 
4 #include "IC/IC.H"
5 
6 namespace IC
7 {
8 /// Initialize a coupon-shaped IC (for the Flame simulation)
9 class Wedge : public IC
10 {
11 public:
12  Wedge (amrex::Vector<amrex::Geometry> &_geom) : IC(_geom) {};
13 
14  void Add(const int &lev, Set::Field<Set::Scalar> &field)
15  {
16  amrex::Real sizex = geom[0].ProbHi()[0] - geom[0].ProbLo()[0];
17  // AMREX_D_TERM(,
18  // amrex::Real sizey = geom[0].ProbHi()[1] - geom[0].ProbLo()[1];,
19  // amrex::Real sizez = geom[0].ProbHi()[2] - geom[0].ProbLo()[2];);
20 
21 /// The angle of the wedge is currently hardcoded as 45 degrees
22  amrex::Real angle = 45.0 * 0.01745329251;
23 
24 
25  for (amrex::MFIter mfi(*field[lev],true); mfi.isValid(); ++mfi)
26  {
27  const amrex::Box& box = mfi.tilebox();
28 
29  amrex::BaseFab<amrex::Real> &field_box = (*field[lev])[mfi];
30 
31  AMREX_D_TERM(for (int i = box.loVect()[0]-field[lev]->nGrow(); i<=box.hiVect()[0]+field[lev]->nGrow(); i++),
32  for (int j = box.loVect()[1]-field[lev]->nGrow(); j<=box.hiVect()[1]+field[lev]->nGrow(); j++),
33  for (int k = box.loVect()[2]-field[lev]->nGrow(); k<=box.hiVect()[2]+field[lev]->nGrow(); k++))
34  {
35  AMREX_D_TERM(amrex::Real x = geom[lev].ProbLo()[0] + ((amrex::Real)(i) + 0.5) * geom[lev].CellSize()[0];,
36  amrex::Real y = geom[lev].ProbLo()[1] + ((amrex::Real)(j) + 0.5) * geom[lev].CellSize()[1];,
37  );
38 
39  amrex::IntVect m(AMREX_D_DECL(i,j,k));
40 
41 
42  if (y > (x+0.5*sizex)*std::tan(angle) ||
43  y < -(x+0.5*sizex)*std::tan(angle)) // outside
44  field_box(m) = 0.0;
45  else
46  field_box(m) = 1.0;
47 
48  }
49  }
50  }
51 
52 
53 private:
54 };
55 }
56 #endif
IC::IC::geom
amrex::Vector< amrex::Geometry > & geom
Definition: IC.H:45
BC::AMREX_D_DECL
@ AMREX_D_DECL
Definition: BC.H:34
Set::Field< Set::Scalar >
Definition: Set.H:236
IC::Wedge::Add
void Add(const int &lev, Set::Field< Set::Scalar > &field)
Definition: Wedge.H:14
IC::Wedge::Wedge
Wedge(amrex::Vector< amrex::Geometry > &_geom)
Definition: Wedge.H:12
IC
Definition: Affine.H:18
IC.H
IC::Wedge
Initialize a coupon-shaped IC (for the Flame simulation)
Definition: Wedge.H:9