22 #include <LbmLib/include/solver/BioSolver/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 TARGETAREA2 = 1000;
37 const double KP = 0.00001;
38 const double KI = 0.0;
39 const double MAXSOURCE = 0.004;
42 BioSolverAreaRegulator::BioSolverAreaRegulator() : BioBaseSolver()
49 std::map<unsigned int,double> areas;
50 std::map<unsigned int,double> temperror;
51 std::map<unsigned int,double> sourcemap;
52 std::map<unsigned int,double> uncutsourcemap;
53 unsigned int domainid;
56 if (Parameters.getCurrentIteration()%FREQUENCY != 0) {
61 if (Parameters.getCurrentIteration()<5000) {
62 this->targetareamap_[1] = TARGETAREA2;
63 this->integratormap_[1] = 0.0;
66 this->targetareamap_[1] = TARGETAREA;
74 for (
auto it : areas) {
75 if ( this->targetareamap_.find(it.first) == this->targetareamap_.end() ) {
76 this->targetareamap_[it.first] = TARGETAREA;
77 this->integratormap_[it.first] = 0.0;
82 for (
auto it : areas) {
83 temperror[it.first] = this->targetareamap_[it.first] - areas[it.first];
87 for (
auto it : areas) {
88 this->integratormap_[it.first] += temperror[it.first];
92 for (
auto it : areas) {
93 uncutsourcemap[it.first] = KP*temperror[it.first] + KI*this->integratormap_[it.first];
97 for (
auto it : uncutsourcemap)
99 if (uncutsourcemap[it.first] > MAXSOURCE) {
100 sourcemap[it.first] = MAXSOURCE;
102 else if (uncutsourcemap[it.first] < 0.0) {
103 sourcemap[it.first] = 0.0;
106 sourcemap[it.first] = uncutsourcemap[it.first];
111 #pragma omp parallel for schedule(dynamic) private(domainid,source)
112 for (
unsigned int ity = 0;
115 for (
unsigned int itx = 0;
118 domainid = geometryhandler.
getPhysicalNodes()[ity][itx]->getDomainIdentifier();
121 geometryhandler.
getPhysicalNodes()[ity][itx]->getFluidSolver().addMass(MAXSOURCE);
124 source = sourcemap[domainid];
125 geometryhandler.
getPhysicalNodes()[ity][itx]->getFluidSolver().addMass(source);
132 const std::string BioSolverAreaRegulator::name =
"BioSolverAreaRegulator";
virtual void applyBioProcess(geometry::GeometryHandler &geometryhandler, solver::ForceSolver &forcesolver)
Applies biological processes.
const std::map< unsigned int, double > computeAreas() const
Compute the areas of the domains by using the domainIdentifiers.
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