INMOST
A toolkit for distributed mathematical modeling
INMOST::Model Class Reference

A class to organize a model. More...

#include <inmost_model.h>

Public Member Functions

 Model (Automatizator &aut)
 
void ActivateSubModel (std::string name)
 
void DeactivateSubModel (std::string name)
 
void ToggleEntryState ()
 
void ActivateEntry (std::string name)
 
void DeactivateEntry (std::string name)
 
void AddEntry (std::string name, AbstractEntry &entry)
 Add an entry of block unknowns to a model. More...
 
void AddAfterEntry (std::string name, AbstractEntry &entry, std::string after)
 Add an entry of block unknowns to a model after an entry with certain name. More...
 
void AddFirstEntry (std::string name, AbstractEntry &entry)
 Add an entry of block unknowns to a model as a first entry. More...
 
void AddMesh (std::string name, Mesh &m)
 Add a mesh to a model. More...
 
void AddSubModel (std::string name, AbstractSubModel &submodel)
 Add a submodel to a model. More...
 
void AddCouplingTerm (std::string submodel, std::string name, AbstractCouplingTerm &term)
 Add coupling term to a submodel. More...
 
void AddScalarFunction (std::string name, AbstractScalarFunction &func)
 Add scalar coupling function to a model. More...
 
void AddMatrixFunction (std::string name, AbstractMatrixFunction &func)
 Add matrix coupling function to a model. More...
 
void AddOperator (std::string name, AbstractOperator &op)
 Add an operator to a model. More...
 
AutomatizatorGetAutomatizator ()
 Retrieve an automatizator.
 
const AutomatizatorGetAutomatizator () const
 Retrieve an automatizator.
 
MeshGetMesh (std::string)
 Retrieve a mesh by name.
 
const MeshGetMesh (std::string) const
 Retrieve a mesh by name.
 
std::vector< std::string > GetMeshesNames () const
 Retrieve all names of meshes.
 
AbstractEntryGetEntry (std::string name)
 Retrieve an entry that describe unknowns of the model by name.
 
const AbstractEntryGetEntry (std::string name) const
 Retrieve an entry that describe unknowns of the model by name.
 
std::vector< std::string > GetEntriesNames () const
 Retrieve all names of entries.
 
AbstractSubModelGetSubModel (std::string name)
 Retrieve a submodel of the model by name.
 
const AbstractSubModelGetSubModel (std::string name) const
 Retrieve a submodel of the model by name.
 
std::string GetSubModelName (const AbstractSubModel *model) const
 Retrieve the name by submodel address.
 
std::vector< std::string > GetSubModelsNames () const
 Retrieve all names of submodules.
 
AbstractCouplingTermGetCouplingTerm (std::string submodel, std::string name)
 Retrieve a coupling term of the model by name.
 
const AbstractCouplingTermGetCouplingTerm (std::string submodel, std::string name) const
 Retrieve a coupling term of the model by name.
 
std::vector< std::pair< std::string, std::vector< std::string > > > GetCouplingTermNames () const
 Retrieve all names of coupling terms.
 
AbstractScalarFunctionGetScalarFunction (std::string name)
 Retrieve a scalar function of the model by name.
 
const AbstractScalarFunctionGetScalarFunction (std::string name) const
 Retrieve a scalar function of the model by name.
 
std::vector< std::string > GetScalarFunctionNames () const
 Retrieve all names of scalar functions.
 
AbstractMatrixFunctionGetMatrixFunction (std::string name)
 Retrieve a matrix functon of the model by name.
 
const AbstractMatrixFunctionGetMatrixFunction (std::string name) const
 Retrieve a matrix function of the model by name.
 
std::vector< std::string > GetMatrixFunctionNames () const
 Retrieve all names of matrix functions.
 
AbstractOperatorGetOperator (std::string name)
 Retrieve an operator of the model by name.
 
const AbstractOperatorGetOperator (std::string name) const
 Retrieve an operator of the model by name.
 
std::vector< std::string > GetOperatorsNames () const
 Retrieve all names of operators.
 
bool PrepareEntries ()
 Each submodel introduces its unknowns into the model so that later it can be accessed.
 
bool Initialize ()
 Initialize all entries and submodels.
 
bool SetupCoupling ()
 Link to all couplings after PrepareEntries and Initialize.
 
bool PrepareIterations ()
 Initialize data needed for FillResidual. More...
 
bool FillResidual (Residual &R) const
 Compute the residual of the model.
 
