OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
olb::LbSolver< T, PARAMETERS, LATTICES > Class Template Referenceabstract

LbSolver is a generic solver for Lattice-Boltzmann problems. More...

#include <lbSolver.h>

+ Inheritance diagram for olb::LbSolver< T, PARAMETERS, LATTICES >:
+ Collaboration diagram for olb::LbSolver< T, PARAMETERS, LATTICES >:

Public Member Functions

 LbSolver (utilities::TypeIndexedSharedPtrTuple< PARAMETERS > params)
 
void buildAndReturn ()
 Build geometry, lattice and call computeResults.
 
void initialize () override
 Set up geometry.
 
- Public Member Functions inherited from olb::BaseSolver< T, PARAMETERS >
 BaseSolver (utilities::TypeIndexedSharedPtrTuple< PARAMETERS > params)
 
virtual void preProcess ()
 Configurations that take place before solving.
 
void solve ()
 
virtual void postProcess ()
 Actions that take place after solving.
 
template<typename KEY >
auto & parameters (KEY=KEY())
 Access to parameter structs as parameters(KEY())
 
template<typename KEY >
auto & parameters (KEY=KEY()) const
 
template<typename KEY >
auto & parameters (meta::id< KEY >)
 
template<typename KEY >
auto & parameters (meta::id< KEY >) const
 

Protected Types

template<typename... DESCRIPTORS>
using SuperLattices = std::tuple<std::shared_ptr<SuperLattice<T,DESCRIPTORS>>...>
 

Protected Member Functions

void prepareSimulation () override
 Set up lattice and initialize fields.
 
void timeStep (std::size_t iT) override
 Collide-and-stream + additional computations.
 
void postSimulation () override
 Evaluate results.
 
virtual void prepareGeometry ()=0
 Define the geometry.
 
virtual void prepareLattices ()=0
 Choose dynamics and boundary conditions.
 
virtual void setInitialValues ()=0
 Define fields and initialize lattice populations.
 
virtual void setBoundaryValues (std::size_t iT)=0
 Update fields and boundary values.
 
virtual void getResults (std::size_t iT)
 Computation of results and output with full flexibility.
 
virtual void computeResults (std::size_t iT)
 Perform further computations (compute errors etc.)
 
virtual void computeResults ()
 
virtual bool exitCondition (std::size_t iT) const override
 Condition, when to exit the time-stepping loop Returns true if the loop shall be continued.
 
virtual bool checkStability (std::size_t iT)
 check stability: maxU should be <= _boundMaxU for a stable simulation Returns true if this fulfilled
 
virtual void printLog (std::size_t iT) const
 
virtual void writeLogConverter () const
 
virtual void prepareVTK () const
 Write geometric information for vtk output The default version writes geometry, cuboid, rank and works for several lattices.
 
virtual void writeVTK (std::size_t iT) const
 
virtual void writeImages (std::size_t iT) const
 
virtual void writeGnuplot (std::size_t iT) const
 
template<typename... ARGS>
auto & converter (ARGS &&... args)
 
template<typename... ARGS>
auto & converter (ARGS &&... args) const
 
template<typename KEY >
auto & lattice (KEY=KEY())
 
template<typename KEY >
auto & lattice (KEY=KEY()) const
 
template<typename KEY >
auto & lattice (meta::id< KEY >)
 
template<typename KEY >
auto & lattice (meta::id< KEY >) const
 
auto & lattice ()
 
auto & lattice () const
 
auto & geometry ()
 
auto & geometry () const
 

Static Protected Member Functions

static constexpr unsigned getNumberStationaryLattices ()
 

Protected Attributes

std::shared_ptr< SuperGeometry< T, dim > > _sGeometry
 
std::shared_ptr< CuboidGeometry< T, dim > > _cGeometry
 
std::shared_ptr< LoadBalancer< T > > _loadBalancer
 
LATTICES::values_t::template decompose_into< SuperLattices_sLattices
 
std::unique_ptr< util::Timer< BaseType< T > > > _timer
 
std::array< std::unique_ptr< util::ValueTracer< T > >, getNumberStationaryLattices()> _convergenceCheck
 
bool _exitMaxU {false}
 
BaseType< T > _boundMaxU {1.0}
 
std::size_t _itCheckStability {1}
 
std::size_t _itBoundaryUpdate {1}
 
