IFEM  90A354
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
AdaptiveSIM Class Reference

Adaptive solution driver for linear static FEM simulators. More...

#include <AdaptiveSIM.h>

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

Public Member Functions

 AdaptiveSIM (SIMoutput &sim, bool sa=true)
 The constructor initializes default adaptation parameters. More...
 
virtual ~AdaptiveSIM ()
 Empty destructor.
 
bool initAdaptor (size_t normGroup=0)
 Initializes the projs and prefix arrays. More...
 
bool solveStep (const char *inputfile, int iStep, bool withRF=false, std::streamsize precision=6)
 Assembles and solves the linear FE equations on current mesh. More...
 
bool adaptMesh (int iStep, std::streamsize outPrec=0)
 Refines the current mesh based on the element norms. More...
 
bool adaptMesh (int iStep, Vectors &sol, std::streamsize outPrec=0)
 Refines the current mesh based on the element norms. More...
 
bool writeGlv (const char *infile, int iStep)
 Writes current mesh and results to the VTF-file. More...
 
const VectorgetSolution (size_t idx=0) const
 Accesses the solution of the linear system.
 
const VectorgetProjection (size_t idx=0) const
 Accesses the projections.
 
const VectorsgetProjections () const
 Access all the projections.
 
const MatrixgetEnorm () const
 Access the calculated element-wise norms.
 
virtual bool parse (char *keyWord, std::istream &is)
 Parses a data section from an input stream. More...
 
virtual bool parse (const tinyxml2::XMLElement *elem)
 Parses a data section from an XML document. More...
 
virtual bool preprocessC (const IntVec &ignored, bool fixDup, double time0)
 Performs some pre-processing tasks on the FE model. More...
 
- 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 preprocess (const IntVec &ignored={}, bool fixDup=false)
 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...
 
- Public Member Functions inherited from AdaptiveSetup
 AdaptiveSetup (SIMoutput &sim, bool sa=true)
 The constructor initializes default adaptation parameters. More...
 
virtual ~AdaptiveSetup ()
 Empty destructor.
 
void setAdaptationNorm (size_t g, size_t i=0)
 Sets the norm group/index of the norm to base mesh adaptation on.
 
bool initPrm (size_t normGroup)
 Initializes the norm group parameters. More...
 
int calcRefinement (LR::RefineData &prm, int iStep, const Vectors &gNorm, const Vector &refIn, int currDofs=-1) const
 Calculates mesh refinement control data based on error estimates. More...
 
bool parse (char *keyWord, std::istream &is)
 Parses a data section from an input stream. More...
 
bool parse (const tinyxml2::XMLElement *elem)
 Parses a data section from an XML document. More...
 
void printNorms (const Vectors &gNorm, const Vectors &dNorm, const Matrix &eNorm, size_t w=36, bool printModelNorms=true) const
 Prints out global norms to the log stream. More...
 
bool writeMesh (int iStep) const
 Dumps current mesh to external file(s) for inspection. More...
 
size_t eIdx () const
 Returns the row-index of the element norm to use for adaptation.
 

Protected Member Functions

virtual bool assembleAndSolveSystem ()
 Assembles and solves the linear FE equation system.
 
virtual bool savePoints (int iStep) const
 Saves point results to output file for a given refinement step. 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...
 
virtual const char ** getPrioritizedTags () const
 Returns a list of prioritized XML-tags.
 

Protected Attributes

Vectors solution
 All solutions (including Galerkin projections)
 
- 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.
 
- Protected Attributes inherited from AdaptiveSetup
SIMoutputmodel
 The isogeometric FE model.
 
size_t adaptor
 Norm group to base the mesh adaptation on.
 
size_t adNorm
 Which norm to base the mesh adaptation on.
 
size_t eRow
 Row-index in eNorm of the norm to use for adaptation.
 
double rCond
 Actual reciprocal condition number of the last mesh.
 

Private Attributes

Vectors gNorm
 Global norms.
 
Vectors dNorm
 Dual global norms.
 
Matrix eNorm
 Element norms.
 
Matrix fNorm
 Dual element norms.
 
int geoBlk
 Running VTF geometry block counter.
 
int nBlock
 Running VTF result block counter.
 
