22 #include <LbmLib/include/nodes/PhysicalNode.hpp>
23 #include <LbmLib/include/nodes/BoundaryNode.hpp>
24 #include <LbmLib/include/solver/CDESolver/CDEAbstractSolver.hpp>
25 #include <LbmLib/include/solver/CDESolver/CDESolverFactory.hpp>
26 #include <UtilLib/include/Exception.hpp>
27 #include <UtilLib/include/Log.hpp>
42 fluidSolver_(solver::FluidSolver(*this)),
44 9> {{
nullptr,
nullptr,
nullptr,
nullptr,
45 nullptr,
nullptr,
nullptr,
49 5> {{
nullptr,
nullptr,
nullptr,
nullptr,
57 for (
const auto& i : cdeSolvers_) {
65 explicit Contains(std::string s) : d(s) {}
72 if (std::any_of(this->cdeSolvers_.begin(), this->cdeSolvers_.end(),
73 Contains(cdeSolverName))) {
74 std::stringstream error;
75 error <<
"The CDE Solver with the name " << cdeSolverName <<
76 " already exists. You cannot add the same twice\n";
77 lbm_fail(error.str());
82 this->cdeSolvers_.back()->initCDESolver(
this, this->cdeSolvers_.size() - 1);
88 assert(node !=
nullptr);
89 neighbourNodes_[d] = node;
90 assert(node == neighbourNodes_[d]);
96 assert(boundaryNode !=
nullptr);
97 boundaryNodes_[d] = boundaryNode;
98 assert(boundaryNode == boundaryNodes_[d]);
102 return boundaryNodes_[d];
106 return neighbourNodes_[d];
110 unsigned int domainTemp = this->domainIdentifier_;
111 for (
auto bd : this->boundaryNodes_) {
113 domainTemp = bd->getDomainIdentifier();
117 if (this->domainIdentifier_ != domainTemp) {
118 LOG(UtilLib::logINFO) <<
"PhysicalNode at (" <<this->
getXPos() <<
","
119 << this->
getYPos() <<
") " <<
"changed domainID from "
120 << this->domainIdentifier_ <<
" to " << domainTemp;
121 this->domainIdentifier_ = domainTemp;
122 this->reinitialiseCDESolvers();
127 return domainIdentifier_;
131 domainIdentifier_ = domainIdentifier;
135 return this->cellType_;
139 this->cellType_ = celltype;
142 void PhysicalNode::reinitialiseCDESolvers() {
143 for (
auto cdeSolver : cdeSolvers_) {
144 cdeSolver->reinitialise();
150 std::array<BoundaryNode*, 5> {{
nullptr,
nullptr,
nullptr,
nullptr,
155 return std::string(
"PhysicalNode");
167 return *cdeSolvers_[id];
171 const std::string& name)
const {
172 for (
const auto& cdeSolver : cdeSolvers_) {
173 if (cdeSolver->getName() == name) {
177 std::stringstream error;
178 error <<
"The CDE Solver with the name " << name <<
179 " does not exists. You need to add them first\n";
184 return this->cdeSolvers_;
188 double localId = 10000000.0 *
getXPos() + 10000.0 *
189 static_cast<double>(
getYPos());
190 (*oStream) << std::setprecision(12) << localId <<
"[pos=\"" <<
getXPos() <<
191 "," <<
getYPos() << std::setprecision(5) <<
192 "!\",shape=circle, label=\"" << domainIdentifier_ <<
"\"];" <<
195 for (
auto bt : boundaryNodes_) {
197 double nodeId1 = 10000000.0 * bt->getXPos() + 10000.0 *
198 static_cast<double>(bt->getYPos());
199 (*oStream) << std::setprecision(12) << nodeId1 << std::setprecision(
200 5) <<
"[pos=\"" << bt->getXPos() <<
"," << bt->getYPos() <<
201 "!\",shape=triangle, label=\"" << bt->getXPos() <<
";" <<
202 bt->getYPos() <<
"\"];" << std::endl;
204 (*oStream) << std::setprecision(12) << localId <<
"->" <<
205 nodeId1 << std::setprecision(5) <<
" [ label=\"" << i <<
206 "\" ];" << std::endl;
The abstract base class for all CDESolvers.
solver::CDEAbstractSolver & getCDESolverSlow(const std::string &name) const
getCDESolverSlow Getter method for the cde Solver
void dumpNode(std::ostream *oStream) const
dumpNode dumps the node for dot
virtual std::string getName()=0
Get the name of the solver.
void setCellType(unsigned int celltype)
setCellType setter for the celltype
PhysicalNode * getPhysicalNeighbour(const Direction &d) const
getPhysicalNeighbour Getter method to access the Physical Neighbour
The EulerianPoint class The base class for all points with an integer position and no speed...
class representing a physical node
void setDomainIdentifier(unsigned int domainIdentifier)
setDomainIdentifier setter for the domain identifier
the Fluid Solver which solves the D2Q9 LBGK
void setBoundaryNeighbour(BoundaryNode *const boundaryNode, const Direction &d)
setBoundaryNeighbour Setter for the neighbour boundary point
PhysicalNode(int x, int y)
PhysicalNode constructs a physical node.
unsigned int getDomainIdentifier() const
getter for the Domain Identifier of this node
~PhysicalNode()
~PhysicalNode Destructor
unsigned int getCellType() const
getter for the cell type of this node
void updateDomainIdentifier()
updateDomainIdentifier updates the domain Identifier of this node. If the domain changes it returns t...
const solver::FluidSolver & getFluidSolver() const
getFluidSolver Const getter method for the fluid Solver
int getXPos() const
getXPos Getter for the X position
virtual std::string getType() const
getType The type of a node class
BoundaryNode * getBoundaryNeighbour(const Direction &d) const
getBoundaryNeighbour Getter method to access the Boundary Neighbour
int getYPos() const
getYPos Getter for the Y position
void addCDESolver(const std::string &cdeSolverName)
addCDESolver Adds a CDESolver to this node
class representing a boundary node
solver::CDEAbstractSolver & getCDESolver(size_t id) const
getCDESolver Getter method for the cde Solver
std::vector< solver::CDEAbstractSolver * > & getCDESolvers()
getCDESolvers Getter method for all CDE Solvers
void resetBoundaryNodes()
resetBoundaryNodes Resets the boundary nodes to nullptr
void setPhysicalNeighbour(PhysicalNode *const node, const Direction &d)
setPhysicalNeighbour Setter for the neighbour fluid point