OOFEM 3.0
Loading...
Searching...
No Matches
oofem::PrimaryField Class Reference

#include <primaryfield.h>

Inheritance diagram for oofem::PrimaryField:
Collaboration diagram for oofem::PrimaryField:

Public Member Functions

 PrimaryField (EngngModel *a, int idomain, FieldType ft, int nHist)
virtual ~PrimaryField ()
virtual void initialize (ValueModeType mode, TimeStep *tStep, FloatArray &answer, const UnknownNumberingScheme &s)
void storeDofManager (TimeStep *tStep, DofManager &dman)
void storeInDofDictionaries (TimeStep *tStep)
void readDofManager (TimeStep *tStep, DofManager &dman)
void readFromDofDictionaries (TimeStep *tStep)
virtual void applyDefaultInitialCondition ()
void applyInitialCondition (InitialCondition &ic)
virtual void applyBoundaryCondition (TimeStep *tStep)
void applyBoundaryCondition (BoundaryCondition &bc, TimeStep *tStep)
virtual double giveUnknownValue (Dof *dof, ValueModeType mode, TimeStep *tStep)
int evaluateAt (FloatArray &answer, const FloatArray &coords, ValueModeType mode, TimeStep *tStep) override
int evaluateAt (FloatArray &answer, DofManager *dman, ValueModeType mode, TimeStep *tStep) override
virtual int __evaluateAt (FloatArray &answer, DofManager *dman, ValueModeType mode, TimeStep *tStep, IntArray *dofId)
virtual int __evaluateAt (FloatArray &answer, const FloatArray &coords, ValueModeType mode, TimeStep *tStep, IntArray *dofId)
virtual FloatArraygiveSolutionVector (TimeStep *tStep)
virtual void update (ValueModeType mode, TimeStep *tStep, const FloatArray &vectorToStore, const UnknownNumberingScheme &s)
virtual void advanceSolution (TimeStep *tStep)
void saveContext (DataStream &stream) override
void restoreContext (DataStream &stream) override
const char * giveClassName () const override
int giveActualStepNumber ()
Public Member Functions inherited from oofem::Field
 Field (FieldType b=FieldType::FT_Unknown)
virtual ~Field ()
virtual int evaluateAt (FloatArray &answer, Element *elem, ValueModeType mode, TimeStep *tStep)
FieldType giveType ()
 Returns the type of receiver.
void setType (FieldType b)
 Sets the type of receiver.
void setSetsNumbers (const IntArray sets)
 Defines a list of sets used to impose a field on specific elements.
virtual bool hasElementInSets (int nElem, Domain *d)
 Searches if element number exist in IntArray regionSets for given domain.
std::string errorInfo (const char *func) const
 Returns string for prepending output (used by error reporting macros).
virtual void initializeFrom (InputRecord &ir)

Protected Member Functions

int resolveIndx (TimeStep *tStep, int shift)
FloatArraygiveSolutionVector (int)
FloatArraygivePrescribedVector (int)

Protected Attributes

int actualStepNumber
int actualStepIndx
int nHistVectors
std ::vector< FloatArraysolutionVectors
std ::vector< FloatArrayprescribedVectors
std ::vector< TimeStepsolStepList
EngngModelemodel
int domainIndx
Protected Attributes inherited from oofem::Field
FieldType type
IntArray regionSets

Detailed Description

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.

Note
This primary field will always assume default numbering schemes.

Definition at line 104 of file primaryfield.h.

Constructor & Destructor Documentation

◆ PrimaryField()

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).

Parameters
aEngineering model which field belongs to.
idomainIndex of domain for field.
ftType of stored field.
nHistNumber of old time steps to store.

Definition at line 49 of file primaryfield.C.

References actualStepIndx, actualStepNumber, domainIndx, emodel, oofem::Field::Field(), nHistVectors, prescribedVectors, solStepList, and solutionVectors.

◆ ~PrimaryField()

oofem::PrimaryField::~PrimaryField ( )
virtual

Definition at line 60 of file primaryfield.C.

Member Function Documentation

◆ __evaluateAt() [1/2]

int oofem::PrimaryField::__evaluateAt ( FloatArray & answer,
const FloatArray & coords,
ValueModeType mode,
TimeStep * tStep,
IntArray * dofId )
virtual

Evaluates the field at given point, allows to select specific dofs using mask.

Parameters
answerEvaluated field at coords.
coordsCoordinates of the point of interest.
modeMode of evaluated unknowns.
tStepTime step of interest.
dofIdDof mask, id set to NULL, all Dofs evaluated.
Returns
Error code (0=ok, 1=point not found in domain)

