OpenLB 1.7
Loading...
Searching...
No Matches
Classes | Functions
olb::opti::projection Namespace Reference

Classes

struct  Baron
 
struct  Base
 
struct  Foerster
 
struct  FoersterN
 FoersterProjection for arbitrary n. More...
 
struct  ForceFactor
 Convert force to lattice units. More...
 
struct  GiBase
 Gridterm-dependent projection base class. More...
 
struct  Identity
 
struct  Krause
 
struct  Rectifier
 
struct  Sigmoid
 
struct  Softplus
 
struct  StasiusN
 StasiusProjection for arbitrary n. More...
 

Functions

template<typename T , typename DESCRIPTOR >
gridTerm (const UnitConverter< T, DESCRIPTOR > &converter)
 
template<typename T >
porosityToControl (T porosity, const Base< T > &projection)
 Get control value for given porosity.
 
template<typename T , typename DESCRIPTOR >
permeabilityToPorosity (T permeability, const UnitConverter< T, DESCRIPTOR > &converter)
 Get porosity for given permeability.
 
template<typename T , typename DESCRIPTOR >
permeabilityToControl (T permeability, const Base< T > &projection, const UnitConverter< T, DESCRIPTOR > &converter)
 Get control for given permeability.
 
template<typename T , typename DESCRIPTOR >
getInitialControl (T startValue, const Base< T > &projection, const UnitConverter< T, DESCRIPTOR > &converter, StartValueType type, bool verbose=true)
 Transform porosity/ permeability/ other startValue into control.
 
template<typename T , typename OptiCaseDual_Type >
getInitialControl (T startValue, OptiCaseDual_Type &optiCase)
 
template<typename T , typename DESCRIPTOR >
std::shared_ptr< projection::Base< T > > construct (const UnitConverter< T, DESCRIPTOR > &converter, std::string &name)
 

Function Documentation

◆ construct()

template<typename T , typename DESCRIPTOR >
std::shared_ptr< projection::Base< T > > olb::opti::projection::construct ( const UnitConverter< T, DESCRIPTOR > & converter,
std::string & name )

Definition at line 320 of file projection.h.

322{
323 std::smatch match;
324 if (name == "Identity") {
325 return std::make_shared<Identity<T>>();
326 } else if (name == "Sigmoid") {
327 return std::make_shared<Sigmoid<T>>();
328 } else if (name == "ForceFactor") {
329 return std::make_shared<ForceFactor<T>>(converter);
330 } else if (name == "Rectifier") {
331 return std::make_shared<Rectifier<T>>();
332 } else if (name == "Softplus") {
333 return std::make_shared<Softplus<T>>();
334 } else if (name == "Baron") {
335 return std::make_shared<Baron<T>>();
336 } else if (name == "Krause") {
337 return std::make_shared<Krause<T>>();
338 } else if (name == "Foerster") {
339 return std::make_shared<Foerster<T,DESCRIPTOR>>(converter);
340 } else if (std::regex_match(name, match, std::regex ("(Foerster)([0-9])"))) {
341 const unsigned n = std::stoi(match[2]);
342 return std::make_shared<FoersterN<T,DESCRIPTOR>>(converter, n);
343 } else if (std::regex_match(name, match, std::regex ("(Stasius)([0-9])"))) {
344 const unsigned n = std::stoi(match[2]);
345 return std::make_shared<StasiusN<T,DESCRIPTOR>>(converter, n);
346 } else {
347 throw std::invalid_argument(
348 "Error: unknown projection name selected.");
349 }
350}

◆ getInitialControl() [1/2]

template<typename T , typename DESCRIPTOR >
T olb::opti::projection::getInitialControl ( T startValue,
const Base< T > & projection,
const UnitConverter< T, DESCRIPTOR > & converter,
StartValueType type,
bool verbose = true )

Transform porosity/ permeability/ other startValue into control.

Definition at line 177 of file projection.h.

182{
183 T control {0};
184 OstreamManager clout(std::cout, "getInitialControl");
185
186 if (type == Porosity) {
187 control = projection::porosityToControl(startValue, projection);
188 if (verbose) {
189 clout << "Transform porosity startValue into control startValue:\n";
190 clout << "Porosity: " << startValue << std::endl;
191 clout << "Control: " << control << std::endl;
192 }
193 }
194 else if (type == Permeability) {
195 const T tmpPorosity = projection::permeabilityToPorosity(startValue, converter);
196 control = projection::porosityToControl(tmpPorosity, projection);
197 if (verbose) {
198 clout << "Transform permeability startValue into control startValue:\n";
199 clout << "Permeability: " << startValue << std::endl;
200 clout << "Porosity: " << tmpPorosity << std::endl;
201 clout << "Control: " << control << std::endl;
202 }
203 }
204 else if (type == ProjectedControl) {
205 control = projection.inverse(startValue);
206 } else if (type == Control) {
207 control = startValue;
208 } else {
209 throw std::invalid_argument(
210 "Error: unknown start value type.");
211 }
212 return control;
213}
class for marking output with some text
virtual T inverse(T) const =0

References olb::opti::control, olb::opti::Control, olb::opti::projection::Base< T >::inverse(), olb::opti::Permeability, permeabilityToPorosity(), olb::opti::Porosity, porosityToControl(), and olb::opti::ProjectedControl.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInitialControl() [2/2]

template<typename T , typename OptiCaseDual_Type >
T olb::opti::projection::getInitialControl ( T startValue,
OptiCaseDual_Type & optiCase )

Definition at line 216 of file projection.h.

217{
218 return getInitialControl(startValue,
219 *(optiCase._projection),
220 *(optiCase._converter),
221 optiCase._startValueType,
222 optiCase._verbose);
223}
T getInitialControl(T startValue, const Base< T > &projection, const UnitConverter< T, DESCRIPTOR > &converter, StartValueType type, bool verbose=true)
Transform porosity/ permeability/ other startValue into control.
Definition projection.h:177

References getInitialControl().

+ Here is the call graph for this function:

◆ gridTerm()

template<typename T , typename DESCRIPTOR >
T olb::opti::projection::gridTerm ( const UnitConverter< T, DESCRIPTOR > & converter)

Definition at line 142 of file projection.h.

142 {
143 return converter.getPhysDeltaX()
144 * converter.getPhysDeltaX()
145 * converter.getLatticeViscosity()
146 * converter.getLatticeRelaxationTime();
147}
constexpr T getLatticeViscosity() const
conversion from physical to lattice viscosity
constexpr T getLatticeRelaxationTime() const
return relaxation time in lattice units
constexpr T getPhysDeltaX() const
returns grid spacing (voxel length) in m

References olb::UnitConverter< T, DESCRIPTOR >::getLatticeRelaxationTime(), olb::UnitConverter< T, DESCRIPTOR >::getLatticeViscosity(), and olb::UnitConverter< T, DESCRIPTOR >::getPhysDeltaX().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ permeabilityToControl()

template<typename T , typename DESCRIPTOR >
T olb::opti::projection::permeabilityToControl ( T permeability,
const Base< T > & projection,
const UnitConverter< T, DESCRIPTOR > & converter )

Get control for given permeability.

Definition at line 167 of file projection.h.

170{
171 const T porosity = permeabilityToPorosity(permeability, converter);
172 return porosityToControl(porosity);
173}
T porosityToControl(T porosity, const Base< T > &projection)
Get control value for given porosity.
Definition projection.h:152
T permeabilityToPorosity(T permeability, const UnitConverter< T, DESCRIPTOR > &converter)
Get porosity for given permeability.
Definition projection.h:159

References permeabilityToPorosity(), and porosityToControl().

+ Here is the call graph for this function:

◆ permeabilityToPorosity()

template<typename T , typename DESCRIPTOR >
T olb::opti::projection::permeabilityToPorosity ( T permeability,
const UnitConverter< T, DESCRIPTOR > & converter )

Get porosity for given permeability.

Definition at line 159 of file projection.h.

161{
162 return (T(1) - gridTerm(converter) / permeability);
163}
T gridTerm(const UnitConverter< T, DESCRIPTOR > &converter)
Definition projection.h:142

References gridTerm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ porosityToControl()

template<typename T >
T olb::opti::projection::porosityToControl ( T porosity,
const Base< T > & projection )

Get control value for given porosity.

Definition at line 152 of file projection.h.

153{
154 return projection.inverse(porosity);
155}

References olb::opti::projection::Base< T >::inverse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: