chombo-discharge
CD_CdrDomainBCImplem.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2021 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_CdrDomainBCImplem_H
13 #define CD_CdrDomainBCImplem_H
14 
15 // Our includes
16 #include <CD_CdrDomainBC.H>
17 #include <CD_NamespaceHeader.H>
18 
20 {
21  // TLDR: The default constructor populates the m_bcTypes and m_bcFunctions with wall functions and types. Users
22  // can later override these.
23 
24  // Flux function which returns zero everywhere.
25  auto wallBc = [](const RealVect a_position, const Real a_time) -> Real {
26  return 0.0;
27  };
28 
29  for (int dir = 0; dir < SpaceDim; dir++) {
30  for (SideIterator sit; sit.ok(); ++sit) {
31  const DomainSide domainSide = this->domainSide(dir, sit());
32 
33  m_bcTypes.emplace(domainSide, BcType::Wall);
34  m_bcFunctions.emplace(domainSide, wallBc);
35  }
36  }
37 }
38 
40 {}
41 
43 CdrDomainBC::domainSide(const int a_dir, const Side::LoHiSide a_side) const
44 {
45  return std::make_pair(a_dir, a_side);
46 }
47 
49 CdrDomainBC::getBcType(const DomainSide& a_domainSide) const
50 {
51  return m_bcTypes.at(a_domainSide);
52 }
53 
55 CdrDomainBC::getBcFunction(const DomainSide& a_domainSide) const
56 {
57  return m_bcFunctions.at(a_domainSide);
58 }
59 
60 void
61 CdrDomainBC::setBcType(const DomainSide& a_domainSide, const BcType& a_bcType)
62 {
63  m_bcTypes.at(a_domainSide) = a_bcType;
64 }
65 
66 void
67 CdrDomainBC::setBcFunction(const DomainSide& a_domainSide, const FluxFunction& a_function)
68 {
69  m_bcFunctions.at(a_domainSide) = a_function;
70 }
71 
72 #include <CD_NamespaceFooter.H>
73 
74 #endif
Declaration of domain boundary condition types for CdrSolver.
~CdrDomainBC()
Destructor. Does nothing.
Definition: CD_CdrDomainBCImplem.H:39
const FluxFunction & getBcFunction(const DomainSide &a_domainSide) const
Get the BC type on a particular domain side.
Definition: CD_CdrDomainBCImplem.H:55
void setBcFunction(const DomainSide &a_domainSide, const FluxFunction &a_function)
Set the BC type on a domain side.
Definition: CD_CdrDomainBCImplem.H:67
CdrDomainBC()
Initializing constructor.
Definition: CD_CdrDomainBCImplem.H:19
std::function< Real(const RealVect a_position, const Real a_time)> FluxFunction
Function which maps f(R^3,t) : R. Used for setting the associated value and boundary condition type.
Definition: CD_CdrDomainBC.H:51
const BcType & getBcType(const DomainSide &a_domainSide) const
Get the BC type on a particular domain side.
Definition: CD_CdrDomainBCImplem.H:49
std::map< DomainSide, FluxFunction > m_bcFunctions
BC functions on various domain edges.
Definition: CD_CdrDomainBC.H:145
std::map< DomainSide, BcType > m_bcTypes
BC types on various domain edges.
Definition: CD_CdrDomainBC.H:140
std::pair< int, Side::LoHiSide > DomainSide
Alias for mapping a direction and side. The first element in pair is the coordinate direction and the...
Definition: CD_CdrDomainBC.H:56
void setBcType(const DomainSide &a_domainSide, const BcType &a_bcType)
Set the BC type on a domain side.
Definition: CD_CdrDomainBCImplem.H:61
BcType
Boundary condition types for the CDR solvers.
Definition: CD_CdrDomainBC.H:37
DomainSide domainSide(const int a_dir, const Side::LoHiSide a_side) const
Create a domain side from dir/side.
Definition: CD_CdrDomainBCImplem.H:43