Definition at line 372 of file primaryfield.C.

References oofem::FloatArray::at(), oofem::IntArray::at(), oofem::Element::computeField(), domainIndx, oofem::EIPrimaryFieldInterfaceType, emodel, oofem::IntArray::findFirstIndexOf(), 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().

◆ __evaluateAt() [2/2]

int oofem::PrimaryField::__evaluateAt ( FloatArray & answer,
DofManager * dman,
ValueModeType mode,
TimeStep * tStep,
IntArray * dofId )
virtual

Evaluates the field at given DOF manager, allows to select specific dofs using mask

Parameters
answerEvaluated field at dman.
dmanDOF manager of interest.
modeMode of evaluated unknowns.
tStepTime step of interest.
dofIdDof mask, id set to NULL, all Dofs evaluated.
Returns
Error code (0=ok, 1=point not found in domain).

Definition at line 352 of file primaryfield.C.

References __evaluateAt(), domainIndx, oofem::DofManager::giveCompleteUnknownVector(), oofem::DofManager::giveCoordinates(), oofem::FEMComponent::giveDomain(), and oofem::DofManager::giveUnknownVector().

Referenced by __evaluateAt(), evaluateAt(), and evaluateAt().

◆ advanceSolution()

void oofem::PrimaryField::advanceSolution ( TimeStep * tStep)
virtual

Brings up a new solution vector for given time step.

Parameters
tStepTime step for new solution vector.

Definition at line 485 of file primaryfield.C.

References actualStepIndx, actualStepNumber, oofem::TimeStep::giveNumber(), givePrescribedVector(), giveSolutionVector(), nHistVectors, OOFEM_ERROR, resolveIndx(), and solStepList.

◆ applyBoundaryCondition() [1/2]

void oofem::PrimaryField::applyBoundaryCondition ( BoundaryCondition & bc,
TimeStep * tStep )

◆ applyBoundaryCondition() [2/2]

void oofem::PrimaryField::applyBoundaryCondition ( TimeStep * tStep)
virtual

◆ applyDefaultInitialCondition()

void oofem::PrimaryField::applyDefaultInitialCondition ( )
virtual

◆ applyInitialCondition()

◆ evaluateAt() [1/2]

int oofem::PrimaryField::evaluateAt ( FloatArray & answer,
const FloatArray & coords,
ValueModeType mode,
TimeStep * tStep )
overridevirtual

Evaluates the field at given point.

Parameters
coordsCoordinates of the point of interest
answerField evaluated at coordinate.
tStepTime step to evaluate for.
modeMode of value (total, velocity,...).
Returns
Zero if ok, otherwise nonzero.

Implements oofem::Field.

Definition at line 429 of file primaryfield.C.

References __evaluateAt().

◆ evaluateAt() [2/2]

int oofem::PrimaryField::evaluateAt ( FloatArray & answer,
DofManager * dman,
ValueModeType mode,
TimeStep * tStep )
overridevirtual

Evaluates the field at given DofManager. This potentially can be resolved quickly, as receiver data may be described using values at dofManagers. Here an additional issue exists: one needs to make sure, that passed dman is from the same domain, so that its number can be used to perform suggested quick evaluation.

If this is not the case (the field is described differently), the response can be evaluated using dofman coordinates in a standard way.

Parameters
[out]answerEvaluated field for dman.
dmanReference to dofManager.
modeMode of value (total, velocity,...).
tStepTime step to evaluate for.
Returns
Zero if ok, nonzero Error code (0-ok, 1-failed)

Implements oofem::Field.

Definition at line 437 of file primaryfield.C.

References __evaluateAt().

◆ giveActualStepNumber()

int oofem::PrimaryField::giveActualStepNumber ( )
inline

Definition at line 226 of file primaryfield.h.

References actualStepNumber.

◆ giveClassName()

const char * oofem::PrimaryField::giveClassName ( ) const
inlineoverridevirtual
Returns
Class name of the receiver.

Implements oofem::Field.

Definition at line 224 of file primaryfield.h.

◆ givePrescribedVector()

◆ giveSolutionVector() [1/2]

FloatArray * oofem::PrimaryField::giveSolutionVector ( int i)
protected

Definition at line 451 of file primaryfield.C.

References nHistVectors, OOFEM_ERROR, and solutionVectors.

◆ giveSolutionVector() [2/2]

FloatArray * oofem::PrimaryField::giveSolutionVector ( TimeStep * tStep)
virtual
Parameters
tStepTime step to take solution for.
Returns
Solution vector for requested time step.