- Protected Attributes inherited from olb::BaseSolver< T, PARAMETERS >
bool _isInitialized {false}
 
std::size_t _iT {0}
 
bool _finishedTimeLoop {false}
 

Static Protected Attributes

static constexpr unsigned dim = LATTICES::values_t::template get<0>::d
 
static constexpr bool isStationary = PARAMETERS::keys_t::template contains<names::Stationarity>()
 
static constexpr bool outputGnuplot = PARAMETERS::keys_t::template contains<names::VisualizationGnuplot>()
 
static constexpr bool outputImages = PARAMETERS::keys_t::template contains<names::VisualizationImages>()
 
static constexpr bool outputVTK = PARAMETERS::keys_t::template contains<names::VisualizationVTK>()
 

Additional Inherited Members

- Public Types inherited from olb::BaseSolver< T, PARAMETERS >
using t = T
 
using Parameters_t = PARAMETERS
 
- Public Attributes inherited from olb::BaseSolver< T, PARAMETERS >
utilities::TypeIndexedSharedPtrTuple< PARAMETERS > _parameters
 

Detailed Description

template<typename T, typename PARAMETERS, typename LATTICES>
class olb::LbSolver< T, PARAMETERS, LATTICES >

LbSolver is a generic solver for Lattice-Boltzmann problems.

It holds geometry and lattices and defines the abstract methods of BaseSolver. Every simulation app should be able to inherit from this class.

Definition at line 130 of file lbSolver.h.

Member Typedef Documentation

◆ SuperLattices

template<typename T , typename PARAMETERS , typename LATTICES >
template<typename... DESCRIPTORS>
using olb::LbSolver< T, PARAMETERS, LATTICES >::SuperLattices = std::tuple<std::shared_ptr<SuperLattice<T,DESCRIPTORS>>...>
protected

Definition at line 139 of file lbSolver.h.

Constructor & Destructor Documentation

◆ LbSolver()

template<typename T , typename PARAMETERS , typename LATTICES >
olb::LbSolver< T, PARAMETERS, LATTICES >::LbSolver ( utilities::TypeIndexedSharedPtrTuple< PARAMETERS > params)
inline

Definition at line 171 of file lbSolver.h.

171 : LbSolver::BaseSolver(params)
172 { }
BaseSolver(utilities::TypeIndexedSharedPtrTuple< PARAMETERS > params)
Definition lbSolver.h:56

Member Function Documentation

◆ buildAndReturn()

template<typename T , typename PARAMETERS , typename LATTICES >
void olb::LbSolver< T, PARAMETERS, LATTICES >::buildAndReturn ( )

Build geometry, lattice and call computeResults.

Definition at line 60 of file lbSolver.hh.

61{
62 if (! this->_isInitialized) {
63 this->initialize();
64 }
65 build();
67}
bool _isInitialized
Definition lbSolver.h:51
virtual void computeResults()
Definition lbSolver.h:217
void initialize() override
Set up geometry.
Definition lbSolver.hh:36

◆ checkStability()

template<typename T , typename PARAMETERS , typename LATTICES >
bool olb::LbSolver< T, PARAMETERS, LATTICES >::checkStability ( std::size_t iT)
protectedvirtual

check stability: maxU should be <= _boundMaxU for a stable simulation Returns true if this fulfilled

Definition at line 278 of file lbSolver.hh.

279{
280 bool result = true;
282 if (lattice->getStatistics().getMaxU() > _boundMaxU) {
283 clout << "PROBLEM uMax=" << lattice->getStatistics().getMaxU() << std::endl;
284 lattice->getStatistics().print(iT, converter().getPhysTime(iT));
285 if (_exitMaxU) {
286 exit(1);
287 }
288 result = false;
289 }
290 });
291 return result;
292}
BaseType< T > _boundMaxU
Definition lbSolver.h:166
auto & lattice()
Definition lbSolver.h:292
LATTICES::values_t::template decompose_into< SuperLattices > _sLattices
Definition lbSolver.h:145
void tuple_for_each(TUPLE &tuple, F &&f)
Apply F to each element of TUPLE.
Definition meta.h:369

References olb::meta::tuple_for_each().

+ Here is the call graph for this function:

◆ computeResults() [1/2]

template<typename T , typename PARAMETERS , typename LATTICES >
virtual void olb::LbSolver< T, PARAMETERS, LATTICES >::computeResults ( )
inlineprotectedvirtual

