IFEM  90A354
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
MultiStepSIM Class Referenceabstract

Base class for multi-step solution drivers. More...

#include <MultiStepSIM.h>

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

Public Types

enum  SubIt { ITER = 0 , FIRST = 1 , LAST = 2 , NONE = 3 }
 Enum describing sub-iteration status.
 

Public Member Functions

virtual void printProblem (bool stopInputTimer=false) const
 Prints out problem-specific data to the log stream. More...
 
virtual const char ** getPrioritizedTags () const
 Returns a list of prioritized XML-tags.
 
virtual bool parse (const tinyxml2::XMLElement *elem)
 Parses a data section from an XML document. More...
 
virtual void initPrm ()
 Initializes time integration parameters for the integrand.
 
virtual void initSol (size_t nSol=1, size_t nDof=0)
 Initializes the primary solution vectors. More...
 
bool initEqSystem (bool withRF=true, size_t nScl=0)
 Allocates the FE system matrices. More...
 
virtual bool advanceStep (TimeStep &param, bool updateTime=true)
 Advances the time/load step one step forward. More...
 
virtual SIM::ConvStatus solveStep (TimeStep &param, SIM::SolutionMode=SIM::STATIC, double zero_tolerance=1.0e-8, std::streamsize outPrec=0)=0
 Solves the FE equations at current time/load step. More...
 
virtual bool preprocess (const std::vector< int > &ignored, bool fixDup)
 Performs some pre-processing tasks on the FE model. More...
 
void setStartGeo (int gID)
 Initializes the geometry block counter.
 
bool saveModel (const char *fileName)
 Opens a new VTF-file and writes the model geometry to it. More...
 
bool saveModel (int &gBlock, int &rBlock, const char *fileName=nullptr, bool clearG=true)
 Opens a new VTF-file and writes the model geometry to it. More...
 
bool saveModel (int &gBlock, int &rBlock, double time)
 Writes the model geometry and BCs to an already opened VTF-file. More...
 
bool saveStep (int iStep, double time, const char *vecName=nullptr)
 Saves the converged solution to VTF file of a given time/load step. More...
 
bool saveStep (int iStep, int &rBlock, double time, const char *vecName=nullptr)
 Saves the converged solution to VTF file of a given time/load step. More...
 
bool saveStep (int iStep, int &rBlock, const char *vecName)
 Saves the converged solution to VTF file of a given time/load step. More...
 
virtual bool serialize (SerializeMap &data) const
 Serializes the solution vectors for restarting purposes. More...
 
virtual bool deSerialize (const SerializeMap &data)
 Restores the solution vectors from a serialized state. More...
 
bool checkForRestart ()
 Restores the solution from a serialized state in case of restart.
 
void dumpStep (int iStep, double time, utl::LogStream &os, bool withID=true) const
 Dumps the primary solution for inspection. More...
 
virtual void dumpResults (double time, utl::LogStream &os, std::streamsize precision=3, bool formatted=true) const
 Dumps solution variables at user-defined points. More...
 
bool hasPointResultFile () const
 Returns whether a points result file has been defined or not.
 
bool savePoints (double time, int step) const
 Saves point-wise solution to file for a given time/load step. More...
 
virtual bool isLinear () const
 Returns whether this solution driver is linear or not.
 
virtual bool isDynamic () const
 Returns whether this is a dynamic solution driver or not.
 
const SIMoutputgetModel () const
 Returns a const reference to the FE model.
 
void setSubIteration (SubIt flag)
 Updates the sub-iteration flag.
 
SubIt getSubIteration () const
 Returns the sub-iteration flag.
 
virtual size_t numSolution () const
 Returns the number of solution vectors.
 
virtual const VectorrealSolution (int i=0) const
 Returns a const reference to the current real solution vector. More...
 
virtual const VectorsrealSolutions (bool=false)
 Returns a const reference to the current real solution vectors. More...
 
double * theRefNorm ()
 Returns a pointer to the reference norm variable.
 
const double * getRefNorm () const
 Returns a const pointer to the reference norm variable.
 
virtual bool parse (char *keyWord, std::istream &is)
 Parses a data section from an input stream.
 
virtual bool parse (const tinyxml2::XMLElement *elem)
 Parses a data section from an XML document.
 