Definition at line 445 of file primaryfield.C.

References giveSolutionVector(), and resolveIndx().

Referenced by advanceSolution(), applyDefaultInitialCondition(), applyInitialCondition(), giveSolutionVector(), giveUnknownValue(), initialize(), readDofManager(), storeDofManager(), and update().

◆ giveUnknownValue()

double oofem::PrimaryField::giveUnknownValue ( Dof * dof,
ValueModeType mode,
TimeStep * tStep )
virtual
Parameters
dofPointer to DOF.
modeWhat the unknown describes (increment, total value etc.).
tStepTime step of interest.
Returns
Value of interest at given DOF.
Todo
Clean this up, this is a hack for when we ask for the increment in the first step.

Definition at line 322 of file primaryfield.C.

References oofem::Dof::giveEqn(), givePrescribedVector(), giveSolutionVector(), OOFEM_ERROR, and resolveIndx().

Referenced by oofem::MasterDof::giveUnknown().

◆ initialize()

void oofem::PrimaryField::initialize ( ValueModeType mode,
TimeStep * tStep,
FloatArray & answer,
const UnknownNumberingScheme & s )
virtual

Copy unknowns from previous solution or DOF's dictionary to the solution vector

Parameters
modewhat the unknown describes (increment, total value etc.).
tStepTime of interest.
answerResulting vector.

Definition at line 154 of file primaryfield.C.

References giveSolutionVector(), OOFEM_ERROR, resolveIndx(), and oofem::FloatArray::subtract().

◆ readDofManager()

void oofem::PrimaryField::readDofManager ( TimeStep * tStep,
DofManager & dman )

◆ readFromDofDictionaries()

void oofem::PrimaryField::readFromDofDictionaries ( TimeStep * tStep)

◆ resolveIndx()

◆ restoreContext()

void oofem::PrimaryField::restoreContext ( DataStream & stream)
overridevirtual

Restores the receiver state previously written in stream.

Parameters
streamInput stream.
Exceptions
Throwsan ContextIOERR exception if error encountered.

Implements oofem::Field.

Definition at line 539 of file primaryfield.C.

References actualStepIndx, actualStepNumber, oofem::CIO_IOERR, oofem::CIO_OK, emodel, nHistVectors, prescribedVectors, oofem::DataStream::read(), solStepList, solutionVectors, and THROW_CIOERR.

◆ saveContext()

void oofem::PrimaryField::saveContext ( DataStream & stream)
overridevirtual

Stores receiver state to output stream.

Parameters
streamOutput stream.
Exceptions
Throwsan ContextIOERR exception if error encountered.

Implements oofem::Field.

Definition at line 509 of file primaryfield.C.

References actualStepIndx, actualStepNumber, oofem::CIO_IOERR, oofem::CIO_OK, prescribedVectors, solStepList, solutionVectors, THROW_CIOERR, and oofem::DataStream::write().

◆ storeDofManager()

void oofem::PrimaryField::storeDofManager ( TimeStep * tStep,
DofManager & dman )

◆ storeInDofDictionaries()

void oofem::PrimaryField::storeInDofDictionaries ( TimeStep * tStep)

◆ update()

void oofem::PrimaryField::update ( ValueModeType mode,
TimeStep * tStep,
const FloatArray & vectorToStore,
const UnknownNumberingScheme & s )
virtual

Project vectorToStore back to DOF's dictionary

Parameters
vectorToStoreVector with the size of number of equations.
modeMode of the unknown (increment, total value etc.)
tStepTime step unknowns belong to.

Definition at line 312 of file primaryfield.C.

References giveSolutionVector(), and OOFEM_ERROR.

Member Data Documentation

◆ actualStepIndx

int oofem::PrimaryField::actualStepIndx
protected

◆ actualStepNumber

int oofem::PrimaryField::actualStepNumber
protected

◆ domainIndx

int oofem::PrimaryField::domainIndx
protected

◆ emodel

◆ nHistVectors

int oofem::PrimaryField::nHistVectors
protected

◆ prescribedVectors

std :: vector< FloatArray > oofem::PrimaryField::prescribedVectors
protected

◆ solStepList

std :: vector< TimeStep > oofem::PrimaryField::solStepList
protected

Definition at line 112 of file primaryfield.h.

Referenced by advanceSolution(), PrimaryField(), restoreContext(), and saveContext().

◆ solutionVectors

std :: vector< FloatArray > oofem::PrimaryField::solutionVectors
protected

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

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011