std::vector< Vectorprojs
 Projected secondary solutions.
 
std::vector< Vectorprojd
 Projected dual solutions.
 
std::vector< std::string > prefix
 Norm prefices for VTF-output.
 

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.
 
- Protected Types inherited from SIMadmin
using IntVec = std::vector< int >
 Convenience alias.
 

Detailed Description

Adaptive solution driver for linear static FEM simulators.

This class contains data and methods for solving linear static FE problems adaptively, based on element error norms as refinement indicators.

Constructor & Destructor Documentation

◆ AdaptiveSIM()

AdaptiveSIM::AdaptiveSIM ( SIMoutput sim,
bool  sa = true 
)
explicit

The constructor initializes default adaptation parameters.

Parameters
simThe FE model
[in]saIf true, this is a stand-alone driver

References geoBlk, nBlock, and solution.

Member Function Documentation

◆ adaptMesh() [1/2]

bool AdaptiveSIM::adaptMesh ( int  iStep,
std::streamsize  outPrec = 0 
)

Refines the current mesh based on the element norms.

Parameters
[in]iStepRefinement step counter
[in]outPrecNumber of digits after the decimal point in norm print

Referenced by AdaptiveISolver< T1, SolutionTransfer >::adaptMesh().

◆ adaptMesh() [2/2]

bool AdaptiveSIM::adaptMesh ( int  iStep,
Vectors sol,
std::streamsize  outPrec = 0 
)

Refines the current mesh based on the element norms.

Parameters
[in]iStepRefinement step counter
solVectors for solution transfer
[in]outPrecNumber of digits after the decimal point in norm print

References AdaptiveSetup::calcRefinement(), IFEM::cout, dNorm, utl::matrixBase< T >::empty(), eNorm, AdaptiveSetup::eRow, fNorm, utl::matrix< T >::getRow(), gNorm, AdaptiveSetup::model, utl::LogStream::precision(), AdaptiveSetup::printNorms(), SIMinput::refine(), and AdaptiveSetup::writeMesh().

◆ initAdaptor()

bool AdaptiveSIM::initAdaptor ( size_t  normGroup = 0)

Initializes the projs and prefix arrays.

Parameters
[in]normGroupIndex to the norm group to base mesh adaptation on

References SIMoptions::format, SIMbase::haveDualSol(), AdaptiveSetup::initPrm(), AdaptiveSetup::model, SIMadmin::opt, prefix, projd, SIMoptions::project, and projs.

◆ parse() [1/2]

bool AdaptiveSIM::parse ( char *  keyWord,
std::istream &  is 
)
virtual

Parses a data section from an input stream.

Parameters
[in]keyWordKeyword of current data section to read
isThe file stream to read from

Reimplemented from SIMadmin.

References AdaptiveSetup::parse().

◆ parse() [2/2]

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

Parses a data section from an XML document.

Parameters
[in]elemThe XML element to parse

Reimplemented from SIMadmin.

References AdaptiveSetup::parse().

◆ preprocessC()

bool AdaptiveSIM::preprocessC ( const IntVec ignored,
bool  fixDup,
double  time0 
)
virtual

Performs some pre-processing tasks on the FE model.

Parameters
[in]ignoredIndices of patches to be ignored in the analysis
[in]fixDupMerge duplicated FE nodes on patch interfaces?
[in]time0Initial time for time-dependent dirichlet conditions

Reimplemented from SIMadmin.

References AdaptiveSetup::model, and SIMbase::preprocessC().

◆ savePoints()

bool AdaptiveSIM::savePoints ( int  iStep) const
protectedvirtual

Saves point results to output file for a given refinement step.

Parameters
[in]iStepRefinement step counter

By default, this method just forwards to the underlying model.

Reimplemented in AdaptiveISolver< T1, SolutionTransfer >.

References AdaptiveSetup::model, SIMoutput::savePoints(), and solution.

Referenced by solveStep().

◆ solveStep()

bool AdaptiveSIM::solveStep ( const char *  inputfile,
int  iStep,
bool  withRF = false,
std::streamsize  precision = 6 
)

◆ writeGlv()

bool AdaptiveSIM::writeGlv ( const char *  infile,
int  iStep 
)

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