- Public Member Functions inherited from SIMsolution
virtual const VectorsgetSolutions () const
 Returns a const reference to the solution vectors.
 
virtual VectorstheSolutions ()
 Returns a reference to the solution vectors (for assignment).
 
virtual const VectorgetSolution (int ix=0) const
 Returns a const reference to current solution vector.
 
virtual void setSolution (const RealArray &s, int ix=0)
 Modifies the current solution vector (used by sub-iterations only).
 
- Public Member Functions inherited from SIMadmin
virtual ~SIMadmin ()
 Empty destructor.
 
virtual bool read (const char *fileName)
 Reads model data from the specified input file *fileName.
 
virtual bool parse (char *keyWord, std::istream &is)
 Parses a data section from an input stream.
 
virtual bool preprocessC (const IntVec &, bool, double=0.0)
 Performs some pre-processing tasks on the FE model.
 
const ProcessAdmgetProcessAdm () const
 Returns the parallel process administrator.
 
int getGlobalProcessID () const
 Returns the global process ID. More...
 
const std::string & getHeading () const
 Returns the simulator heading.
 
void setHeading (const std::string &heading)
 Defines the simulator heading.
 
void printHeading (int &supStep) const
 Prints the heading of this simulator, if any, to IFEM::cout.
 
- Public Member Functions inherited from XMLInputBase
bool readXML (const char *fileName, bool verbose=true)
 Reads an XML input file. More...
 
bool loadXML (const char *xml)
 Loads data from an XML-formatted text string. More...
 

Protected Types

enum  NormOp { MAX , ALL }
 Enum describing reference norm options.
 
- Protected Types inherited from SIMsolution
using SerializeMap = std::map< std::string, std::string >
 Convenience type.
 
- Protected Types inherited from SIMadmin
using IntVec = std::vector< int >
 Convenience alias.
 

Protected Member Functions

 MultiStepSIM (SIMbase &sim)
 The constructor initializes the FE model reference. More...
 
void printStep (const TimeStep &param) const
 Prints out time/load step identification. More...
 
virtual bool solutionNorms (const TimeDomain &, double zero_tolerance=1.0e-8, std::streamsize outPrec=0)
 Computes and prints some solution norm quantities. More...
 
int getLastSavedStep () const
 Returns the last step that was saved to VTF.
 
- Protected Member Functions inherited from SIMsolution
 SIMsolution ()=default
 The default constructor is protected to allow sub-classes only.
 
virtual ~SIMsolution ()=default
 Empty default destructor.
 
void initSolution (size_t ndof, size_t nsol=1)
 Initializes the solution vectors. More...
 
void pushSolution (unsigned short int nVecState=1)
 Pushes the solution vector stack. More...
 
bool saveSolution (SerializeMap &data, const std::string &name) const
 Writes current solution to a serialization container. More...
 
bool restoreSolution (const SerializeMap &data, const std::string &name)
 Restores the solution from a serialization container. More...
 
- Protected Member Functions inherited from SIMadmin
 SIMadmin (const char *heading=nullptr)
 The default constructor initializes the process administrator.
 
 SIMadmin (SIMadmin &anotherSIM)
 Copy constructor.
 
- Protected Member Functions inherited from XMLInputBase
const tinyxml2::XMLElement * loadFile (tinyxml2::XMLDocument &doc, const char *fileName, bool verbose=false)
 Loads an XML input file into a tinyxml2::XMLDocument object. More...
 

Protected Attributes

SIMoutputmodel
 The isogeometric FE model.
 
Vector loadVec
 System load vector (for output to VTF)
 
Vector residual
 Residual force vector.
 
Vector linsol
 Linear solution vector.
 
NormOp refNopt
 Reference norm option.
 
double refNorm
 Reference norm value used in convergence checks.
 
double rCond
 Reciprocal condition number of the linear equation system.
 
SubIt subiter
 Sub-iteration flag.
 
size_t nRHSvec
 Number of right-hand-side vectors to assemble.
 
char rotUpd
 Option for how to update of nodal rotations.
 
int geoBlk
 Running VTF geometry block counter.
 
int nBlock
 Running VTF result block counter.
 
- Protected Attributes inherited from SIMsolution
Vectors solution
 Stack of solution vectors.
 
