OOFEM
2.4
OOFEM.org - Object Oriented Finite Element Solver
|
Abstract class representing field of primary variables (those, which are unknown and are typically associated to nodes). More...
#include <primaryfield.h>
Public Member Functions | |
PrimaryField (EngngModel *a, int idomain, FieldType ft, int nHist) | |
Constructor. More... | |
virtual | ~PrimaryField () |
virtual void | initialize (ValueModeType mode, TimeStep *tStep, FloatArray &answer, const UnknownNumberingScheme &s) |
Copy unknowns from previous solution or DOF's dictionary to the solution vector. More... | |
void | storeDofManager (TimeStep *tStep, DofManager &dman) |
void | storeInDofDictionaries (TimeStep *tStep) |
void | readDofManager (TimeStep *tStep, DofManager &dman) |
void | readFromDofDictionaries (TimeStep *tStep) |
virtual void | applyDefaultInitialCondition () |
Applies the default initial values values for all DOFs (0) in given domain. More... | |
void | applyInitialCondition (InitialCondition &ic) |
Applies initial condition to all DOFs. More... | |
virtual void | applyBoundaryCondition (TimeStep *tStep) |
Applies all boundary conditions to all prescribed DOFs. More... | |
void | applyBoundaryCondition (BoundaryCondition &bc, TimeStep *tStep) |
Applies the boundary condition to all prescribed DOFs in given domain. More... | |
virtual double | giveUnknownValue (Dof *dof, ValueModeType mode, TimeStep *tStep) |
virtual int | evaluateAt (FloatArray &answer, const FloatArray &coords, ValueModeType mode, TimeStep *tStep) |
Evaluates the field at given point. More... | |
virtual int | evaluateAt (FloatArray &answer, DofManager *dman, ValueModeType mode, TimeStep *tStep) |
Evaluates the field at given DofManager. More... | |
virtual int | __evaluateAt (FloatArray &answer, DofManager *dman, ValueModeType mode, TimeStep *tStep, IntArray *dofId) |
Evaluates the field at given DOF manager, allows to select specific dofs using mask. More... | |
virtual int | __evaluateAt (FloatArray &answer, const FloatArray &coords, ValueModeType mode, TimeStep *tStep, IntArray *dofId) |
Evaluates the field at given point, allows to select specific dofs using mask. More... | |
virtual FloatArray * | giveSolutionVector (TimeStep *tStep) |
virtual void | update (ValueModeType mode, TimeStep *tStep, const FloatArray &vectorToStore, const UnknownNumberingScheme &s) |
Project vectorToStore back to DOF's dictionary. More... | |
virtual void | advanceSolution (TimeStep *tStep) |
Brings up a new solution vector for given time step. More... | |
virtual contextIOResultType | saveContext (DataStream &stream, ContextMode mode) |
Stores receiver state to output stream. More... | |
virtual contextIOResultType | restoreContext (DataStream &stream, ContextMode mode) |
Restores the receiver state previously written in stream. More... | |
virtual const char * | giveClassName () const |
int | giveActualStepNumber () |
Public Member Functions inherited from oofem::Field | |
Field (FieldType b) | |
Constructor. More... | |
virtual | ~Field () |
FieldType | giveType () |
Returns the type of receiver. More... | |
std::string | errorInfo (const char *func) const |
Returns string for prepending output (used by error reporting macros). More... | |
Protected Member Functions | |
int | resolveIndx (TimeStep *tStep, int shift) |
FloatArray * | giveSolutionVector (int) |
FloatArray * | givePrescribedVector (int) |
Protected Attributes | |
int | actualStepNumber |
int | actualStepIndx |
int | nHistVectors |
std::vector< FloatArray > | solutionVectors |
std::vector< FloatArray > | prescribedVectors |
std::vector< TimeStep > | solStepList |
EngngModel * | emodel |
int | domainIndx |
Protected Attributes inherited from oofem::Field | |
FieldType | type |
Abstract class representing field of primary variables (those, which are unknown and are typically associated to nodes).
In the current design the primary field is understood as simple database, that allows to keep track of the history of a solution vector representing primary field. The history is kept as sequence of solution vectors. The history depth kept can be selected. PrimaryField class basically provides access to time-dependent vectors of the field of unknowns. It adds the possibility to further interpolate the field values using element interpolation functions. The prescribed values of the field are not maintained, since they can be obtained directly from corresponding DOFs of associated domain.
As the PrimaryField stores the state directly in solution vectors that are usually directly updated by EngngModel, it may contain a mix of different fields (this is especially true for strongly coupled problems). Then masked primary field can be used to select only certain DOFs (based on DofID) from its master PrimaryField.
Definition at line 104 of file primaryfield.h.
oofem::PrimaryField::PrimaryField | ( | EngngModel * | a, |
int | idomain, | ||
FieldType | ft, | ||
int | nHist | ||
) |
Constructor.
Creates a field of given type associated to given domain. Not using pointer to domain, because this will prevent the use of PrimaryField as an EngngModel attribute. This is because the domain does not exists when PrimaryField is created (this is when EngngModel is created).
a | Engineering model which field belongs to. |
idomain | Index of domain for field. |
ft | Type of stored field. |
nHist | Number of old time steps to store. |
Definition at line 49 of file primaryfield.C.
References actualStepIndx, actualStepNumber, domainIndx, emodel, and nHistVectors.
|
virtual |
Definition at line 60 of file primaryfield.C.
|
virtual |
Evaluates the field at given DOF manager, allows to select specific dofs using mask.
answer | Evaluated field at dman. |
dman | DOF manager of interest. |
mode | Mode of evaluated unknowns. |
tStep | Time step of interest. |
dofId | Dof mask, id set to NULL, all Dofs evaluated. |
Definition at line 349 of file primaryfield.C.
References domainIndx, emodel, oofem::DofManager::giveCompleteUnknownVector(), oofem::DofManager::giveCoordinates(), oofem::FEMComponent::giveDomain(), oofem::EngngModel::giveDomain(), and oofem::DofManager::giveUnknownVector().
Referenced by oofem::MaskedPrimaryField::evaluateAt(), and evaluateAt().
|
virtual |
Evaluates the field at given point, allows to select specific dofs using mask.
answer | Evaluated field at coords. |
coords | Coordinates of the point of interest. |
mode | Mode of evaluated unknowns. |
tStep | Time step of interest. |
dofId | Dof mask, id set to NULL, all Dofs evaluated. |
Definition at line 369 of file primaryfield.C.
References oofem::IntArray::at(), oofem::FloatArray::at(), oofem::Element::computeField(), domainIndx, oofem::EIPrimaryFieldInterface::EIPrimaryFieldI_evaluateFieldVectorAt(), oofem::EIPrimaryFieldInterfaceType, emodel, oofem::IntArray::findFirstIndexOf(), oofem::EngngModel::giveDomain(), oofem::SpatialLocalizer::giveElementClosestToPoint(), oofem::SpatialLocalizer::giveElementContainingPoint(), oofem::Element::giveElementDofIDMask(), oofem::FEMComponent::giveInterface(), oofem::IntArray::giveSize(), oofem::Domain::giveSpatialLocalizer(), OOFEM_ERROR, oofem::FloatArray::resize(), and oofem::FloatArray::zero().
|
virtual |
Brings up a new solution vector for given time step.
tStep | Time step for new solution vector. |
Reimplemented in oofem::DofDistributedPrimaryField.
Definition at line 483 of file primaryfield.C.
References actualStepIndx, actualStepNumber, oofem::TimeStep::giveNumber(), givePrescribedVector(), giveSolutionVector(), nHistVectors, OOFEM_ERROR, resolveIndx(), and solStepList.
Referenced by oofem::DofDistributedPrimaryField::advanceSolution(), oofem::CBS::applyIC(), and oofem::CBS::solveYourselfAt().
|
virtual |
Applies all boundary conditions to all prescribed DOFs.
tStep | Current time step. |
Reimplemented in oofem::DofDistributedPrimaryField.
Definition at line 262 of file primaryfield.C.
References oofem::FloatArray::at(), domainIndx, emodel, oofem::Domain::giveBc(), oofem::Domain::giveBcs(), oofem::Domain::giveDofManagers(), oofem::EngngModel::giveDomain(), givePrescribedVector(), oofem::TimeStep::giveTargetTime(), and resolveIndx().
void oofem::PrimaryField::applyBoundaryCondition | ( | BoundaryCondition & | bc, |
TimeStep * | tStep | ||
) |
Applies the boundary condition to all prescribed DOFs in given domain.
bc | Boundary condition. |
domain | tStep Time step for when bc applies. |
Definition at line 286 of file primaryfield.C.
References oofem::FloatArray::at(), oofem::BoundaryCondition::give(), oofem::GeneralBoundaryCondition::giveDofIDs(), oofem::Domain::giveDofManager(), oofem::DofManager::giveDofWithID(), oofem::FEMComponent::giveDomain(), oofem::Dof::giveEqn(), givePrescribedVector(), oofem::Domain::giveSet(), oofem::GeneralBoundaryCondition::giveSetNumber(), oofem::TimeStep::giveTargetTime(), and resolveIndx().
|
virtual |
Applies the default initial values values for all DOFs (0) in given domain.
domain | Domain number |
Reimplemented in oofem::DofDistributedPrimaryField.
Definition at line 168 of file primaryfield.C.
References applyInitialCondition(), oofem::FloatArray::at(), domainIndx, emodel, oofem::InitialCondition::give(), oofem::Domain::giveDofManagers(), oofem::EngngModel::giveDomain(), oofem::Domain::giveIc(), oofem::Domain::giveIcs(), oofem::EngngModel::giveNumberOfDomainEquations(), givePrescribedVector(), oofem::EngngModel::giveSolutionStepWhenIcApply(), giveSolutionVector(), oofem::InitialCondition::hasConditionOn(), prescribedVectors, resolveIndx(), and solutionVectors.
void oofem::PrimaryField::applyInitialCondition | ( | InitialCondition & | ic | ) |
Applies initial condition to all DOFs.
ic | Initial condition for DOFs |
Definition at line 217 of file primaryfield.C.
References oofem::FloatArray::at(), emodel, oofem::InitialCondition::give(), oofem::Domain::giveDofManager(), oofem::FEMComponent::giveDomain(), givePrescribedVector(), oofem::Domain::giveSet(), oofem::InitialCondition::giveSetNumber(), oofem::EngngModel::giveSolutionStepWhenIcApply(), giveSolutionVector(), oofem::TimeStep::giveTimeIncrement(), oofem::InitialCondition::hasConditionOn(), and resolveIndx().
Referenced by applyDefaultInitialCondition().
|
virtual |
Evaluates the field at given point.
answer | Evaluated field at point. |
coords | Coordinates of the point of interest. |
mode | Mode of evaluated unknowns. |
tStep | Time step of interest. |
Implements oofem::Field.
Definition at line 427 of file primaryfield.C.
References __evaluateAt().
|
virtual |
Evaluates the field at given DofManager.
answer | Evaluated field at dman. |
dman | DOF manager to evaluate at. |
mode | Mode of evaluated unknowns. |
tStep | Time step of interest. |
Implements oofem::Field.
Definition at line 435 of file primaryfield.C.
References __evaluateAt().
|
inline |
Definition at line 243 of file primaryfield.h.
|
inlinevirtual |
Implements oofem::Field.
Definition at line 240 of file primaryfield.h.
|
protected |
Definition at line 458 of file primaryfield.C.
References nHistVectors, OOFEM_ERROR, and prescribedVectors.
Referenced by advanceSolution(), applyBoundaryCondition(), applyDefaultInitialCondition(), applyInitialCondition(), giveUnknownValue(), readDofManager(), and storeDofManager().
|
virtual |
tStep | Time step to take solution for. |
Reimplemented in oofem::DofDistributedPrimaryField.
Definition at line 443 of file primaryfield.C.
References resolveIndx().
Referenced by advanceSolution(), applyDefaultInitialCondition(), oofem::CBS::applyIC(), applyInitialCondition(), oofem::DofDistributedPrimaryField::giveSolutionVector(), giveUnknownValue(), initialize(), readDofManager(), oofem::CBS::solveYourselfAt(), storeDofManager(), and update().
|
protected |
Definition at line 449 of file primaryfield.C.
References nHistVectors, OOFEM_ERROR, and solutionVectors.
|
virtual |
dof | Pointer to DOF. |
mode | What the unknown describes (increment, total value etc.). |
tStep | Time step of interest. |
Reimplemented in oofem::DofDistributedPrimaryField.
Definition at line 319 of file primaryfield.C.
References oofem::FloatArray::at(), oofem::Dof::giveEqn(), givePrescribedVector(), giveSolutionVector(), OOFEM_ERROR, oofem::FloatArray::resize(), and resolveIndx().
Referenced by oofem::MasterDof::giveUnknown(), and oofem::CBS::giveUnknownComponent().
|
virtual |
Copy unknowns from previous solution or DOF's dictionary to the solution vector.
mode | what the unknown describes (increment, total value etc.). |
tStep | Time of interest. |
answer | Resulting vector. |
Reimplemented in oofem::DofDistributedPrimaryField.
Definition at line 154 of file primaryfield.C.
References oofem::__ValueModeTypeToString(), giveSolutionVector(), OOFEM_ERROR, resolveIndx(), and oofem::FloatArray::subtract().
void oofem::PrimaryField::readDofManager | ( | TimeStep * | tStep, |
DofManager & | dman | ||
) |
Definition at line 108 of file primaryfield.C.
References oofem::FloatArray::at(), givePrescribedVector(), oofem::TimeStep::givePreviousStep(), giveSolutionVector(), nHistVectors, and resolveIndx().
Referenced by readFromDofDictionaries().
void oofem::PrimaryField::readFromDofDictionaries | ( | TimeStep * | tStep | ) |
Definition at line 128 of file primaryfield.C.
References domainIndx, emodel, oofem::Domain::giveBcs(), oofem::Domain::giveDofManagers(), oofem::EngngModel::giveDomain(), oofem::Domain::giveElements(), and readDofManager().
|
protected |
Definition at line 468 of file primaryfield.C.
References actualStepIndx, actualStepNumber, oofem::TimeStep::giveNumber(), nHistVectors, and OOFEM_ERROR.
Referenced by advanceSolution(), applyBoundaryCondition(), applyDefaultInitialCondition(), applyInitialCondition(), giveSolutionVector(), giveUnknownValue(), initialize(), readDofManager(), and storeDofManager().
|
virtual |
Restores the receiver state previously written in stream.
Reads the FEMComponent class-id in order to allow test consistency.
stream | Input stream. |
mode | Determines amount of info in stream (state, definition,...). |
Throws | an ContextIOERR exception if error encountered. |
Implements oofem::Field.
Reimplemented in oofem::DofDistributedPrimaryField.
Definition at line 541 of file primaryfield.C.
References actualStepIndx, actualStepNumber, oofem::CIO_IOERR, oofem::CIO_OK, emodel, nHistVectors, prescribedVectors, oofem::DataStream::read(), solStepList, solutionVectors, and THROW_CIOERR.
Referenced by oofem::CBS::restoreContext().
|
virtual |
Stores receiver state to output stream.
Writes the FEMComponent class-id in order to allow test whether correct data are then restored.
stream | Output stream. |
mode | Determines amount of info in stream (state, definition,...). |
Throws | an ContextIOERR exception if error encountered. |
Implements oofem::Field.
Reimplemented in oofem::DofDistributedPrimaryField.
Definition at line 507 of file primaryfield.C.
References actualStepIndx, actualStepNumber, oofem::CIO_IOERR, oofem::CIO_OK, prescribedVectors, solStepList, solutionVectors, THROW_CIOERR, and oofem::DataStream::write().
Referenced by oofem::CBS::saveContext().
void oofem::PrimaryField::storeDofManager | ( | TimeStep * | tStep, |
DofManager & | dman | ||
) |
Definition at line 65 of file primaryfield.C.
References oofem::FloatArray::at(), givePrescribedVector(), oofem::TimeStep::givePreviousStep(), giveSolutionVector(), nHistVectors, and resolveIndx().
Referenced by storeInDofDictionaries().
void oofem::PrimaryField::storeInDofDictionaries | ( | TimeStep * | tStep | ) |
Definition at line 84 of file primaryfield.C.
References domainIndx, emodel, oofem::Domain::giveBcs(), oofem::Domain::giveDofManagers(), oofem::EngngModel::giveDomain(), oofem::Domain::giveElements(), and storeDofManager().
|
virtual |
Project vectorToStore back to DOF's dictionary.
vectorToStore | Vector with the size of number of equations. |
mode | Mode of the unknown (increment, total value etc.) |
tStep | Time step unknowns belong to. |
Reimplemented in oofem::DofDistributedPrimaryField.
Definition at line 309 of file primaryfield.C.
References oofem::__ValueModeTypeToString(), giveSolutionVector(), and OOFEM_ERROR.
|
protected |
Definition at line 108 of file primaryfield.h.
Referenced by advanceSolution(), PrimaryField(), resolveIndx(), restoreContext(), and saveContext().
|
protected |
Definition at line 107 of file primaryfield.h.
Referenced by advanceSolution(), PrimaryField(), resolveIndx(), restoreContext(), and saveContext().
|
protected |
Definition at line 114 of file primaryfield.h.
Referenced by __evaluateAt(), oofem::DofDistributedPrimaryField::applyBoundaryCondition(), applyBoundaryCondition(), oofem::DofDistributedPrimaryField::applyDefaultInitialCondition(), applyDefaultInitialCondition(), oofem::DofDistributedPrimaryField::initialize(), PrimaryField(), readFromDofDictionaries(), storeInDofDictionaries(), and oofem::DofDistributedPrimaryField::update().
|
protected |
Definition at line 113 of file primaryfield.h.
Referenced by __evaluateAt(), oofem::DofDistributedPrimaryField::advanceSolution(), oofem::DofDistributedPrimaryField::applyBoundaryCondition(), applyBoundaryCondition(), oofem::DofDistributedPrimaryField::applyDefaultInitialCondition(), applyDefaultInitialCondition(), oofem::DofDistributedPrimaryField::applyInitialCondition(), applyInitialCondition(), oofem::DofDistributedPrimaryField::initialize(), PrimaryField(), readFromDofDictionaries(), restoreContext(), storeInDofDictionaries(), and oofem::DofDistributedPrimaryField::update().
|
protected |
Definition at line 109 of file primaryfield.h.
Referenced by advanceSolution(), givePrescribedVector(), giveSolutionVector(), PrimaryField(), readDofManager(), resolveIndx(), restoreContext(), and storeDofManager().
|
protected |
Definition at line 111 of file primaryfield.h.
Referenced by applyDefaultInitialCondition(), givePrescribedVector(), restoreContext(), and saveContext().
|
protected |
Definition at line 112 of file primaryfield.h.
Referenced by advanceSolution(), restoreContext(), and saveContext().
|
protected |
Definition at line 110 of file primaryfield.h.
Referenced by applyDefaultInitialCondition(), giveSolutionVector(), restoreContext(), and saveContext().