bool UpdateSolution (const Sparse::Vector &sol, double alpha)
 Update solution. More...
 
bool UpdateTimeStep ()
 Move to the next time step.
 
bool SetTimeStep (double dt)
 Provide new time step.
 
bool SetTime (double t)
 Provide current time.
 
bool RestoreTimeStep ()
 Roll back to previous time step.
 
bool isInitialized () const
 Check if the model was initialized.
 
bool areEntriesSet () const
 Check if the entries were set.
 
void SynchronizeData ()
 Update variables contained in all block of automatizator on ghost elements of the grid. More...
 
double UpdateMultiplier (const Sparse::Vector &sol) const
 Calculate multiplier for update.
 
double AdjustTimeStep (double dt) const
 Calculate optimal time step for submodels.
 
void ReportErrors (const Residual &R) const
 
void PrepareOutput ()
 
void FinishOutput ()
 

Detailed Description

A class to organize a model.

Definition at line 185 of file inmost_model.h.

Member Function Documentation

◆ AddAfterEntry()

void INMOST::Model::AddAfterEntry ( std::string  name,
AbstractEntry entry,
std::string  after 
)

Add an entry of block unknowns to a model after an entry with certain name.

The model stores a link to the entry and may modify its contents. The intries should be added from Model::Initialize function, either by model or by any of the submodels.

◆ AddCouplingTerm()

void INMOST::Model::AddCouplingTerm ( std::string  submodel,
std::string  name,
AbstractCouplingTerm term 
)

Add coupling term to a submodel.

An empty submodel name will add a global coupling term. Coupling terms linked to submodels are not evaluated for non-active submodels. Global coupling terms are always evaluated and should monitor the state of the unknown to avoid writing to respective residual.

Warning
A pointer to the original object is stored, thus do not destroy the original object.

◆ AddEntry()

void INMOST::Model::AddEntry ( std::string  name,
AbstractEntry entry 
)

Add an entry of block unknowns to a model.

The model stores a link to the entry and may modify its contents. The intries should be added from Model::Initialize function, either by model or by any of the submodels.

◆ AddFirstEntry()

void INMOST::Model::AddFirstEntry ( std::string  name,
AbstractEntry entry 
)

Add an entry of block unknowns to a model as a first entry.

The model stores a link to the entry and may modify its contents. The intries should be added from Model::Initialize function, either by model or by any of the submodels.

◆ AddMatrixFunction()

void INMOST::Model::AddMatrixFunction ( std::string  name,
AbstractMatrixFunction func 
)

Add matrix coupling function to a model.

Warning
A pointer to the original object is stored, thus do not destroy the original object.

◆ AddMesh()

void INMOST::Model::AddMesh ( std::string  name,
Mesh m 
)

Add a mesh to a model.

The model stores a link to the provided mesh, so it should not be deallocated. The meshes are provided by the user from outside before Model::Initialize function was called. The meshes are requested by name by each submodel. Same mesh can be added with different names for submodels.

◆ AddOperator()

void INMOST::Model::AddOperator ( std::string  name,
AbstractOperator op 
)

Add an operator to a model.

Warning
A pointer to the original object is stored, thus do not destroy the original object.

◆ AddScalarFunction()

void INMOST::Model::AddScalarFunction ( std::string  name,
AbstractScalarFunction func 
)

Add scalar coupling function to a model.

Warning
A pointer to the original object is stored, thus do not destroy the original object.

◆ AddSubModel()

void INMOST::Model::AddSubModel ( std::string  name,
AbstractSubModel submodel 
)

Add a submodel to a model.

Submodels are added by the user from outside. All submodels are initialized on Model::Initialize function.

Warning
A pointer to the original object is stored, thus do not destroy the original object.

◆ PrepareIterations()

bool INMOST::Model::PrepareIterations ( )

Initialize data needed for FillResidual.

Called once before nonlinear iterations.

◆ SynchronizeData()

void INMOST::Model::SynchronizeData ( )
inline

Update variables contained in all block of automatizator on ghost elements of the grid.

For synchronization of data in individual blocks see AbstractEntry::SynchronizeData.

Definition at line 334 of file inmost_model.h.

◆ UpdateSolution()

bool INMOST::Model::UpdateSolution ( const Sparse::Vector sol,
double  alpha 
)

Update solution.

alpha is the parameter that scales the update solution. Usually calculated with UpdateMultiplier.


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