Definition at line 217 of file lbSolver.h.

217{ };

◆ computeResults() [2/2]

template<typename T , typename PARAMETERS , typename LATTICES >
virtual void olb::LbSolver< T, PARAMETERS, LATTICES >::computeResults ( std::size_t iT)
inlineprotectedvirtual

Perform further computations (compute errors etc.)

Definition at line 215 of file lbSolver.h.

215{ };

◆ converter() [1/2]

template<typename T , typename PARAMETERS , typename LATTICES >
template<typename... ARGS>
auto & olb::LbSolver< T, PARAMETERS, LATTICES >::converter ( ARGS &&... args)
inlineprotected

Definition at line 255 of file lbSolver.h.

255 {
256 using SimulationParameters_t = typename PARAMETERS::template value<names::Simulation>;
257 if constexpr(std::is_invocable_v<decltype(&SimulationParameters_t::converter),ARGS...>) {
258 return this->parameters(names::Simulation()).converter(args...);
259 }
260 else {
261 return *this->parameters(names::Simulation()).converter;
262 }
263 __builtin_unreachable();
264 }
auto & parameters(KEY=KEY())
Access to parameter structs as parameters(KEY())
Definition lbSolver.h:104

References olb::BaseSolver< T, PARAMETERS >::parameters().

+ Here is the call graph for this function:

◆ converter() [2/2]

template<typename T , typename PARAMETERS , typename LATTICES >
template<typename... ARGS>
auto & olb::LbSolver< T, PARAMETERS, LATTICES >::converter ( ARGS &&... args) const
inlineprotected

Definition at line 266 of file lbSolver.h.

266 {
267 using SimulationParameters_t = typename PARAMETERS::template value<names::Simulation>;
268 if constexpr(std::is_invocable_v<decltype(&SimulationParameters_t::converter),ARGS...>) {
269 return this->parameters(names::Simulation()).converter(args...);
270 }
271 else {
272 return *this->parameters(names::Simulation()).converter;
273 }
274 __builtin_unreachable();
275 }

References olb::BaseSolver< T, PARAMETERS >::parameters().

+ Here is the call graph for this function:

◆ exitCondition()

template<typename T , typename PARAMETERS , typename LATTICES >
bool olb::LbSolver< T, PARAMETERS, LATTICES >::exitCondition ( std::size_t iT) const
overrideprotectedvirtual

Condition, when to exit the time-stepping loop Returns true if the loop shall be continued.

Implements olb::BaseSolver< T, PARAMETERS >.

Definition at line 257 of file lbSolver.hh.

258{
259 if (iT > this->converter().getLatticeTime(this->parameters(names::Simulation()).maxTime)){
260 return true;
261 }
262
263 if constexpr (isStationary){
264 if (std::all_of(_convergenceCheck.cbegin(), _convergenceCheck.cend(), [](auto& c){
265 return c->hasConverged();
266 } )) {
267 if (this->parameters(names::Output()).verbose) {
268 clout << "Simulation converged." << std::endl;
269 }
270 return true;
271 }
272 }
273
274 return false;
275}
auto & converter(ARGS &&... args)
Definition lbSolver.h:255
static constexpr bool isStationary
Definition lbSolver.h:149
std::array< std::unique_ptr< util::ValueTracer< T > >, getNumberStationaryLattices()> _convergenceCheck
Definition lbSolver.h:159

◆ geometry() [1/2]

template<typename T , typename PARAMETERS , typename LATTICES >
auto & olb::LbSolver< T, PARAMETERS, LATTICES >::geometry ( )
inlineprotected

Definition at line 300 of file lbSolver.h.

300 {
301 return *_sGeometry;
302 }
std::shared_ptr< SuperGeometry< T, dim > > _sGeometry
Definition lbSolver.h:141

References olb::LbSolver< T, PARAMETERS, LATTICES >::_sGeometry.

+ Here is the caller graph for this function:

◆ geometry() [2/2]

template<typename T , typename PARAMETERS , typename LATTICES >
auto & olb::LbSolver< T, PARAMETERS, LATTICES >::geometry ( ) const
inlineprotected

Definition at line 303 of file lbSolver.h.

303 {
304 return *_sGeometry;
305 }

References olb::LbSolver< T, PARAMETERS, LATTICES >::_sGeometry.

◆ getNumberStationaryLattices()

