22 #include <LbmLib/include/solver/BioSolver/tutorial_01_BioSolverAreaRegulator.hpp>
23 #include <LbmLib/include/GlobalSimulationParameters.hpp>
24 #include <LbmLib/include/geometry/GeometryHandler.hpp>
25 #include <LbmLib/include/nodes/PhysicalNode.hpp>
34 const unsigned int FREQUENCY = 1;
35 const double TARGETAREA = 200.0;
36 const double KP = 0.00001;
37 const double MAXSOURCE = 0.004;
40 tutorial_01_BioSolverAreaRegulator::tutorial_01_BioSolverAreaRegulator() : BioBaseSolver()
47 std::map<unsigned int,double> areas;
48 std::map<unsigned int,double> sourcemap;
49 unsigned int domainid;
51 if (Parameters.getCurrentIteration()%FREQUENCY != 0) {
59 for (
auto it : areas) {
60 if ( this->targetareamap_.find(it.first) == this->targetareamap_.end() ) {
61 this->targetareamap_[it.first] = TARGETAREA;
66 for (
auto it : areas) {
67 sourcemap[it.first] = KP*(this->targetareamap_[it.first] - areas[it.first]);
71 for (
auto it : sourcemap)
73 if (sourcemap[it.first] > MAXSOURCE) {
74 sourcemap[it.first] = MAXSOURCE;
76 else if (sourcemap[it.first] < -MAXSOURCE) {
77 sourcemap[it.first] = -MAXSOURCE;
82 #pragma omp parallel for schedule(dynamic) private(domainid)
83 for (
unsigned int ity = 0;
86 for (
unsigned int itx = 0;
89 domainid = geometryhandler.
getPhysicalNodes()[ity][itx]->getDomainIdentifier();
92 geometryhandler.
getPhysicalNodes()[ity][itx]->getFluidSolver().addMass(MAXSOURCE);
95 geometryhandler.
getPhysicalNodes()[ity][itx]->getFluidSolver().addMass(sourcemap[domainid]);
102 const std::string tutorial_01_BioSolverAreaRegulator::name =
"tutorial_01_BioSolverAreaRegulator";
const std::map< unsigned int, double > computeAreas() const
Compute the areas of the domains by using the domainIdentifiers.
virtual void applyBioProcess(geometry::GeometryHandler &geometryhandler, solver::ForceSolver &forcesolver)
Applies biological processes.
const std::vector< std::vector< nodes::PhysicalNode * > > & getPhysicalNodes() const
getPhysicalNodes Getter method for the physical node grid
class responsible for generating the internal geometry representation