INMOST
A toolkit for distributed mathematical modeling
|
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... | |
Automatizator & | GetAutomatizator () |
Retrieve an automatizator. | |
const Automatizator & | GetAutomatizator () const |
Retrieve an automatizator. | |
Mesh * | GetMesh (std::string) |
Retrieve a mesh by name. | |
const Mesh * | GetMesh (std::string) const |
Retrieve a mesh by name. | |
std::vector< std::string > | GetMeshesNames () const |
Retrieve all names of meshes. | |
AbstractEntry * | GetEntry (std::string name) |
Retrieve an entry that describe unknowns of the model by name. | |
const AbstractEntry * | GetEntry (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. | |
AbstractSubModel * | GetSubModel (std::string name) |
Retrieve a submodel of the model by name. | |
const AbstractSubModel * | GetSubModel (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. | |
AbstractCouplingTerm * | GetCouplingTerm (std::string submodel, std::string name) |
Retrieve a coupling term of the model by name. | |
const AbstractCouplingTerm * | GetCouplingTerm (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. | |
AbstractScalarFunction * | GetScalarFunction (std::string name) |
Retrieve a scalar function of the model by name. | |
const AbstractScalarFunction * | GetScalarFunction (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. | |
AbstractMatrixFunction * | GetMatrixFunction (std::string name) |
Retrieve a matrix functon of the model by name. | |
const AbstractMatrixFunction * | GetMatrixFunction (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. | |
AbstractOperator * | GetOperator (std::string name) |
Retrieve an operator of the model by name. | |
const AbstractOperator * | GetOperator (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 () |
A class to organize a model.
Definition at line 185 of file inmost_model.h.
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.
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.
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.
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.
void INMOST::Model::AddMatrixFunction | ( | std::string | name, |
AbstractMatrixFunction & | func | ||
) |
Add matrix coupling function to a model.
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.
void INMOST::Model::AddOperator | ( | std::string | name, |
AbstractOperator & | op | ||
) |
Add an operator to a model.
void INMOST::Model::AddScalarFunction | ( | std::string | name, |
AbstractScalarFunction & | func | ||
) |
Add scalar coupling function to a model.
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.
bool INMOST::Model::PrepareIterations | ( | ) |
Initialize data needed for FillResidual.
Called once before nonlinear iterations.
|
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.
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.