OpenLB 1.7
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
olb::opti::AdjointLbSolverBase< T, PARAMETERS, LATTICES, MODE > Class Template Reference

Base class for solvers that solve both primal and dual problems. More...

#include <adjointLbSolver.h>

+ Inheritance diagram for olb::opti::AdjointLbSolverBase< T, PARAMETERS, LATTICES, MODE >:
+ Collaboration diagram for olb::opti::AdjointLbSolverBase< T, PARAMETERS, LATTICES, MODE >:

Public Types

using DESCRIPTOR = typename LATTICES::values_t::template get<0>
 
- Public Types inherited from olb::BaseSolver< T, PARAMETERS >
using t = T
 
using Parameters_t = PARAMETERS
 

Public Member Functions

 AdjointLbSolverBase (utilities::TypeIndexedSharedPtrTuple< PARAMETERS > params)
 
- Public Member Functions inherited from olb::LbSolver< T, PARAMETERS, LATTICES >
 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 Member Functions

void loadPrimalPopulations ()
 Helper for dual solver: init external fields from primal solution.
 
- Protected Member Functions inherited from olb::LbSolver< T, PARAMETERS, LATTICES >
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
 

Additional Inherited Members

- Public Attributes inherited from olb::BaseSolver< T, PARAMETERS >
utilities::TypeIndexedSharedPtrTuple< PARAMETERS > _parameters
 
- Protected Types inherited from olb::LbSolver< T, PARAMETERS, LATTICES >
template<typename... DESCRIPTORS>
using SuperLattices = std::tuple<std::shared_ptr<SuperLattice<T,DESCRIPTORS>>...>
 
- Static Protected Member Functions inherited from olb::LbSolver< T, PARAMETERS, LATTICES >
static constexpr unsigned getNumberStationaryLattices ()
 
- Protected Attributes inherited from olb::LbSolver< T, PARAMETERS, LATTICES >
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 inherited from olb::LbSolver< T, PARAMETERS, LATTICES >
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>()
 

Detailed Description

template<typename T, typename PARAMETERS, typename LATTICES, SolverMode MODE>
class olb::opti::AdjointLbSolverBase< T, PARAMETERS, LATTICES, MODE >

Base class for solvers that solve both primal and dual problems.

Implementation is close to old Solver3D implementation. So far, LATTICES is expected to hold exactly one lattice (only 3D and "Navier-Stokes" has been tested).

Definition at line 52 of file adjointLbSolver.h.

Member Typedef Documentation

◆ DESCRIPTOR

template<typename T , typename PARAMETERS , typename LATTICES , SolverMode MODE>
using olb::opti::AdjointLbSolverBase< T, PARAMETERS, LATTICES, MODE >::DESCRIPTOR = typename LATTICES::values_t::template get<0>

Definition at line 58 of file adjointLbSolver.h.

Constructor & Destructor Documentation

◆ AdjointLbSolverBase()

template<typename T , typename PARAMETERS , typename LATTICES , SolverMode MODE>
olb::opti::AdjointLbSolverBase< T, PARAMETERS, LATTICES, MODE >::AdjointLbSolverBase ( utilities::TypeIndexedSharedPtrTuple< PARAMETERS > params)
inline

Definition at line 60 of file adjointLbSolver.h.

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

Member Function Documentation

◆ loadPrimalPopulations()

template<typename T , typename PARAMETERS , typename LATTICES , SolverMode MODE>
void olb::opti::AdjointLbSolverBase< T, PARAMETERS, LATTICES, MODE >::loadPrimalPopulations ( )
inlineprotected

Helper for dual solver: init external fields from primal solution.

Definition at line 66 of file adjointLbSolver.h.

67 {
68 const auto& params = this->parameters(names::Opti());
69 auto lattice = std::get<0>(this->_sLattices);
70
71 lattice->template defineField<descriptors::F>(
72 this->geometry(), 1, *params.fpop);
73 lattice->template defineField<descriptors::F>(
74 this->geometry(), params.controlMaterial, *params.fpop);
75
76 lattice->template defineField<descriptors::DJDF>(
77 this->geometry(), 1, *(params.dObjectiveDf));
78 lattice->template defineField<descriptors::DJDF>(
79 this->geometry(), params.controlMaterial, *(params.dObjectiveDf));
80 lattice->template defineField<descriptors::DJDALPHA>(
81 this->geometry(), params.controlMaterial, *(params.dObjectiveDcontrol));
82
83 // update fields if gpu used
84 lattice->template setProcessingContext<Array<descriptors::F>>(ProcessingContext::Simulation);
85 lattice->template setProcessingContext<Array<descriptors::DJDF>>(ProcessingContext::Simulation);
86 lattice->template setProcessingContext<Array<descriptors::DJDALPHA>>(ProcessingContext::Simulation);
87 }
auto & parameters(KEY=KEY())
Access to parameter structs as parameters(KEY())
Definition lbSolver.h:104
auto & geometry()
Definition lbSolver.h:300
auto & lattice()
Definition lbSolver.h:292
LATTICES::values_t::template decompose_into< SuperLattices > _sLattices
Definition lbSolver.h:145
@ Simulation
Data available on host for e.g. functor evaluation.

References olb::LbSolver< T, PARAMETERS, LATTICES >::_sLattices, olb::LbSolver< T, PARAMETERS, LATTICES >::geometry(), olb::LbSolver< T, PARAMETERS, LATTICES >::lattice(), olb::BaseSolver< T, PARAMETERS >::parameters(), and olb::Simulation.

+ Here is the call graph for this function:

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