- Protected Attributes inherited from SIMadmin
ProcessAdm adm
 Parallel administrator.
 
int myPid
 Processor ID in parallel simulations.
 
int nProc
 Number of processors in parallel simulations.
 
std::string myHeading
 Heading written before reading the input file.
 

Private Attributes

bool saveBCs
 If true, Dirchlet boundary conditions are saved to VTF.
 
int lastSt
 The last time/load step that was saved to VTF.
 

Additional Inherited Members

- Public Attributes inherited from SIMadmin
SIMoptionsopt
 Simulation control parameters.
 
- Static Public Attributes inherited from SIMadmin
static int msgLevel = 2
 Controls the console output amount during solving.
 
- Static Protected Member Functions inherited from SIMsolution
static std::string serialize (const double *v, size_t n)
 Helper method for serializing a double array into a text string. More...
 
static void deSerialize (const std::string &data, double *v, size_t n)
 Helper method for deserializing a double array from a text string. More...
 

Detailed Description

Base class for multi-step solution drivers.

Constructor & Destructor Documentation

◆ MultiStepSIM()

MultiStepSIM::MultiStepSIM ( SIMbase sim)
explicitprotected

The constructor initializes the FE model reference.

Parameters
simThe FE model

References geoBlk, lastSt, SIMadmin::msgLevel, nBlock, nRHSvec, rCond, refNopt, refNorm, rotUpd, saveBCs, and subiter.

Member Function Documentation

◆ advanceStep()

bool MultiStepSIM::advanceStep ( TimeStep param,
bool  updateTime = true 
)
virtual

Advances the time/load step one step forward.

Parameters
paramTime stepping parameters
[in]updateTimeIf false, the time parameters are not incremented

Reimplemented in NonLinSIM, NewmarkSIM, GenAlphaSIM, and EigenModeSIM.

References TimeStep::increment(), model, rotUpd, TimeStep::step, and SIMbase::updateRotations().

Referenced by EigenModeSIM::advanceStep(), NewmarkSIM::advanceStep(), and NonLinSIM::advanceStep().

◆ deSerialize()

bool MultiStepSIM::deSerialize ( const SerializeMap data)
virtual

Restores the solution vectors from a serialized state.

Parameters
[in]dataContainer for serialized data

Reimplemented in NewmarkNLSIM, and HHTSIM.

References SIMsolution::deSerialize(), SIMbase::getName(), model, refNorm, and SIMsolution::restoreSolution().

Referenced by checkForRestart().

◆ dumpResults()

void MultiStepSIM::dumpResults ( double  time,
utl::LogStream os,
std::streamsize  precision = 3,
bool  formatted = true 
) const
virtual

Dumps solution variables at user-defined points.

Parameters
[in]timeCurrent time/load parameter
[in]osThe output stream to write the solution to
[in]precisionNumber of digits after the decimal point
[in]formattedIf false, write all result points on a single line

Reimplemented in NewmarkSIM.

References SIMoutput::dumpMoreResults(), SIMoutput::dumpResults(), model, numSolution(), and realSolution().

◆ dumpStep()

void MultiStepSIM::dumpStep ( int  iStep,
double  time,
utl::LogStream os,
bool  withID = true 
) const

Dumps the primary solution for inspection.

Parameters
[in]iStepTime/load step identifier
[in]timeCurrent time/load parameter
[in]osThe output stream to write the solution to
[in]withIDIf true, write node ID and coordinates too

References SIMoutput::dumpPrimSol(), model, numSolution(), and realSolution().

◆ initEqSystem()

bool MultiStepSIM::initEqSystem ( bool  withRF = true,
size_t  nScl = 0 
)

Allocates the FE system matrices.

Parameters
[in]withRFWhether nodal reaction forces should be computed or not
[in]nSclNumber of global scalar quantities to integrate

References SIMbase::initSystem(), model, nRHSvec, SIMadmin::opt, and SIMoptions::solver.

◆ initSol()

void MultiStepSIM::initSol ( size_t  nSol = 1,
size_t  nDof = 0 
)
virtual

Initializes the primary solution vectors.

Parameters
[in]nSolNumber of consecutive solutions stored in core
[in]nDofNumber of degrees of freedom (solution vector length)

Reimplemented in NewmarkNLSIM, HHTSIM, GenAlphaSIM, and EigenModeSIM.

References SIMbase::getNoDOFs(), SIMbase::getNoSolutions(), SIMsolution::initSolution(), model, and SIMsolution::solution.

Referenced by NonLinSIM::init(), EigenModeSIM::initSol(), GenAlphaSIM::initSol(), HHTSIM::initSol(), NewmarkNLSIM::initSol(), and TimeIntegration::SIMImplicitLMM< Solver >::solveStep().

◆ parse()

bool MultiStepSIM::parse ( const tinyxml2::XMLElement *  elem)
virtual

Parses a data section from an XML document.

Parameters
[in]elemThe XML element to parse

Reimplemented from SIMadmin.

Reimplemented in NonLinSIM, NewmarkSIM, NewmarkNLSIM, HHTSIM, GenAlphaSIM, and EigenModeSIM.

References saveBCs.

◆ preprocess()

bool MultiStepSIM::preprocess ( const std::vector< int > &  ignored,
bool  fixDup 
)
virtual

Performs some pre-processing tasks on the FE model.

Parameters
[in]ignoredIndices of patches to ignore in the analysis
[in]fixDupMerge duplicated FE nodes on patch interfaces?

Reimplemented from SIMadmin.

References model, and SIMadmin::preprocess().

◆ printProblem()

void MultiStepSIM::printProblem ( bool  stopInputTimer = false) const
virtual

Prints out problem-specific data to the log stream.

Parameters
[in]stopInputTimerIf true, stop file input timer before print

Reimplemented in NewmarkSIM, NewmarkNLSIM, HHTSIM, and EigenModeSIM.

References model, SIMbase::printProblem(), utl::profiler, and Profiler::stop().

Referenced by EigenModeSIM::printProblem(), and NewmarkSIM::printProblem().

◆ printStep()

void MultiStepSIM::printStep ( const TimeStep param) const
protected

Prints out time/load step identification.

Parameters
[in]paramTime stepping parameters

References ProcessAdm::cout, TimeDomain::dt, SIMadmin::getProcessAdm(), model, utl::LogStream::precision(), SIMbase::printStep(), TimeStep::step, TimeDomain::t, and TimeStep::time.

Referenced by EigenModeSIM::solveStep(), and NewmarkSIM::solveStep().

◆ realSolution()

virtual const Vector& MultiStepSIM::realSolution ( int  i = 0) const
inlinevirtual

Returns a const reference to the current real solution vector.

This method is overridden by simulators that work on a different solution space during the response integration than the actual FE space. This method is then supposed to return the expanded solution vector. The default implementation is the same as SIMsolution::getSolution().

References SIMsolution::solution.

Referenced by dumpResults(), NewmarkSIM::dumpResults(), dumpStep(), savePoints(), saveStep(), and solutionNorms().

◆ realSolutions()

virtual const Vectors& MultiStepSIM::realSolutions ( bool  = false)
inlinevirtual

Returns a const reference to the current real solution vectors.

This method is overridden by simulators that work on a different solution space during the response integration than the actual FE space. This method is then supposed to return the expanded solution vectors. The default implementation is the same as SIMsolution::theSolutions().

References SIMsolution::solution.

Referenced by NewmarkSIM::solutionNorms().

◆ saveModel() [1/3]

bool MultiStepSIM::saveModel ( const char *  fileName)

Opens a new VTF-file and writes the model geometry to it.

Parameters
[in]fileNameFile name used to construct the VTF-file name from

References geoBlk, and nBlock.

◆ saveModel() [2/3]

bool MultiStepSIM::saveModel ( int &  gBlock,
int &  rBlock,
const char *  fileName = nullptr,
bool  clearG = true 
)

Opens a new VTF-file and writes the model geometry to it.

Parameters
gBlockRunning geometry block counter
rBlockRunning result block counter
[in]fileNameFile name used to construct the VTF-file name from
[in]clearGIf true, clear geometry blocks if filename is null

References SIMbase::getNoParamDim(), model, SIMoptions::nViz, SIMadmin::opt, and PROFILE1.

◆ saveModel() [3/3]