template<typename T , typename PARAMETERS , typename LATTICES >
static constexpr unsigned olb::LbSolver< T, PARAMETERS, LATTICES >::getNumberStationaryLattices ( )
inlinestaticconstexprprotected

Definition at line 150 of file lbSolver.h.

150 {
151 if constexpr (isStationary) {
152 return PARAMETERS::template value<names::Stationarity>::numberOfStationaryLattices;
153 } else {
154 return 0;
155 }
156 __builtin_unreachable();
157 }

References olb::LbSolver< T, PARAMETERS, LATTICES >::isStationary.

◆ getResults()

template<typename T , typename PARAMETERS , typename LATTICES >
virtual void olb::LbSolver< T, PARAMETERS, LATTICES >::getResults ( std::size_t iT)
inlineprotectedvirtual

Computation of results and output with full flexibility.

Definition at line 210 of file lbSolver.h.

210{ };

◆ initialize()

template<typename T , typename PARAMETERS , typename LATTICES >
void olb::LbSolver< T, PARAMETERS, LATTICES >::initialize ( )
overridevirtual

Set up geometry.

Implements olb::BaseSolver< T, PARAMETERS >.

Definition at line 36 of file lbSolver.hh.

37{
38 if (this->parameters(names::Output()).verbose) {
39 clout << "Start initialization" << std::endl;
40 }
41
42 this->prepareGeometry();
43 // Removes all not needed boundary voxels outside the surface
44 //this->geometry().clean(this->parameters(names::Output()).verbose);
45 // Removes all not needed boundary voxels inside the surface
46 this->geometry().innerClean(this->parameters(names::Output()).verbose);
47 geometry().checkForErrors(this->parameters(names::Output()).verbose);
48 if (this->parameters(names::Output()).verbose) {
49 geometry().getStatistics().print();
50 }
51
52 this->_isInitialized = true;
53
54 if (this->parameters(names::Output()).verbose) {
55 clout << "Finished initialization" << std::endl;
56 }
57}
auto & geometry()
Definition lbSolver.h:300
virtual void prepareGeometry()=0
Define the geometry.

◆ lattice() [1/6]

template<typename T , typename PARAMETERS , typename LATTICES >
auto & olb::LbSolver< T, PARAMETERS, LATTICES >::lattice ( )
inlineprotected

Definition at line 292 of file lbSolver.h.

292 {
293 static_assert((LATTICES::size == 1), "Lattice name must be provided");
294 return *std::get<0>(_sLattices);
295 }

References olb::LbSolver< T, PARAMETERS, LATTICES >::_sLattices.

+ Here is the caller graph for this function:

◆ lattice() [2/6]

template<typename T , typename PARAMETERS , typename LATTICES >
auto & olb::LbSolver< T, PARAMETERS, LATTICES >::lattice ( ) const
inlineprotected

Definition at line 296 of file lbSolver.h.

296 {
297 static_assert((LATTICES::size == 1), "Lattice name must be provided");
298 return *std::get<0>(_sLattices);
299 }

References olb::LbSolver< T, PARAMETERS, LATTICES >::_sLattices.

◆ lattice() [3/6]

template<typename T , typename PARAMETERS , typename LATTICES >
template<typename KEY >
auto & olb::LbSolver< T, PARAMETERS, LATTICES >::lattice ( KEY = KEY())
inlineprotected

Definition at line 277 of file lbSolver.h.

277 {
278 return *std::get<(LATTICES::keys_t::template index<KEY>())>(_sLattices);
279 }

References olb::LbSolver< T, PARAMETERS, LATTICES >::_sLattices.

◆ lattice() [4/6]

template<typename T , typename PARAMETERS , typename LATTICES >
template<typename KEY >
auto & olb::LbSolver< T, PARAMETERS, LATTICES >::lattice ( KEY = KEY()) const
inlineprotected

Definition at line 281 of file lbSolver.h.

281 {
282 return *std::get<(LATTICES::keys_t::template index<KEY>())>(_sLattices);
283 }

References olb::LbSolver< T, PARAMETERS, LATTICES >::_sLattices.

◆ lattice() [5/6]

template<typename T , typename PARAMETERS , typename LATTICES >
template<typename KEY >
auto & olb::LbSolver< T, PARAMETERS, LATTICES >::lattice ( meta::id< KEY > )
inlineprotected

Definition at line 285 of file lbSolver.h.

