Flow123d  JB_transport-112d700
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
EquationBase Class Reference

#include <equation.hh>

Inheritance diagram for EquationBase:
Inheritance graph
[legend]
Collaboration diagram for EquationBase:
Collaboration graph
[legend]

Public Member Functions

 EquationBase ()
 
 EquationBase (Mesh &mesh, const Input::Record in_rec)
 
virtual void initialize ()
 
virtual void zero_time_step ()
 
virtual ~EquationBase ()
 
virtual void update_solution ()
 
virtual void choose_next_time ()
 
virtual void set_time_upper_constraint (double dt, std::string message)
 
virtual void set_time_lower_constraint (double dt, std::string message)
 
TimeGovernortime ()
 
virtual void set_time_governor (TimeGovernor &time)
 
double planned_time ()
 
virtual double solved_time ()
 
Meshmesh ()
 
std::shared_ptr< Balancebalance () const
 
TimeMark::Type mark_type ()
 
FieldSeteq_fieldset ()
 
std::shared_ptr< FieldSeteq_fieldset_ptr ()
 
virtual void output_data ()
 Write computed fields. More...
 
void init_user_fields (Input::Array user_fields, FieldSet &output_fields)
 

Static Public Member Functions

static Input::Type::Recordrecord_template ()
 Template Record with common keys for derived equations. More...
 
static Input::Type::Recorduser_fields_template (std::string equation_name)
 Template Record with common key user_fields for derived equations. More...
 

Protected Attributes

bool equation_empty_
 flag is true if only default constructor was called More...
 
Meshmesh_
 
TimeGovernortime_
 
Input::Record input_record_
 
std::shared_ptr< FieldSeteq_fieldset_
 
std::shared_ptr< Balancebalance_
 object for calculation and writing the mass balance to file. More...
 

Detailed Description

Class EquationBase is abstract base class for a general time dependent model. This class should provide general interface that can be used for general coupling of various particular models. By a model we mean a discrete solver of an partial or ordinary differential equation. Result of the model at one discrete time level should be a discrete field class (not yet implemented). Until we have field classes we only provide method get_solution_vector(), which returns pointer to sequential C array with linear combination of base functions that represents the solution.

Computation of one time step (method compute_one_step() ) is split into update_solution() and choose_next_time().

This class does not implement any constructor. In particular it does not initialize mesh and time. This has to be done in the constructor of particular child class.

Any constructor of child class should set solved = true. We assume, that after initialization an equation object stay solve in init time. For the first time step one calls method chose_next_time() which setup time frame of the first time step.

TODO: clarify initialization of data members

Definition at line 56 of file equation.hh.

Constructor & Destructor Documentation

◆ EquationBase() [1/2]

EquationBase::EquationBase ( )

Default constructor. Sets all virtual methods empty. Necessary to make tests fixtures for equations. TODO: Replace setting all in constructor with appropriate getters and setters. Make appropriate checks if key ingredients are initialized.

Definition at line 55 of file equation.cc.

◆ EquationBase() [2/2]

EquationBase::EquationBase ( Mesh mesh,
const Input::Record  in_rec 
)

Common initialization constructor. Implementation of particular equation should set just basic things in the constructor and postpone its initialization including initialization of its fields to the initialize method. The reason is that when the equation is part of a coupling the coupling may set some setting of the equation from the coupling level so that initialization use correct parameters. TODO: Which mechanism we use to pass setting form the coupling to its equations. Either use dedicated setters this however prevent generic coupling or use input storage to set data from upper level.

Definition at line 65 of file equation.cc.

◆ ~EquationBase()

virtual EquationBase::~EquationBase ( )
inlinevirtual

Require virtual destructor also for child classes.

Definition at line 112 of file equation.hh.

Member Function Documentation

◆ balance()

std::shared_ptr<Balance> EquationBase::balance ( ) const
inline

This getter method provides the balance object.

Definition at line 189 of file equation.hh.

Here is the caller graph for this function:

◆ choose_next_time()

virtual void EquationBase::choose_next_time ( )
inlinevirtual

Fix the next discrete time for computation. Can be rewritten in child class to set possible constrains according to possible equation coefficients or other data which can be result of another model.

Reimplemented in ReactionTerm.

Definition at line 133 of file equation.hh.

◆ eq_fieldset()

FieldSet& EquationBase::eq_fieldset ( )
inline

Return reference to the equation data object containing all fields that the equation needs or produce.

Definition at line 206 of file equation.hh.

Here is the caller graph for this function:

◆ eq_fieldset_ptr()

std::shared_ptr<FieldSet> EquationBase::eq_fieldset_ptr ( )
inline

Same as previous but return shared_ptr.

Definition at line 215 of file equation.hh.

◆ init_user_fields()

void EquationBase::init_user_fields ( Input::Array  user_fields,
FieldSet output_fields 
)

Create user defined fields, store them to equation FieldSet and to output FieldSet.

Parameters
user_fieldsList of Input::Records defined by user on input.
timeStart time of simulation (necessary for Field<>::set).
output_fieldsOutput FieldSet.