bool MultiStepSIM::saveModel ( int &  gBlock,
int &  rBlock,
double  time 
)

Writes the model geometry and BCs to an already opened VTF-file.

Parameters
gBlockRunning geometry block counter
rBlockRunning result block counter
[in]timeTime parameter for evolving grids

References PROFILE1.

◆ savePoints()

bool MultiStepSIM::savePoints ( double  time,
int  step 
) const

Saves point-wise solution to file for a given time/load step.

Parameters
[in]timeTime/load step parameter
[in]stepTime/load step counter

References model, numSolution(), realSolution(), and SIMoutput::savePoints().

◆ saveStep() [1/3]

bool MultiStepSIM::saveStep ( int  iStep,
double  time,
const char *  vecName = nullptr 
)

Saves the converged solution to VTF file of a given time/load step.

Parameters
[in]iStepTime/load step identifier
[in]timeCurrent time/load parameter
[in]vecNameOptional name of primary solution vector field

References SIMoptions::discretization, geoBlk, SIMbase::getNoDOFs(), lastSt, loadVec, model, nBlock, numSolution(), SIMoptions::nViz, SIMadmin::opt, PROFILE1, SIMoptions::pSolOnly, residual, SIMoptions::saveTrac, SIMbase::setMode(), utl::vector< T >::size(), SIMoutput::writeGlvA(), SIMoutput::writeGlvS(), SIMoutput::writeGlvStep(), SIMoutput::writeGlvT(), and SIMoutput::writeGlvV().

Referenced by saveStep().

◆ saveStep() [2/3]

bool MultiStepSIM::saveStep ( int  iStep,
int &  rBlock,
const char *  vecName 
)

Saves the converged solution to VTF file of a given time/load step.

Parameters
[in]iStepTime/load step identifier
rBlockRunning result block counter
[in]vecNameName of primary solution vector field

This method only writes the primary solution vector as a vector field. It is mainly used when this simulator is a component in a coupled simulation, and where the secondary solution is of minor interest.

References model, numSolution(), realSolution(), and SIMoutput::writeGlvV().

◆ saveStep() [3/3]

bool MultiStepSIM::saveStep ( int  iStep,
int &  rBlock,
double  time,
const char *  vecName = nullptr 
)

Saves the converged solution to VTF file of a given time/load step.

Parameters
[in]iStepTime/load step identifier
rBlockRunning result block counter
[in]timeCurrent time/load parameter
[in]vecNameOptional name of primary solution vector field

Use this method when other simulators write results to the same VTF-file. The internal result block counter nBlock is syncronized with the argument rBlock before the results of this simulator are written, to avoid that multiple result blocks receive the same result block ID.

References nBlock, and saveStep().

◆ serialize()

bool MultiStepSIM::serialize ( SerializeMap data) const
virtual

Serializes the solution vectors for restarting purposes.

Parameters
dataContainer for serialized data

Reimplemented in NewmarkNLSIM, and HHTSIM.

References SIMbase::getName(), model, refNorm, SIMsolution::saveSolution(), and SIMsolution::serialize().

◆ solutionNorms()

bool MultiStepSIM::solutionNorms ( const TimeDomain ,
double  zero_tolerance = 1.0e-8,
std::streamsize  outPrec = 0 
)
protectedvirtual

Computes and prints some solution norm quantities.

Parameters
[in]zero_toleranceTruncate norm values smaller than this to zero
[in]outPrecNumber of digits after the decimal point in norm print

Reimplemented in NewmarkSIM.

References model, numSolution(), SIMbase::printSolutionSummary(), realSolution(), and utl::zero_print_tol.

Referenced by NonLinSIM::solveIteration(), and EigenModeSIM::solveStep().

◆ solveStep()

virtual SIM::ConvStatus MultiStepSIM::solveStep ( TimeStep param,
SIM::SolutionMode  = SIM::STATIC,
double  zero_tolerance = 1.0e-8,
std::streamsize  outPrec = 0 
)
pure virtual

Solves the FE equations at current time/load step.

Parameters
paramTime stepping parameters
[in]zero_toleranceTruncate norm values smaller than this to zero
[in]outPrecNumber of digits after the decimal point in norm print

Implemented in NewmarkSIM, EigenModeSIM, and NonLinSIM.


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