285 {
286 return *std::get<(LATTICES::keys_t::template index<KEY>())>(_sLattices);
287 }

References olb::LbSolver< T, PARAMETERS, LATTICES >::_sLattices.

◆ lattice() [6/6]

template<typename T , typename PARAMETERS , typename LATTICES >
template<typename KEY >
auto & olb::LbSolver< T, PARAMETERS, LATTICES >::lattice ( meta::id< KEY > ) const
inlineprotected

Definition at line 289 of file lbSolver.h.

289 {
290 return *std::get<(LATTICES::keys_t::template index<KEY>())>(_sLattices);
291 }

References olb::LbSolver< T, PARAMETERS, LATTICES >::_sLattices.

◆ postSimulation()

template<typename T , typename PARAMETERS , typename LATTICES >
void olb::LbSolver< T, PARAMETERS, LATTICES >::postSimulation ( )
overrideprotectedvirtual

Evaluate results.

Implements olb::BaseSolver< T, PARAMETERS >.

Definition at line 208 of file lbSolver.hh.

209{
211 // TODO: dispose also communication of fields...
212 lattice->communicate();
213 });
214
215 if ( this->parameters(names::Output()).verbose ) {
216 printLog(this->_iT);
217 }
218 if constexpr (outputVTK) {
219 if ( this->parameters(names::VisualizationVTK()).printOutput == olb::parameters::OutputPlot<T>::pO_final) {
220 writeVTK(this->_iT);
221 }
222 }
223 if constexpr (outputImages) {
224 if ( this->parameters(names::VisualizationImages()).printOutput == olb::parameters::OutputPlot<T>::pO_final) {
225 writeImages(this->_iT);
226 }
227 }
228 if constexpr (outputGnuplot) {
229 if ( this->parameters(names::VisualizationGnuplot()).printOutput == olb::parameters::OutputPlot<T>::pO_final) {
230 writeGnuplot(this->_iT);
231 }
232 }
233 getResults(this->_iT);
234
235 _timer->stop();
236 if (this->parameters(names::Output()).verbose) {
237 clout << "Finished collide-and-stream loop" << std::endl;
238 clout << "Start postprocessing" << std::endl;
239 }
241
242 if (this->parameters(names::Output()).verbose) {
243 _timer->printSummary();
244 }
245
246 // required to finish output tasks during use of gpu
248 lattice->setProcessingContext(ProcessingContext::Evaluation);
249 });
250
251 if (this->parameters(names::Output()).verbose) {
252 clout << "Finished postprocessing" << std::endl;
253 }
254}
std::size_t _iT
Definition lbSolver.h:52
virtual void printLog(std::size_t iT) const
Definition lbSolver.hh:306
static constexpr bool outputImages
Definition lbSolver.h:162
virtual void getResults(std::size_t iT)
Computation of results and output with full flexibility.
Definition lbSolver.h:210
virtual void writeGnuplot(std::size_t iT) const
Definition lbSolver.h:251
std::unique_ptr< util::Timer< BaseType< T > > > _timer
Definition lbSolver.h:147
static constexpr bool outputVTK
Definition lbSolver.h:163
virtual void writeImages(std::size_t iT) const
Definition lbSolver.h:248
virtual void writeVTK(std::size_t iT) const
Definition lbSolver.h:245
static constexpr bool outputGnuplot
Definition lbSolver.h:161

References olb::Evaluation, and olb::meta::tuple_for_each().

+ Here is the call graph for this function:

◆ prepareGeometry()

template<typename T , typename PARAMETERS , typename LATTICES >
virtual void olb::LbSolver< T, PARAMETERS, LATTICES >::prepareGeometry ( )
protectedpure virtual

Define the geometry.

◆ prepareLattices()

template<typename T , typename PARAMETERS , typename LATTICES >
virtual void olb::LbSolver< T, PARAMETERS, LATTICES >::prepareLattices ( )
protectedpure virtual

Choose dynamics and boundary conditions.

◆ prepareSimulation()

template<typename T , typename PARAMETERS , typename LATTICES >
void olb::LbSolver< T, PARAMETERS, LATTICES >::prepareSimulation ( )
overrideprotectedvirtual

Set up lattice and initialize fields.

Implements olb::BaseSolver< T, PARAMETERS >.

Definition at line 100 of file lbSolver.hh.

