FemProcess
The GeMA Fem Process Plugin
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GmpFemPhysics Class Referenceabstract

Base interface class for FEM Physics type plugins. More...

#include <gmpFemPhysics.h>

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

Public Types

enum  FemResultType { FEM_RESULT_OK, FEM_ERROR_FI, FEM_ERROR }
 Result type for local matrix calculation methods. More...
 
enum  FemSupportedParallelMethods { FEM_PARALLEL_FILL_ELEMENT_DATA = 0x01 }
 Enum used to specify which physics plugin methods can be called in parallel. Values can be ored together. More...
 

Public Member Functions

 GmpFemPhysics (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
 Constructor. More...
 
virtual ~GmpFemPhysics ()
 Virtual destructor.
 
GmElementMeshmesh () const
 Returns the element mesh that this physics object is tied to.
 
const GmCellGroupSetmeshGroupSet () const
 Returns the element group set used to traverse mesh elements belonging to the element groups that together define the physics spatial domain. More...
 
int numSupportedExternalLoads () const
 Returns the number of supported external load types by this physics. Based on the list returned by supportedExternalLoads()
 
const GmCellGroupSetexternalLoadGroupSet (int loadId) const
 Returns the element group set used to traverse mesh elements tied to the given external loads id. More...
 
const QMap< QString, const GmBoundaryCondition * > & boundaryConditions () const
 Returns a reference to the map storing contact boundary conditions associated to this physics, keyed by bc type.
 
const QMap< QString, const GmContactBoundaryCondition * > & contactBoundaryConditions () const
 
GmDiscontinuitySetdiscontinuitySet () const
 Returns the associated discontinuity set, NULL if there is none.
 
virtual bool checkPhysicsDependencies (const QList< GmpFemPhysics * > &physicsList, int index)
 A function called by the Fem solver, at its initialization, to let a physics check that it is compatible with the remaining physics used by the solver. More...
 
virtual bool dofByElement (bool *fixed=NULL, bool *addOnly=NULL, bool *trackChanges=NULL) const
 Returns false if degrees of freedom are mapped to nodes depending only on the element type, or true if elements of the same type can have different dof mappings. More...
 
virtual const GmElementDofdofMapping (GmCellType type) const =0
 Returns the mapping of node degrees of freedom for a cell type or NULL if this physics object does not know how to handle that type. More...
 
virtual const GmElementDofdofMapping (const GmElement *e) const
 Returns the mapping of node degrees of freedom for the given element or NULL if this physics object does not know how to handle it. More...
 
virtual Unit dofUnit (int dof) const =0
 Returns the unit in which calculated values for the supplied dof are given. Should return Unit() for unknown (to the physics) dof values.
 
virtual Unit timeUnit () const =0
 Returns the unit in which the physics handles time. Returns Unit() if not relevant to the physics.
 
virtual const QList< QPair< int, GmValueAccessor * > > & dofForceAttributes () const
 Returns a list that associates degrees of freedom handled by this physics with their associated force attributes. More...
 
virtual bool supportsCellType (GmCellType type) const =0
 Returns true if the type is supported by this physics object. More...
 
virtual bool supportsParallel (FemSupportedParallelMethods methodType) const
 Returns true if this physics object supports multiple calls in parallel (by multiple threads) to the referenced method. Returns false otherwise.
 
virtual bool beforeElementStiffnessLoop (const GmpFemMatrixSet &elemMatrices, const GmpFemVectorSet &elemVectors)
 Method called by the Fem process to notify the physical object that the assembly process will start. More...
 
virtual void afterElementStiffnessLoop ()
 Method called by the Fem process to notify the physical object that the assembly process has ended.
 
virtual FemResultType fillElementData (const GmElement *e, GmpFemMatrixSet &elemMatrices, GmpFemVectorSet &elemVectors)=0
 Method called by the FEM process, during the global matrix / vector assembly procedure to ask a physics object for the local contribution of the element 'e'. More...
 
virtual const QStringListsupportedBcTypes () const
 A list with names for the known boundary condition types supported by this physics. More...
 
virtual bool bcAffectsCalc (const GmBoundaryCondition *bc) const
 Method called by the FEM process asking the physics whether the supplied boundary condition affects the global stiffness matrix and or the global force vector. The function should return true if either is affected.
 
virtual FemResultType fillElementDataForBc (const GmElement *e, const GmBoundaryCondition *bc, int bcIndex, int bcListIndex, int border, GmpFemMatrixSet &elemMatrices, GmpFemVectorSet &elemVectors)
 Method called by the FEM process in a similar way as the call to fillElementData() for the physics to supply local element matrix and/or vector contributions due to the supplied boundary condition. More...
 
virtual bool fixedNodalForcesBc (QList< int > &nodes, QList< int > &dof, QList< double > &values) const
 Method called by the FEM process asking the physics to provide prescribed nodal force values that will be added to the global force vector f (the f vector in the global equation K.u = f). More...
 
virtual bool fixedNodalDofsBc (QList< int > &nodes, QList< int > &dof, QList< double > &values, bool *constantValues) const
 Method called by the FEM process asking the physics to provide fixed dof (state variable) values used to remove degrees of freedom from the system. Those fixed values correspond to fixed u values in the global equation K.u = f. More...
 
virtual const QStringListsupportedContactBcTypes () const
 A list with names for the known contact boundary condition types supported by this physics. More...
 
virtual FemResultType fillContactData (const GmContactBoundaryCondition *cbc, int bcIndex1, int bcIndex2, GmMatrixDof &dofMap, GmpFemMatrixSet &matrixSet, GmpFemVectorSet &vecSet)
 Method called by the FEM process in a similar way as the call to fillElementData() for the physics to supply local matrix and vector contributions due to the supplied contact pair. More...
 
virtual const QStringListsupportedExternalLoads () const
 A list with names for the known external load conditions supported by this physics. More...
 
virtual FemResultType fillElementDataForLoads (const GmElement *e, int loadId, GmpFemVectorSet &elemVectors)
 Method called by the FEM process in a similar way as the call to fillElementData() for the physics to supply local element vector contributions due to the supplied external load. More...
 
virtual bool calcDerivedResults (bool nonLinearSolver)
 Method called after the the system solution asking each physics to calculate derived results based on the solution (which has already been saved to the appropriate state variables) More...
 
virtual bool supportsStateDumping ()
 Method called by the solver to check if this physics supports state dumping and restoring. For this to be true, the physics must be able to save all its needed internal state upon a dump and recover it later using the next virtual calls.
 
virtual bool addStateItemsToGroup (GmStateDump *state, bool fixedHint, int groupId)
 Initialization method, called once, allowing the object to add its state items to the given group of the sate dump object. More...
 
virtual bool fillStateControlMapData (QVariantMap *map)
 Virtual method called just before the solver control map is saved to the state. Should be used to fill the map with the needed physics data. Returning false aborts the operation.
 
virtual bool stateControlMapDataLoaded (QVariantMap *map)
 Virtual method called just after the solver control map was loaded from the state. Should be used to load map data into the physics. Differently from stateLoaded(), which is called after the whole dump file was processed, this method is called just after the control map was read, and before any other solve dump items are read. Returning false aborts the operation.
 
virtual bool stateAboutToBeSaved (GmStateDump *state)
 Virtual method called just before starting a save operation on the given state. Returning false aborts the operation.
 
virtual bool stateSaved (GmStateDump *state)
 Virtual method called just after succesfully completing a save operation on the given state. Returning false aborts the operation.
 
virtual bool stateAboutToBeLoaded (GmStateDump *state)
 Virtual method called just before starting a load operation on the given state. Returning false aborts the operation.
 
virtual bool stateLoaded (GmStateDump *state)
 Virtual method called just after succesfully completing a load operation on the given state. Returning false aborts the operation.
 
virtual QList< int > changedElements () const
 Method called by the assembler to obtain the list of elements that had their dofs changed since the physics was created or the last call to clearChangedElements(). In the list, elements are represented by their ids. More...
 
virtual void clearChangedElements ()
 Method called by the assembler to clear the internal list used to track dof changes. See comments on changedElements().
 
const GmIntegrationRuleelementIntegrationRule (GmCellType type) const
 Returns the integration rule associated with the received element type.
 
const GmBorderIntegrationRuleborderIntegrationRule (GmCellType type, int borderIndex) const
 Returns the integration rule associated with a border (face / edge) of the received element type. More...
 
const GmBorderIntegrationRulefaceIntegrationRule (GmCellType type, int faceIndex) const
 Returns the face integration rule associated with the received element type.
 
const GmBorderIntegrationRuleedgeIntegrationRule (GmCellType type) const
 Returns the edge integration rule associated with the received element type.
 
int integrationRuleSet () const
 Returns the integration rule set in use by this physics object.
 
bool setIntegrationRuleSet (int ruleSet)
 Sets the integration rule set used by this physics. Returns true if the named ruleSet doesn't exists in the mesh.
 
virtual bool loadPrivateData (LuaTable &table)
 Reimplements loadPrivateData() to parse attributes common to all FEM physics objects, calling an extra set of virtual functions as needed. More...
 
virtual void printParameters (const GmLogCategory &logger)
 Asks the object to print its parameters using the provided logger.
 
- Public Member Functions inherited from GmPhysics
 GmPhysics (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
 
virtual const char * pluginCategory () const
 
GmCellAccessorpropertyAccessor (GmCellMesh *mesh, QString stdPropertyName, QString msgDescription, LuaTable &table, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, bool canBeFunction=true, bool ignoreWarnings=false)
 
GmCellAccessorextPropertyAccessor (GmCellMesh *mesh, QString stdPropertyName, QString msgDescription, LuaTable &table, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, bool canBeFunction=true, bool ignoreWarnings=false)
 
GmDiscontinuityAccessordiscontinuityPropertyAccessor (GmDiscontinuitySet *discSet, QString stdPropertyName, QString msgDescription, LuaTable &table, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, bool ignoreWarnings=false)
 
GmDiscontinuityAccessorextDiscontinuityPropertyAccessor (GmDiscontinuitySet *discSet, QString stdPropertyName, QString msgDescription, LuaTable &table, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, bool ignoreWarnings=false)
 
- Public Member Functions inherited from GmPluginObject
 GmPluginObject (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
 
QString id () const
 
QString description () const
 
QString pluginTypeName () const
 
virtual const char * pluginName () const=0
 
virtual const char * pluginType () const=0
 

Protected Member Functions

virtual bool checkMeshDimension (int ndim)=0
 This function is called by loadPrivateData() to let the phyiscs check if it is compatible with the number of dimensions of mesh node coordinates. The parameter ndim is the number o dimensions per node coordinate for the associated mesh. More...
 
virtual bool checkAndLoadPrivateData (LuaTable &table)=0
 This function is called by loadPrivateData() to let derived classes check consistency and load values private to its implementation. More...
 
virtual bool checkAndLoadDofMapping (LuaTable &table)=0
 This function is called by loadPrivateData() and should be implemented in derived classes to prepare the list of degrees of freedom returned by dofMapping(). It should consider eventual state variable name translations present in the stateVars table received as parameter. More...
 
virtual bool checkAndLoadPropertyAccessors (LuaTable &table)=0
 This function is called by loadPrivateData() and should be implemented in derived classes to check if all needed properties are present before beggining calculations. It should consider eventual property name translations present in the properties table received as parameter. More...
 
virtual bool checkAndLoadAttributeAccessors (LuaTable &nodeTable, LuaTable &gaussTable)=0
 This function is called by loadPrivateData() and should be implemented in derived classes to check if all needed node and Gauss attributes are present before beggining calculations. It should consider eventual attribute name translations present in the node and Gauss attribute tables received as parameter. More...
 
virtual bool checkAndLoadExternalLoadAccessors (LuaTable &loadsTable)=0
 This function is called by loadPrivateData() and should be implemented in derived classes to check if all needed node attributes storing external loads are present. More...
 
virtual bool checkAndLoadBcAccessors ()=0
 This function is called by loadPrivateData() and should be implemented in derived classes to check if all needed boundary conditions are present before beggining calculations. More...
 
virtual bool checkAndLoadContactBcAccessors ()=0
 This function is called by loadPrivateData() and should be implemented in derived classes to check if all needed contact boundary conditions are present before beggining calculations. More...
 
virtual bool checkAndLoadDiscontinuitySetAccessors (LuaTable &table)=0
 This function is called by loadPrivateData() and should be implemented in derived classes to check if all needed discontinuity set data is present. It should consider eventual property name translations present in the properties table received as parameter. This is tha SAME table used for standard property name translation. More...
 
GmGaussAccessorgaussAttributeAccessor (GmElementMesh *mesh, QString stdAttributeName, QString msgDescription, LuaTable &table, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, int history=-1, bool canBeFunction=true, bool create=false, QString createFormat="", int createHistory=-1, bool ignoreWarnings=false)
 Similar to GmPhysics::propertyAccessor() returning a Gauss point attribute. The history parameter defines a restriction on the attribute history value (a -1 means that any history type is allowed). If the last parameter (create) is true, the attribute is required and if not found in the mesh, it will be created by the function (and its numeric format will be set to the value given by createFormat if not empty, using createHistory states) More...
 
virtual GmGaussAccessorcreateGaussAttributeAccessor (GmElementMesh *mesh, QString id, int snum, bool locked, Unit desiredUnit, const GmLogCategory &logger) const
 A virtual function called by gaussAttributeAccessor() to get the returned Gauss accessor. Exists to allow derived classes to work with a different accessor class derived from GmGaussAccessor. This is particulary important for the XFem plugin.
 
- Protected Member Functions inherited from GmPhysics
GmCellAccessorelementAttributeAccessor (GmCellMesh *mesh, QString stdAttributeName, QString msgDescription, LuaTable &table, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, int history=-1, bool canBeFunction=true, bool create=false, QString createFormat="", int createHistory=-1, bool ignoreWarnings=false)
 
GmValueAccessornodeAttributeAccessor (GmCellMesh *mesh, QString stdAttributeName, QString msgDescription, LuaTable &table, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, int history=-1, bool canBeFunction=true, bool create=false, QString createFormat="", int createHistory=-1, bool ignoreWarnings=false)
 
GmValueAccessornodeDataAccessor (GmCellMesh *mesh, QString stdAttributeName, QString msgDescription, LuaTable &table, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, int history=-1, bool canBeFunction=true, bool ignoreWarnings=false)
 
GmBoundaryConditionAccessorboundaryAccessor (const GmBoundaryCondition *bc, QString stdPropertyName, QString msgDescription, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, bool canBeFunction=true, bool ignoreWarnings=false)
 
GmContactBoundaryConditionAccessorcontactAccessor (const GmContactBoundaryCondition *bc, QString stdPropertyName, QString msgDescription, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, bool canBeFunction=true, bool ignoreWarnings=false)
 
QString dofFromStateVar (const GmCellMesh *mesh, QString stdStateVarName, QString msgDescription, LuaTable &table, QList< int > &dofList, Unit resultUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, bool ignoreWarnings=false)
 
- Protected Member Functions inherited from GmPluginObject
virtual const GmLogCategorylogger () const
 
GmSimulationDatasimulationData () const
 

Protected Attributes

GmElementMesh_mesh
 The mesh that this physics is bound to.
 
const GmCellGroupSet_gs
 The element group set used to traverse the mesh elements that form the physics spatial domain.
 
int _intRuleSet
 The integration rule set used by this physics.
 
GmDiscontinuitySet_discSet
 The discontinuity set, NULL if none was associated.
 
QMap< QString, const GmBoundaryCondition * > _bcMap
 A map storing boundary conditions associated to this physics, keyed by bc type.
 
QMap< QString, const GmContactBoundaryCondition * > _cbcMap
 A map storing contact boundary conditions associated to this physics, keyed by bc type.
 
QVector< const GmCellGroupSet * > _externalLoadGroupSets
 Element group sets for each active external loads or NULL for inactive ones. Indexed in the same order as the names returned by supportedExternalLoads(). Contains NULL if an external load is not configured for this physics.
 

Detailed Description

Base interface class for FEM Physics type plugins.

Besides beeing an interface that defines the set of virtual functions that must be implemented by every derived FEM based physics objects, this class provides some default handling for aspects of a FEM code common to all physics.

This include associating the physics object to an element mesh, defining integration rules or setting up name translations for state variables or needed properties.

Most of this handling is done by the provided loadPrivateData() virtual function that handles default attributes, calling it's own set of virtual functions as needed (see comments for this class implementation of loadPrivateData()).

IMPORTANT: For the current implementation of loadPrivateData() to work, it's imperative that the physics object table includes an attribute named 'type' with value equal to 'fem'. This is needed by the Lua code to identify that some checks are in order when parsing this kind of physics, and should be CHECKED BY DERIVED plugins in their Lua validation functions.

Common parameters handled by loadPrivateData():

Member Enumeration Documentation

◆ FemResultType

Result type for local matrix calculation methods.

Enumerator
FEM_RESULT_OK 

The method finished correctly.

FEM_ERROR_FI 

The method finished by unexpected error assembling Fi.

FEM_ERROR 

The method finished due to an unexpected error.

◆ FemSupportedParallelMethods

Enum used to specify which physics plugin methods can be called in parallel. Values can be ored together.

Enumerator
FEM_PARALLEL_FILL_ELEMENT_DATA 

The fillElementData() and the dofMapping() plugin methods can be called in parallel.

Constructor & Destructor Documentation

◆ GmpFemPhysics()

GmpFemPhysics::GmpFemPhysics ( GmSimulationData simulation,
QString  id,
QString  description,
const GmLogCategory logger 
)

Constructor.

Parameters
simulationReference to the simulation object.
idPhysics id.
descriptionPhysics description.
loggerPlugin logger object used to emmit messages

Member Function Documentation

◆ addStateItemsToGroup()

virtual bool GmpFemPhysics::addStateItemsToGroup ( GmStateDump state,
bool  fixedHint,
int  groupId 
)
inlinevirtual

Initialization method, called once, allowing the object to add its state items to the given group of the sate dump object.

Should return false on error, using the state logger to explain it.

◆ beforeElementStiffnessLoop()

virtual bool GmpFemPhysics::beforeElementStiffnessLoop ( const GmpFemMatrixSet elemMatrices,
const GmpFemVectorSet elemVectors 
)
inlinevirtual

Method called by the Fem process to notify the physical object that the assembly process will start.

After this function has been called, a series of calls to fillElementData() and fillElementDataForBc() will be made. This method is usefull to allocate auxiliary memory or to instanciate needed accessors, actions that can be done only once for the whole set of elements.

The supplied matrix and vector set parameters can be used by the physics to query which matrix / vectors the calling process is expecting the physics to fill in at later calls to fillElementData() / fillElementDataForBc().

Particularly, they can be used in this function for caching the result of translating matrix/vector type names given by GmpFemMatrixTypes / GmpFemVectorTypes into their positions in the set. You should NOT use those sets to fill or query matrices at this time.

In the event of errors, the function should log a message with its logger and return false to indicate that the assembly process should be aborted.

Reimplemented in GmpFemPhysicsCoupled.

◆ borderIntegrationRule()

const GmBorderIntegrationRule * GmpFemPhysics::borderIntegrationRule ( GmCellType  type,
int  borderIndex 
) const

Returns the integration rule associated with a border (face / edge) of the received element type.

For 2D elements it is equivalent to edgeIntegrationRule() and for 3D elements to faceIntegrationRule(). This function is undefined for line elements. It can be used for building generic code that works for both 2D and 3D elements.

◆ calcDerivedResults()

virtual bool GmpFemPhysics::calcDerivedResults ( bool  nonLinearSolver)
inlinevirtual

Method called after the the system solution asking each physics to calculate derived results based on the solution (which has already been saved to the appropriate state variables)

The nonLinearSolver parameter warns the physics if it was used by a non-linear solver or not. In non-linear settings, sometimes a physics can already have calculated derived results when recovering internal forces and so these results might not need to be calculated again.

In the event of errors, the function should log a message with its logger and return false to indicate the error.

◆ changedElements()

virtual QList<int> GmpFemPhysics::changedElements ( ) const
inlinevirtual

Method called by the assembler to obtain the list of elements that had their dofs changed since the physics was created or the last call to clearChangedElements(). In the list, elements are represented by their ids.

This function will be called only if dofByElement() returned true AND also filled the trackChanges flag with true.

◆ checkAndLoadAttributeAccessors()

virtual bool GmpFemPhysics::checkAndLoadAttributeAccessors ( LuaTable nodeTable,
LuaTable gaussTable 
)
protectedpure virtual

This function is called by loadPrivateData() and should be implemented in derived classes to check if all needed node and Gauss attributes are present before beggining calculations. It should consider eventual attribute name translations present in the node and Gauss attribute tables received as parameter.

In order to be more efficient, a physics iplementation should consider using this function to retrieve and store the needed accessors for use by the stiffness calculation routines.

If errors are found that prevent the use of the physics object, this function should log an error message and return false.

Obs: The GmPhysics::nodeAttributeAccessor() and GmFemPhysics::gaussAttributeAccessor() functions can be a great help while implementing this function

Implemented in GmpFemPhysicsCommon, and GmpFemPhysicsCoupled.

◆ checkAndLoadBcAccessors()

virtual bool GmpFemPhysics::checkAndLoadBcAccessors ( )
protectedpure virtual

This function is called by loadPrivateData() and should be implemented in derived classes to check if all needed boundary conditions are present before beggining calculations.

When this function is called, boundary conditions associated to this physics object are already present in the _bcMap object attribute.

In order to be more efficient, a physics iplementation should consider using this function to retrieve and store the needed accessors for use by the stiffness calculation routines.

If errors are found that prevent the use of the physics object, this function should log an error message and return false.

Implemented in GmpFemPhysicsCommon, and GmpFemPhysicsCoupled.

◆ checkAndLoadContactBcAccessors()

virtual bool GmpFemPhysics::checkAndLoadContactBcAccessors ( )
protectedpure virtual

This function is called by loadPrivateData() and should be implemented in derived classes to check if all needed contact boundary conditions are present before beggining calculations.

When this function is called, contact boundary conditions associated to this physics object are already present in the _cbcMap object attribute.

In order to be more efficient, a physics iplementation should consider using this function to retrieve and store the needed accessors for use by the stiffness calculation routines.

If errors are found that prevent the use of the physics object, this function should log an error message and return false.

Implemented in GmpFemPhysicsCommon, and GmpFemPhysicsCoupled.

◆ checkAndLoadDiscontinuitySetAccessors()

virtual bool GmpFemPhysics::checkAndLoadDiscontinuitySetAccessors ( LuaTable table)
protectedpure virtual

This function is called by loadPrivateData() and should be implemented in derived classes to check if all needed discontinuity set data is present. It should consider eventual property name translations present in the properties table received as parameter. This is tha SAME table used for standard property name translation.

When this function is called, the discontinuity set associated to this physics object, if any, is already present in the _discSet field.

In order to be more efficient, a physics iplementation should consider using this function to retrieve and store the needed accessors for use by the stiffness calculation routines.

If errors are found that prevent the use of the physics object, this function should log an error message and return false.

Implemented in GmpFemPhysicsCommon.

◆ checkAndLoadDofMapping()

virtual bool GmpFemPhysics::checkAndLoadDofMapping ( LuaTable table)
protectedpure virtual

This function is called by loadPrivateData() and should be implemented in derived classes to prepare the list of degrees of freedom returned by dofMapping(). It should consider eventual state variable name translations present in the stateVars table received as parameter.

If errors are found that prevent the use of the physics object, this function should log an error message and return false.

Obs: The function GmPhysics::dofFromStateVar() can be a great help while implementing this function

Implemented in GmpFemPhysicsCommon, and GmpFemPhysicsCoupled.

◆ checkAndLoadExternalLoadAccessors()

virtual bool GmpFemPhysics::checkAndLoadExternalLoadAccessors ( LuaTable loadsTable)
protectedpure virtual

This function is called by loadPrivateData() and should be implemented in derived classes to check if all needed node attributes storing external loads are present.

When this function is called, group sets corresponding to requested external loads are already filled in _externalLoadGroupSets, and their presence (not NULL) should be used to define which external load types will be considered in the analysis.

In order to be more efficient, a physics iplementation should consider using this function to retrieve and store the needed accessors for use by the external load contribution routine.

If errors are found that prevent the use of the physics object, this function should log an error message and return false.

Implemented in GmpFemPhysicsCommon.

◆ checkAndLoadPrivateData()

virtual bool GmpFemPhysics::checkAndLoadPrivateData ( LuaTable table)
protectedpure virtual

This function is called by loadPrivateData() to let derived classes check consistency and load values private to its implementation.

If errors are found that prevent the use of the physics object, this function should log an error message and return false.

Implemented in GmpFemPhysicsCommon, and GmpFemPhysicsCoupled.

◆ checkAndLoadPropertyAccessors()

virtual bool GmpFemPhysics::checkAndLoadPropertyAccessors ( LuaTable table)
protectedpure virtual

This function is called by loadPrivateData() and should be implemented in derived classes to check if all needed properties are present before beggining calculations. It should consider eventual property name translations present in the properties table received as parameter.

In order to be more efficient, a physics iplementation should consider using this function to retrieve and store the needed accessors for use by the stiffness calculation routines.

If errors are found that prevent the use of the physics object, this function should log an error message and return false.

Obs: The function GmPhysics::propertyAccessor() can be a great help while implementing this function

Implemented in GmpFemPhysicsCommon, and GmpFemPhysicsCoupled.

◆ checkMeshDimension()

virtual bool GmpFemPhysics::checkMeshDimension ( int  ndim)
protectedpure virtual

This function is called by loadPrivateData() to let the phyiscs check if it is compatible with the number of dimensions of mesh node coordinates. The parameter ndim is the number o dimensions per node coordinate for the associated mesh.

If errors are found that prevent the use of the physics object, this function should log an error message and return false.

Implemented in GmpFemPhysicsCommon.

◆ checkPhysicsDependencies()

virtual bool GmpFemPhysics::checkPhysicsDependencies ( const QList< GmpFemPhysics * > &  physicsList,
int  index 
)
inlinevirtual

A function called by the Fem solver, at its initialization, to let a physics check that it is compatible with the remaining physics used by the solver.

If incompatible, this function should return false an print an error message using the physics logger. It gets as parameters the physics list used by the solver and its own index inside the physics list.

◆ dofByElement()

virtual bool GmpFemPhysics::dofByElement ( bool *  fixed = NULL,
bool *  addOnly = NULL,
bool *  trackChanges = NULL 
) const
inlinevirtual

Returns false if degrees of freedom are mapped to nodes depending only on the element type, or true if elements of the same type can have different dof mappings.

If this function returns true, it should also fill the given parameters 'fixed', 'addOnly' and, 'trackChanges' if the given pointers are different from NULL. The first one, 'fixed', should tell if the per element dof mapping changes over time or is fixed. If changing (fixed == false), the second parameter, 'addOnly', should be set to true if those changes consists only in adding new degrees of freedom or false if they might also remove dofs from elements. The third parameter should be set to true if the physics can track the elements that had their dofs changed, as reported by changedElements().

◆ dofForceAttributes()

virtual const QList<QPair<int, GmValueAccessor*> >& GmpFemPhysics::dofForceAttributes ( ) const
inlinevirtual

Returns a list that associates degrees of freedom handled by this physics with their associated force attributes.

This list is not required. If the force attribute is multidimensional, it should appear in the list once with its base dof. List accessors should remain valid through the life of the physics.

Reimplemented in GmpFemPhysicsCommon.

◆ dofMapping() [1/2]

virtual const GmElementDof* GmpFemPhysics::dofMapping ( GmCellType  type) const
pure virtual

Returns the mapping of node degrees of freedom for a cell type or NULL if this physics object does not know how to handle that type.

The returned pointer should be valid during the whole physics life time. This function is called often and must have an efficient implementation based on pre-stored GmElementDof objects.

Results from dofMapping() should be consistent with results from supportsCellType(), i.e. there must exist a 1:1 mapping between types where supportsCellType() returns true and non NULL pointers returned by dofMapping().

This function is NOT called by the assembler directly. If dofByElement() returned false, it will be called by the default implementation of dofMapping(const GmElement*).

IMPORTANT: This function should NOT be called at all if dofByElement() returned true.

IMPORTANT2: This function MUST be thread-safe if supportsParallel() returns true for most of the FemSupportedParallelMethods enum options.

Implemented in GmpFemPhysicsCommon.

◆ dofMapping() [2/2]

virtual const GmElementDof* GmpFemPhysics::dofMapping ( const GmElement e) const
inlinevirtual

Returns the mapping of node degrees of freedom for the given element or NULL if this physics object does not know how to handle it.

The returned pointer should be valid during the whole physics life time. This function is called often and must have an efficient implementation based on pre-stored GmElementDof objects.

Results from dofMapping() should be consistent with results from supportsCellType(), i.e. if supportsCellType() returns false, all calls to dofMapping() with elements of this type should return NULL. On the other hand, if it returns true, there should exist at least one element of this type for which dofMapping() returns a non NULL pointer.

Its default implementation simply calls dofMapping(GmCellType).

IMPORTANT: This function MUST be thread-safe if supportsParallel() returns true for most of the FemSupportedParallelMethods enum options.

◆ externalLoadGroupSet()

const GmCellGroupSet* GmpFemPhysics::externalLoadGroupSet ( int  loadId) const
inline

Returns the element group set used to traverse mesh elements tied to the given external loads id.

Even if the domain is the entire mesh, a group set referencing all mesh elements will be returned by this function in order to allow for a more general code, but it will return NULL if the give external load is not configured for this physics. Load id orders are defined by the order in the list returned by supportedExternalLoads()Returns a reference to the map storing boundary conditions associated to this physics, keyed by bc type

◆ fillContactData()

virtual FemResultType GmpFemPhysics::fillContactData ( const GmContactBoundaryCondition cbc,
int  bcIndex1,
int  bcIndex2,
GmMatrixDof dofMap,
GmpFemMatrixSet matrixSet,
GmpFemVectorSet vecSet 
)
inlinevirtual

Method called by the FEM process in a similar way as the call to fillElementData() for the physics to supply local matrix and vector contributions due to the supplied contact pair.

This function will be called only for contact boundary condition types returned by supportedContactBcTypes(). The supplied cbc parameter defines the contact boundary condition, bcIndex1 and bcIndex2 are the indices of the possibly in-cotact surfaces from the surface list from the boundary condition.

The function should fill the matrix and vector sets as needed, remembering to flag which matrices / vectors where actually filled by the function and wether filled matrices are symmetric or not. See more comments on fillElementData() for further details. Since this function is not tied to an element size, the matrices and vectores returned by matrixSet / vecSet have a "unspecified" size and must be manually resized inside the function (matrices should be square).

This function must also fill the dofMap object with the layout of the returned matrices / vectors. The solver expects that the matrix/vectors dof order is organized "per node" and each node has the same list of dofs. Example: Nodes = {456, 213, 87 and 95}. Dofs per node = {1, 5}.

Matrix organization = {456:1, 456:5, 213:1, 213:5, 87:1, 87:5, 95-:, 95:5}, where in each x:y pair, x is the global mesh node index and y is the global dof number. The dofMap object should be filled by calls to setDofList() and addNode().

IMPORTANT: The assembler assumes that the dof mappings returned in dofMap are already known to the assembler, that is, no new node-dof assignments can be created by this dof map. In other words, the dofs added to the map should be dofs already mapped by this physics to all the contact nodes. That means that if this physics, for example, when dealing with quadratic elements, maps its dofs to the element vertices but not to the quadratic nodes, then the contact condition can also not add displacement dofs to those quadratic nodes.

◆ fillElementData()

virtual FemResultType GmpFemPhysics::fillElementData ( const GmElement e,
GmpFemMatrixSet elemMatrices,
GmpFemVectorSet elemVectors 
)
pure virtual

Method called by the FEM process, during the global matrix / vector assembly procedure to ask a physics object for the local contribution of the element 'e'.

This function receives as parameters the set of matrices / vectors that the driving process expects to be filled. This can vary from driver to driver, whether we are running a steady state simulation or a transient one, a linear problem or a non linear procedure. Inside the sets, the expected matrices can be queried by their types, as given by GmpFemMatrixTypes / GmpFemVectorTypes.

Keep in mind that not every physics needs to fill every matrix / vector in the sets. An implementation should fill only the relevant ones given by this element contributions for the requested matrices / vectors. If this function fills a matrix / vector in the set, it should flag this by either calling the method setFilled() over the set or better by getting access to the relevant matrix/vector by calling useMatrix() / useVector() which already marks the returned matrix/vector as filled.

When filling a matrix, you should also tell the set if the filled data forms a symmetric matrix or not (by safety, matrices are marked as unsymmetric, so in practice you only need to flag symmetric matrices). Marking a matrix as symmetric has as consequence that if all physics involved in an analysis report that their local matrices are symmetric, the global stiffness matrices will also be symmetric and the numeric solver can take that information into acount when solving the linear system.

When filling a local matrix / vector with this physics contribution, its imperative to respect its local degrees of freedom mapping. The matrices / vectors in the sets will already have size equal to the physics number of degrees of freedom for that element type, as reported by dofMapping() (Ps: This function will not be called for mesh elements of unsupported types).

Columns and lines in the local matrices should be ordered by element node order and node dof number order as reported by dofMapping(). For example, a hypotetical (and rather impossible) quad element that reports via dofMapping() that node 0 is tied to dof {2,3}, node 1 to dof {2,3}, node 2 to dof {7} and node 3 to dof {8} would order its matrix lines / columns as 0:2, 0:3, 1:2, 1:3, 2:7, 3:8 where x:y represents the local node number : global dof number.

In the event of unexpected errors, the function should log a message with its logger and return FEM_ERROR to indicate that the assembly process should be aborted. It should return FEM_RESULT_OK on success and other enumeration results in situations where the matrix could not be calculated due to non error situations that can be treated by breaking steps in the FEM solver.

OBS: This function should NOT add contributions for boundary conditions, but for element where the integration is done over the whole element. Boundary conditions are treated in the fillElementDataForBc() function.

◆ fillElementDataForBc()

virtual FemResultType GmpFemPhysics::fillElementDataForBc ( const GmElement e,
const GmBoundaryCondition bc,
int  bcIndex,
int  bcListIndex,
int  border,
GmpFemMatrixSet elemMatrices,
GmpFemVectorSet elemVectors 
)
inlinevirtual

Method called by the FEM process in a similar way as the call to fillElementData() for the physics to supply local element matrix and/or vector contributions due to the supplied boundary condition.

This function will be called only for bc values where bcAffectsCalc() returned true. The supplied bc parameter defines the boundary condition type, bcIndex the index of the specific condition inside bc, bcListIndex the index of the cell inside the boudary associated with bcIndex, and the border parameter the edge or face of the element 'e' involved in the condition (or -1 if the condition is bound to the cell and not to a border).

The function should fill the matrix and vector sets as needed, remembering to flag which matrices / vectors where actually filled by the function and wether filled matrices are symmetric or not. See more comments on fillElementData() for further details.

◆ fillElementDataForLoads()

virtual FemResultType GmpFemPhysics::fillElementDataForLoads ( const GmElement e,
int  loadId,
GmpFemVectorSet elemVectors 
)
inlinevirtual

Method called by the FEM process in a similar way as the call to fillElementData() for the physics to supply local element vector contributions due to the supplied external load.

This function will be called only for loadIds returned by supportedExternalLoads() whose names are present in the externalLoads table. The item order in the table returned by supportedExternalLoads() gives the id for each load kind.

The function should fill the vector sets as needed, remembering to flag which vectors where actually filled by the function. See more comments on fillElementData() for further details.

◆ fixedNodalDofsBc()

virtual bool GmpFemPhysics::fixedNodalDofsBc ( QList< int > &  nodes,
QList< int > &  dof,
QList< double > &  values,
bool *  constantValues 
) const
inlinevirtual

Method called by the FEM process asking the physics to provide fixed dof (state variable) values used to remove degrees of freedom from the system. Those fixed values correspond to fixed u values in the global equation K.u = f.

Reimplementing this method is usefull if the physics supports boudary conditions where dof values are globally defined by the user. It should fill the lists with node numbers, the degree of freedom represented and the respective value.

If the physics does not include fixed boudary conditions, the provided lists should be kept empty.

The constantValues flag should be filled with true if the boundary condition values are constant and with false if they are given by functions (the value changes over time).

In the event of errors, the function should log a message with its logger and return false to indicate that the assembly process should be aborted.

◆ fixedNodalForcesBc()

virtual bool GmpFemPhysics::fixedNodalForcesBc ( QList< int > &  nodes,
QList< int > &  dof,
QList< double > &  values 
) const
inlinevirtual

Method called by the FEM process asking the physics to provide prescribed nodal force values that will be added to the global force vector f (the f vector in the global equation K.u = f).

Reimplementing this method is usefull if the physics supports boudary conditions where nodal forces are globally defined by the user. It should fill the lists with node numbers, the degree of freedom represented and the respective value.

If the physics does not include fixed (prescribed) nodal forces, the provided lists should be kept empty.

A physics object can implement the methods fixedNodalForcesBc() and / or fillElementDataForBc() as necessary.

In the event of errors, the function should log a message with its logger and return false to indicate that the assembly process should be aborted.

◆ gaussAttributeAccessor()

GmGaussAccessor * GmpFemPhysics::gaussAttributeAccessor ( GmElementMesh mesh,
QString  stdAttributeName,
QString  msgDescription,
LuaTable table,
Unit  desiredUnit,
bool  required,
int  type = -1,
int  nlin = -1,
int  ncol = -1,
int  history = -1,
bool  canBeFunction = true,
bool  create = false,
QString  createFormat = "",
int  createHistory = -1,
bool  ignoreWarnings = false 
)
protected

Similar to GmPhysics::propertyAccessor() returning a Gauss point attribute. The history parameter defines a restriction on the attribute history value (a -1 means that any history type is allowed). If the last parameter (create) is true, the attribute is required and if not found in the mesh, it will be created by the function (and its numeric format will be set to the value given by createFormat if not empty, using createHistory states)

Keep in mind that the returned accessor will always point to the current state. To create an accessor for other states one can use the info object bound to the returned accessor to get the accessor name and call _mesh->gaussAttributeAccessor() to get the accessor for a previous state.

When set to true, the ignoreWarnings flag prevents the emission of log messages when an optional property was not returned by a type problem.

This function calls createGaussAttributeAccessor() to actually instance the accessor object, allowing for derived classes to work with other kinds of accessors derived from GmGaussAccessor. This is particulary important for the XFem plugin.

◆ loadPrivateData()

bool GmpFemPhysics::loadPrivateData ( LuaTable table)
virtual

Reimplements loadPrivateData() to parse attributes common to all FEM physics objects, calling an extra set of virtual functions as needed.

Called functions that should (or can) be reimplemented on derived classes, in call order:

When this functions are called, the _mesh attribute has already been filled.

IMPORTANT: Before calling this function in plugin code, please make sure that the Lua code in the plugin checked for the existance of the 'type' attribute with value equal to 'fem'.

See further comments on the base class and on the class description.

Implements GmPluginObject.

◆ meshGroupSet()

const GmCellGroupSet* GmpFemPhysics::meshGroupSet ( ) const
inline

Returns the element group set used to traverse mesh elements belonging to the element groups that together define the physics spatial domain.

Even if the domain is the entire mesh, a group set referencing all mesh elements will be returned by this function in order to allow for a more general code that works if there is a restriction on the elements that will be traversed or not.

◆ supportedBcTypes()

virtual const QStringList& GmpFemPhysics::supportedBcTypes ( ) const
inlinevirtual

A list with names for the known boundary condition types supported by this physics.

This function is called only after the call to checkAndLoadBcAccessors().

Reimplemented in GmpFemPhysicsCommon.

◆ supportedContactBcTypes()

virtual const QStringList& GmpFemPhysics::supportedContactBcTypes ( ) const
inlinevirtual

A list with names for the known contact boundary condition types supported by this physics.

This function is called only after the call to checkAndLoadContactBcAccessors().

Reimplemented in GmpFemPhysicsCommon.

◆ supportedExternalLoads()

virtual const QStringList& GmpFemPhysics::supportedExternalLoads ( ) const
inlinevirtual

A list with names for the known external load conditions supported by this physics.

Those names will be used to recognize valid map entries in the externalLoads physics attribute. Their order in the list define the loadId used to identify the kind of external load in calls to fillElementDataForLoads().

Reimplemented in GmpFemPhysicsCommon.

◆ supportsCellType()

virtual bool GmpFemPhysics::supportsCellType ( GmCellType  type) const
pure virtual

Returns true if the type is supported by this physics object.

Results from dofMapping() should be consistent with results from supportsCellType(), i.e. there must exist a 1:1 mapping between types where supportsCellType() returns true and non NULL pointers returned by dofMapping()

Implemented in GmpFemPhysicsCommon.


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