From 274eeae3e03ad36998c8fa600763391cd0784ce4 Mon Sep 17 00:00:00 2001
From: Hussein Alihussein <h.alihussein@tu-braunschweig.de>
Date: Wed, 22 Nov 2023 10:34:16 +0100
Subject: [PATCH] clean BC

---
 apps/cpu/TPMSRow/TPMSRow.cpp                  | 38 +++++++++----------
 .../NonReflectingInflowBCStrategy.cpp         | 13 +++----
 .../NonReflectingInflowBCStrategy.h           |  2 +-
 3 files changed, 26 insertions(+), 27 deletions(-)

diff --git a/apps/cpu/TPMSRow/TPMSRow.cpp b/apps/cpu/TPMSRow/TPMSRow.cpp
index 6a7652a8f..8034c269d 100644
--- a/apps/cpu/TPMSRow/TPMSRow.cpp
+++ b/apps/cpu/TPMSRow/TPMSRow.cpp
@@ -26,15 +26,15 @@ void run(string configname)
         double dx                   = config.getValue<double>("dx");
         double UnitEdgeLength       = config.getValue<double>("UnitEdgeLength");
         double Re                   = config.getValue<double>("Re");
-        double Re0                  = config.getValue<double>("Re0");
+        //double Re0                  = config.getValue<double>("Re0");
         //double rhoIn                = config.getValue<double>("rhoIn");
         //string geometry             = config.getValue<string>("geometry");
         vector<double> length       = config.getVector<double>("length");
         //vector<double> FunnelL      = config.getVector<double>("FunnelL");
         //vector<double> FunnelOrigin = config.getVector<double>("FunnelOrigin");
         
-        double          timeAvStart       = config.getValue<double>("timeAvStart");
-        double          timeAvStop        = config.getValue<double>("timeAvStop");
+        //double          timeAvStart       = config.getValue<double>("timeAvStart");
+        //double          timeAvStop        = config.getValue<double>("timeAvStop");
 
         vector<double> TPMSL        = config.getVector<double>("TPMSL");
         vector<double> TPMSOrigin   = config.getVector<double>("TPMSOrigin");
@@ -456,27 +456,27 @@ void run(string configname)
         SPtr<GbPoint3D> pointOne(new GbPoint3D(-0.00494999997317791,0.008, 0.0099));
         SPtr<GbPoint3D> pointTwo(new GbPoint3D(0.14994999766349792, 0.008, 0.0099));
 
-        SPtr<GbLine3D> line(new GbLine3D(pointOne,pointTwo));
+        SPtr<GbLine3D> line(new GbLine3D(pointOne.get(),pointTwo.get()));
         SPtr<UbScheduler> linSch(new UbScheduler(outTime/20,outTime/2/*,beginTime,endTime*/));
-        SPtr<SimulationObserver> lp(new LineTimeSeriesSimulationObserver(grid, linSch, pathname, WbWriterVtkXmlBinary::getInstance(), line,refineLevel, comm));
+        SPtr<SimulationObserver> lp(new LineTimeSeriesSimulationObserver(grid, linSch, pathname + "line",  line,refineLevel, comm));
 
         SPtr<UbScheduler> visSch(new UbScheduler(outTime/*,beginTime,endTime*/));
         SPtr<SimulationObserver> pp(new WriteMacroscopicQuantitiesSimulationObserver(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
         
-        SPtr<UbScheduler> tavSch(new UbScheduler(100, timeAvStart, timeAvStop));
-        SPtr<TimeAveragedValuesSimulationObserver> tav(new TimeAveragedValuesSimulationObserver(grid, pathname, WbWriterVtkXmlBinary::getInstance(), tavSch, comm,
-        TimeAveragedValuesSimulationObserver::Density | TimeAveragedValuesSimulationObserver::Velocity | TimeAveragedValuesSimulationObserver::Fluctuations));
-        tav->setWithGhostLayer(true);        
+        //SPtr<UbScheduler> tavSch(new UbScheduler(100, timeAvStart, timeAvStop));
+        //SPtr<TimeAveragedValuesSimulationObserver> tav(new TimeAveragedValuesSimulationObserver(grid, pathname, WbWriterVtkXmlBinary::getInstance(), tavSch, comm,
+        //TimeAveragedValuesSimulationObserver::Density | TimeAveragedValuesSimulationObserver::Velocity | TimeAveragedValuesSimulationObserver::Fluctuations));
+        //tav->setWithGhostLayer(true);        
         
-        SPtr<UbScheduler> nuSch(new UbScheduler(100, 0, endTime / 2));
-        mu::Parser fnu;
-        fnu.SetExpr("(L*u/T)*(((T-2*t)/Re0)+(2*t/Re))");
-        fnu.DefineConst("Re0", Re0);
-        fnu.DefineConst("Re", Re);
-        fnu.DefineConst("T", endTime);
-        fnu.DefineConst("L", (UnitEdgeLength / dx));
-        fnu.DefineConst("u", vx);
-        SPtr<SimulationObserver> nupr(new DecreaseViscositySimulationObserver(grid, nuSch, &fnu, comm));
+        //SPtr<UbScheduler> nuSch(new UbScheduler(100, 0, endTime / 2));
+        //mu::Parser fnu;
+        //fnu.SetExpr("(L*u/T)*(((T-2*t)/Re0)+(2*t/Re))");
+        //fnu.DefineConst("Re0", Re0);
+        //fnu.DefineConst("Re", Re);
+        //fnu.DefineConst("T", endTime);
+        //fnu.DefineConst("L", (UnitEdgeLength / dx));
+        //fnu.DefineConst("u", vx);
+        //SPtr<SimulationObserver> nupr(new DecreaseViscositySimulationObserver(grid, nuSch, &fnu, comm));
 
         SPtr<UbScheduler> nupsSch(new UbScheduler(100, 100, 100000000));
         SPtr<SimulationObserver> npr(new NUPSCounterSimulationObserver(grid, nupsSch, numOfThreads, comm));
@@ -490,7 +490,7 @@ void run(string configname)
         calculator->addSimulationObserver(npr);
         calculator->addSimulationObserver(pp);
         calculator->addSimulationObserver(migSimulationObserver);
-        calculator->addSimulationObserver(tav);
+        //calculator->addSimulationObserver(tav);
 
         if (myid == 0)
             UBLOG(logINFO, "Simulation-start");
diff --git a/src/cpu/core/BoundaryConditions/NonReflectingInflowBCStrategy.cpp b/src/cpu/core/BoundaryConditions/NonReflectingInflowBCStrategy.cpp
index 21340d08b..a60646681 100644
--- a/src/cpu/core/BoundaryConditions/NonReflectingInflowBCStrategy.cpp
+++ b/src/cpu/core/BoundaryConditions/NonReflectingInflowBCStrategy.cpp
@@ -42,20 +42,19 @@ NonReflectingInflowBCStrategy::NonReflectingInflowBCStrategy()
     BCStrategy::preCollision = true;
 }
 //////////////////////////////////////////////////////////////////////////
-NonReflectingInflowBCStrategy::NonReflectingInflowBCStrategy(LBMReal velocity, LBMReal relaxationRate)
+NonReflectingInflowBCStrategy::NonReflectingInflowBCStrategy(real velocity, real relaxationRate)
+    : BCStrategy(), BCVeloWeight(relaxationRate), velocity(velocity)
+
 {
     BCStrategy::type         = BCStrategy::NonReflectingInflowBCStrategy;
     BCStrategy::preCollision = true;
-    this->BCVeloWeight=relaxationRate;
-    this->velocity=velocity;
-
 }
 //////////////////////////////////////////////////////////////////////////
 NonReflectingInflowBCStrategy::~NonReflectingInflowBCStrategy() = default;
 //////////////////////////////////////////////////////////////////////////
 SPtr<BCStrategy> NonReflectingInflowBCStrategy::clone()
 {
-    SPtr<BCStrategy> bc(new NonReflectingInflowBCStrategy());
+    SPtr<BCStrategy> bc(new NonReflectingInflowBCStrategy(velocity,BCVeloWeight));
     return bc;
 }
 //////////////////////////////////////////////////////////////////////////
@@ -108,7 +107,7 @@ void NonReflectingInflowBCStrategy::applyBC()
     calcMacrosFct(f, rho, vx1, vx2, vx3);
     //vx1                  = 0.;
     //LBMReal BCVeloWeight = c1o2;
-     LBMReal BCVeloWeight =this->BCVeloWeight;
+     //LBMReal BCVeloWeight =this->BCVeloWeight;
     // LBMReal velocity     = 0.004814077025232405; 
      // LBMReal velocity     = 0.00057735;
     //LBMReal velocity = 0.04; 
@@ -116,7 +115,7 @@ void NonReflectingInflowBCStrategy::applyBC()
      // LBMReal velocity = 1./112.; 
     // LBMReal velocity = 1./126.; 
      //LBMReal velocity = c1o100/2;
-     LBMReal velocity = this->velocity;
+    // LBMReal velocity = this->velocity;
      // LBMReal velocity = 0.005; 
     //LBMReal delf         =(-velocity+vx1)*0.5 ;
     LBMReal delf; 
diff --git a/src/cpu/core/BoundaryConditions/NonReflectingInflowBCStrategy.h b/src/cpu/core/BoundaryConditions/NonReflectingInflowBCStrategy.h
index 2019335b7..6a619cdd4 100644
--- a/src/cpu/core/BoundaryConditions/NonReflectingInflowBCStrategy.h
+++ b/src/cpu/core/BoundaryConditions/NonReflectingInflowBCStrategy.h
@@ -42,7 +42,7 @@ class NonReflectingInflowBCStrategy : public BCStrategy
 {
 public:
     NonReflectingInflowBCStrategy();
-    NonReflectingInflowBCStrategy(LBMReal velocity, LBMReal relaxationRate);
+    NonReflectingInflowBCStrategy(real velocity, real relaxationRate);
     ~NonReflectingInflowBCStrategy() override;
     SPtr<BCStrategy> clone() override;
     void addDistributions(SPtr<DistributionArray3D> distributions) override;
-- 
GitLab