101{
102 if (this->parameters(names::Output()).verbose) {
103 clout << "Start prepareSimulation" << std::endl;
104 }
105
106 this->_iT = 0;
107
108 build();
109
111
113 lattice->initialize();
114 lattice->getStatistics().reset();
115 lattice->getStatistics().initialize();
116 });
117
118
119 if constexpr (outputVTK) {
120 if (this->parameters(names::VisualizationVTK()).output != "off") {
121 prepareVTK();
122 }
123 }
124
125 if (this->parameters(names::Output()).verbose) {
126 clout << "Finished prepareSimulation" << std::endl;
127 clout << "Start collide-and-stream loop" << std::endl;
128 }
129 _timer->start();
130}
virtual void prepareVTK() const
Write geometric information for vtk output The default version writes geometry, cuboid,...
Definition lbSolver.hh:324
virtual void setInitialValues()=0
Define fields and initialize lattice populations.

References olb::meta::tuple_for_each().

+ Here is the call graph for this function:

◆ prepareVTK()

template<typename T , typename PARAMETERS , typename LATTICES >
void olb::LbSolver< T, PARAMETERS, LATTICES >::prepareVTK ( ) const
protectedvirtual

Write geometric information for vtk output The default version writes geometry, cuboid, rank and works for several lattices.

This method may be overridden in case e.g. discrete normals shall be visualized (cf. example cavity2d).

Writes the geometry, cuboid no. and rank no. as vti file for visualization

Definition at line 324 of file lbSolver.hh.

325{
326 // write the geometric information. Since this does not depend on the
327 // lattice, we may w.l.o.g. work with the first lattice
328 auto& lattice = *std::get<0>(_sLattices);
329 using DESCRIPTOR = typename LATTICES::values_t::template get<0>;
330
331
332 SuperVTMwriter<T,dim> vtmWriter(this->parameters(names::VisualizationVTK()).filename);
333
334
336 SuperLatticeGeometry<T,DESCRIPTOR> geometry(lattice, this->geometry());
337 SuperLatticeCuboid<T,DESCRIPTOR> cuboid(lattice);
338 SuperLatticeRank<T,DESCRIPTOR> rank(lattice);
339 vtmWriter.write( cuboid );
340 vtmWriter.write( geometry );
341 vtmWriter.write( rank );
342 vtmWriter.createMasterFile();
343}

◆ printLog()

template<typename T , typename PARAMETERS , typename LATTICES >
void olb::LbSolver< T, PARAMETERS, LATTICES >::printLog ( std::size_t iT) const
protectedvirtual

Definition at line 306 of file lbSolver.hh.

307{
308 using OutputParameters_t = typename PARAMETERS::template value<names::Output>;
309 OutputParameters_t::printLatticeStatistics::for_each( [&](auto type){
310 lattice(type.get()).getStatistics().print(iT, converter().getPhysTime(iT));
311 } );
312
313 _timer->print(iT, this->parameters(names::Output()).timerPrintMode);
314}

◆ setBoundaryValues()

template<typename T , typename PARAMETERS , typename LATTICES >
virtual void olb::LbSolver< T, PARAMETERS, LATTICES >::setBoundaryValues ( std::size_t iT)
protectedpure virtual

Update fields and boundary values.

◆ setInitialValues()

template<typename T , typename PARAMETERS , typename LATTICES >
virtual void olb::LbSolver< T, PARAMETERS, LATTICES >::setInitialValues ( )
protectedpure virtual

Define fields and initialize lattice populations.

◆ timeStep()

template<typename T , typename PARAMETERS , typename LATTICES >
void olb::LbSolver< T, PARAMETERS, LATTICES >::timeStep ( std::size_t iT)
overrideprotectedvirtual

Collide-and-stream + additional computations.

Implements olb::BaseSolver< T, PARAMETERS >.

Definition at line 134 of file lbSolver.hh.

135{
136 if (iT % _itBoundaryUpdate == 0) {
138 }
139
141 // TODO: dispose also communication of fields
142 lattice->communicate();
143 });
144
145
146 if constexpr (outputVTK) {
147 if ( this->parameters(names::VisualizationVTK()).printOutput == olb::parameters::OutputPlot<T>::pO_intervals
148 && iT % converter().getLatticeTime(this->parameters(names::VisualizationVTK()).saveTime) == 0 ) {
149 writeVTK(iT);
150 }
151 }
152 if constexpr (outputImages) {
153 if ( this->parameters(names::VisualizationImages()).printOutput == olb::parameters::OutputPlot<T>::pO_intervals
154 && iT % converter().getLatticeTime(this->parameters(names::VisualizationImages()).saveTime) == 0 ) {
155 writeImages(iT);
156 }
157 }
158 if constexpr (outputGnuplot) {
159 if ( this->parameters(names::VisualizationGnuplot()).printOutput == olb::parameters::OutputPlot<T>::pO_intervals
160 && iT % converter().getLatticeTime(this->parameters(names::VisualizationGnuplot()).saveTime) == 0 ) {
161 writeGnuplot(iT);
162 }
163 }
164 if ( this->parameters(names::Output()).verbose
165 && iT % converter().getLatticeTime(this->parameters(names::Output()).logT) == 0) {
166 printLog(iT);
167 }
168 computeResults(iT);
169 getResults(iT);
170
172 lattice->collideAndStream();
173 lattice->executeCoupling();
174 });
175
176 if (this->parameters(names::Simulation()).pressureFilter) {
177 // TODO: allow choosing the lattices here
178 std::get<0>(_sLattices)->stripeOffDensityOffset(std::get<0>(_sLattices)->getStatistics().getAverageRho() - T(1));
179 }
180
181 if constexpr (isStationary){
182 unsigned counter = 0;
183 using parameters_t = typename PARAMETERS::template value<names::Stationarity>;
184 parameters_t::stat_lattices::for_each( [&](auto Id) {
185 // using Name = typename decltype(Id)::type;
186 if (this->parameters(names::Stationarity()).convergenceType[counter] == parameters_t::MaxLatticeVelocity){
187 _convergenceCheck[counter]->takeValue( this->lattice(Id).getStatistics().getMaxU());
188 }
189 else if (this->parameters(names::Stationarity()).convergenceType[counter] == parameters_t::AverageEnergy){
190 _convergenceCheck[counter]->takeValue( this->lattice(Id).getStatistics().getAverageEnergy() );
191 }
192 else if (this->parameters(names::Stationarity()).convergenceType[counter] == parameters_t::AverageRho){
193 _convergenceCheck[counter]->takeValue( this->lattice(Id).getStatistics().getAverageRho());
194 }
195 else {
196 throw std::invalid_argument("Convergence type is not supported.\n");
197 }
198 counter++;
199 });
200 }
201
202 if (iT % _itCheckStability == 0) {
203 checkStability(iT);
204 }
205}
virtual bool checkStability(std::size_t iT)
check stability: maxU should be <= _boundMaxU for a stable simulation Returns true if this fulfilled
Definition lbSolver.hh:278
std::size_t _itBoundaryUpdate
Definition lbSolver.h:168
virtual void setBoundaryValues(std::size_t iT)=0
Update fields and boundary values.
std::size_t _itCheckStability
Definition lbSolver.h:167

References olb::meta::tuple_for_each().

+ Here is the call graph for this function:

◆ writeGnuplot()

template<typename T , typename PARAMETERS , typename LATTICES >
virtual void olb::LbSolver< T, PARAMETERS, LATTICES >::writeGnuplot ( std::size_t iT) const
inlineprotectedvirtual

Definition at line 251 of file lbSolver.h.

251{ };

◆ writeImages()

template<typename T , typename PARAMETERS , typename LATTICES >
virtual void olb::LbSolver< T, PARAMETERS, LATTICES >::writeImages ( std::size_t iT) const
inlineprotectedvirtual

Definition at line 248 of file lbSolver.h.

248{ };

◆ writeLogConverter()

template<typename T , typename PARAMETERS , typename LATTICES >
void olb::LbSolver< T, PARAMETERS, LATTICES >::writeLogConverter ( ) const
protectedvirtual

Definition at line 317 of file lbSolver.hh.

318{
319 converter().print();
320 converter().write(this->parameters(names::Output()).name);
321}

◆ writeVTK()

template<typename T , typename PARAMETERS , typename LATTICES >
virtual void olb::LbSolver< T, PARAMETERS, LATTICES >::writeVTK ( std::size_t iT) const
inlineprotectedvirtual

Definition at line 245 of file lbSolver.h.

245{ };

Member Data Documentation

◆ _boundMaxU