Definition at line 84 of file equation.cc.

Here is the caller graph for this function:

◆ initialize()

virtual void EquationBase::initialize ( )
inlinevirtual

This method should initialize fields of the equation. All members (e.g. number of components) that are necessary for the field initialization must be set between construction and call of initialize. After this method the upper level coupling may set sharing of some fields between equations.

Reimplemented in DarcyLMH, DarcyMH, TransportOperatorSplitting, ConvectionTransport, Elasticity, HM_Iterative, SorptionBase, DualPorosity, and FirstOrderReactionBase.

Definition at line 91 of file equation.hh.

◆ mark_type()

TimeMark::Type EquationBase::mark_type ( )
inline

Getter for equation time mark type.

Definition at line 197 of file equation.hh.

◆ mesh()

Mesh& EquationBase::mesh ( )
inline

This getter method provides the computational mesh currently used by the model.

Definition at line 181 of file equation.hh.

Here is the caller graph for this function:

◆ output_data()

virtual void EquationBase::output_data ( )
inlinevirtual

Write computed fields.

Reimplemented in SorptionBase, ReactionTerm, DualPorosity, DarcyLMH, DarcyMH, ConvectionTransport, TransportOperatorSplitting, TransportNothing, and Elasticity.

Definition at line 224 of file equation.hh.

◆ planned_time()

double EquationBase::planned_time ( )
inline

Most actual planned time for solution.

Definition at line 167 of file equation.hh.

◆ record_template()

Input::Type::Record & EquationBase::record_template ( )
static

Template Record with common keys for derived equations.

Definition at line 39 of file equation.cc.

Here is the caller graph for this function:

◆ set_time_governor()

void EquationBase::set_time_governor ( TimeGovernor time)
virtual

Set time governor.

Used to set pointer to common time governor (e.g. in Transport Operator Splitting, Reaction).

Definition at line 74 of file equation.cc.

◆ set_time_lower_constraint()

virtual void EquationBase::set_time_lower_constraint ( double  dt,
std::string  message 
)
inlinevirtual

Set external lower time step constrain for time governor of the equation.

Definition at line 145 of file equation.hh.

◆ set_time_upper_constraint()

virtual void EquationBase::set_time_upper_constraint ( double  dt,
std::string  message 
)
inlinevirtual

Set external upper time step constrain for time governor of the equation.

Definition at line 139 of file equation.hh.

◆ solved_time()

double EquationBase::solved_time ( )
virtual

Time until which the actual solution is valid. By default, it returns the actual time of the time governor. However, it can be overriden by a specific equation. E.g. it differs in Darcy flow in the steady case.

Reimplemented in DarcyLMH, and DarcyMH.

Definition at line 79 of file equation.cc.

◆ time()

TimeGovernor& EquationBase::time ( )
inline

Basic getter method returns TimeGovernor reference which provides full access to the time information.

Definition at line 151 of file equation.hh.

◆ update_solution()

virtual void EquationBase::update_solution ( )
inlinevirtual

Calculation of the next time step and its output.

Reimplemented in SorptionBase, DualPorosity, FirstOrderReactionBase, DarcyLMH, DarcyMH, TransportOperatorSplitting, ConvectionTransport, HM_Iterative, and Elasticity.

Definition at line 120 of file equation.hh.

◆ user_fields_template()

Input::Type::Record & EquationBase::user_fields_template ( std::string  equation_name)
static

Template Record with common key user_fields for derived equations.

Definition at line 46 of file equation.cc.

Here is the caller graph for this function:

◆ zero_time_step()

virtual void EquationBase::zero_time_step ( )
inlinevirtual

Initialization of the solution in the zero time.

There may be fields that can not be initialized in the initialize method as they are provided by the coupling. Fields coming from coupling has to be set after the initialize method and before zero_time_step.

Reimplemented in DarcyLMH, DarcyMH, TransportOperatorSplitting, ConvectionTransport, SorptionBase, HM_Iterative, Elasticity, DualPorosity, and FirstOrderReactionBase.

Definition at line 103 of file equation.hh.

Member Data Documentation

◆ balance_

std::shared_ptr<Balance> EquationBase::balance_
protected

object for calculation and writing the mass balance to file.

Definition at line 252 of file equation.hh.

◆ eq_fieldset_

std::shared_ptr<FieldSet> EquationBase::eq_fieldset_
protected

Pointer to the equation data object. Every particular equation is responsible to set the pointer in its constructor. This is used by the general method EqData::data(). This approach is simpler than making EqData::data() a virtual method.

Definition at line 249 of file equation.hh.

◆ equation_empty_

bool EquationBase::equation_empty_
protected

flag is true if only default constructor was called

Definition at line 239 of file equation.hh.

◆ input_record_

Input::Record EquationBase::input_record_
protected

Definition at line 242 of file equation.hh.

◆ mesh_

Mesh* EquationBase::mesh_
protected

Definition at line 240 of file equation.hh.

◆ time_

TimeGovernor* EquationBase::time_
protected

Definition at line 241 of file equation.hh.


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