template<typename T , typename PARAMETERS , typename LATTICES >
BaseType<T> olb::LbSolver< T, PARAMETERS, LATTICES >::_boundMaxU {1.0}
protected

Definition at line 166 of file lbSolver.h.

166{1.0};

◆ _cGeometry

template<typename T , typename PARAMETERS , typename LATTICES >
std::shared_ptr<CuboidGeometry<T,dim> > olb::LbSolver< T, PARAMETERS, LATTICES >::_cGeometry
protected

Definition at line 142 of file lbSolver.h.

◆ _convergenceCheck

template<typename T , typename PARAMETERS , typename LATTICES >
std::array<std::unique_ptr<util::ValueTracer<T> >, getNumberStationaryLattices()> olb::LbSolver< T, PARAMETERS, LATTICES >::_convergenceCheck
protected

Definition at line 159 of file lbSolver.h.

◆ _exitMaxU

template<typename T , typename PARAMETERS , typename LATTICES >
bool olb::LbSolver< T, PARAMETERS, LATTICES >::_exitMaxU {false}
protected

Definition at line 165 of file lbSolver.h.

165{false};

◆ _itBoundaryUpdate

template<typename T , typename PARAMETERS , typename LATTICES >
std::size_t olb::LbSolver< T, PARAMETERS, LATTICES >::_itBoundaryUpdate {1}
protected

Definition at line 168 of file lbSolver.h.

168{1};

◆ _itCheckStability

template<typename T , typename PARAMETERS , typename LATTICES >
std::size_t olb::LbSolver< T, PARAMETERS, LATTICES >::_itCheckStability {1}
protected

Definition at line 167 of file lbSolver.h.

167{1};

◆ _loadBalancer

template<typename T , typename PARAMETERS , typename LATTICES >
std::shared_ptr<LoadBalancer<T> > olb::LbSolver< T, PARAMETERS, LATTICES >::_loadBalancer
protected

Definition at line 143 of file lbSolver.h.

◆ _sGeometry

template<typename T , typename PARAMETERS , typename LATTICES >
std::shared_ptr<SuperGeometry<T,dim> > olb::LbSolver< T, PARAMETERS, LATTICES >::_sGeometry
protected

Definition at line 141 of file lbSolver.h.

◆ _sLattices

template<typename T , typename PARAMETERS , typename LATTICES >
LATTICES::values_t::template decompose_into<SuperLattices> olb::LbSolver< T, PARAMETERS, LATTICES >::_sLattices
protected

Definition at line 145 of file lbSolver.h.

◆ _timer

template<typename T , typename PARAMETERS , typename LATTICES >
std::unique_ptr<util::Timer<BaseType<T> > > olb::LbSolver< T, PARAMETERS, LATTICES >::_timer
protected

Definition at line 147 of file lbSolver.h.

◆ dim

template<typename T , typename PARAMETERS , typename LATTICES >
constexpr unsigned olb::LbSolver< T, PARAMETERS, LATTICES >::dim = LATTICES::values_t::template get<0>::d
staticconstexprprotected

Definition at line 136 of file lbSolver.h.

◆ isStationary

template<typename T , typename PARAMETERS , typename LATTICES >
constexpr bool olb::LbSolver< T, PARAMETERS, LATTICES >::isStationary = PARAMETERS::keys_t::template contains<names::Stationarity>()
staticconstexprprotected

Definition at line 149 of file lbSolver.h.

◆ outputGnuplot

template<typename T , typename PARAMETERS , typename LATTICES >
constexpr bool olb::LbSolver< T, PARAMETERS, LATTICES >::outputGnuplot = PARAMETERS::keys_t::template contains<names::VisualizationGnuplot>()
staticconstexprprotected

Definition at line 161 of file lbSolver.h.

◆ outputImages

template<typename T , typename PARAMETERS , typename LATTICES >
constexpr bool olb::LbSolver< T, PARAMETERS, LATTICES >::outputImages = PARAMETERS::keys_t::template contains<names::VisualizationImages>()
staticconstexprprotected

Definition at line 162 of file lbSolver.h.

◆ outputVTK

template<typename T , typename PARAMETERS , typename LATTICES >
constexpr bool olb::LbSolver< T, PARAMETERS, LATTICES >::outputVTK = PARAMETERS::keys_t::template contains<names::VisualizationVTK>()
staticconstexprprotected

Definition at line 163 of file lbSolver.h.


The documentation for this class was generated from the following files: