IFEM 90A354
SIMbase.h
Go to the documentation of this file.
1// $Id$
2//==============================================================================
12//==============================================================================
13
14#ifndef _SIM_BASE_H
15#define _SIM_BASE_H
16
17#include "SIMadmin.h"
18#include "SIMdependency.h"
19#include "TimeDomain.h"
20#include "Property.h"
21#include "MatVec.h"
22#include <set>
23
24class IntegrandBase;
25class NormBase;
26class ForceBase;
27class AnaSol;
28class SAM;
29class AlgEqSystem;
30class LinSolParams;
31class SystemMatrix;
32class SystemVector;
33class FunctionBase;
34class RealFunc;
35class VecFunc;
36class TractionFunc;
37class ScalarFunc;
38class Vec4;
39class Vec3;
40
41
46struct Mode
47{
48 int eigNo;
49 double eigVal;
50 double damping;
53
55 Mode() : eigNo(0), eigVal(0.0), damping(0.0) {}
57 bool orthonormalize(const SystemMatrix& mat);
59 bool computeDamping(const SystemMatrix& mat);
60};
61
62
71class SIMbase : public SIMadmin, public SIMdependency
72{
73protected:
75 explicit SIMbase(IntegrandBase* itg);
76
77public:
79 virtual ~SIMbase();
80
81
82 // Model input and pre-processing methods
83 // ======================================
84
86 bool readModel(const char* fileName);
87
89 virtual bool createFEMmodel(char resetNumb) = 0;
90
94 virtual void clearProperties();
95
97 virtual void initForSingleStep() {}
99 virtual void initForMultiStep() {}
100
105 virtual bool preprocessC(const IntVec& ignored, bool fixDup, double time0);
106
111 virtual bool merge(SIMbase* that,
112 const std::map<int,int>* old2new = nullptr, int poff = 0);
113
121 size_t nMats = 1, size_t nVec = 1, size_t nScl = 0,
122 bool withRF = false);
123
125 bool initSystem(const SIMbase* that);
126
128 void initLHSbuffers();
129
134 bool setAssociatedRHS(size_t iMat, size_t iVec);
135
140 bool setMode(int mode, bool needIntegr = true, bool resetSol = false);
141
145 void setIntegrationPrm(unsigned short int i, double prm);
146
151 void setQuadratureRule(size_t ng, bool redimBuffers = false,
152 bool printQP = false);
153
155 virtual bool printProblem() const;
156
158 const IntegrandBase* getProblem() const { return myProblem; }
159
162 { return nullptr; }
163
167 void clearProblem() { myProblem = nullptr; }
168
173 virtual std::string getName() const { return "SIMbase"; }
175 virtual bool mixedProblem() const { return false; }
176
178 const LinSolParams* getSolParams() const { return mySolParams; }
179
181 virtual unsigned short int getNoParamDim() const = 0;
183 virtual size_t getNoSpaceDim() const { return nsd; }
186 size_t getNoFields(int basis = 0) const;
188 size_t getNoDOFs(bool subSim = false) const;
191 size_t getNoNodes(int basis = 0) const;
196 size_t getNoElms(bool includeXelms = false, bool includeZelms = false) const;
198 size_t getNoSolutions(bool allocated = false) const;
200 int getNoPatches() const { return nGlPatches; }
202 size_t getNoEquations() const;
204 size_t getNoConstraints() const;
206 virtual size_t getNoRHS() const;
208 unsigned char getNoBasis() const;
209
211 char getNodeType(int inod) const;
213 Vec4 getNodeCoord(int inod) const;
215 bool isFixed(int inod, int dof = 123) const;
217 int getGlobalNode(int node) const;
219 int getLocalNode(int node) const;
221 bool getElmNodes(IntVec& mnpc, int iel) const;
223 virtual std::vector<IntVec> getElmConnectivities() const = 0;
224
229 void getBoundaryNodes(int pcode, IntVec& glbNodes,
230 std::vector<Vec3>* XYZ = nullptr) const;
231
233 int findClosestNode(const Vec3&) const;
234
236 IntVec getNodeSet(const std::string& setName) const;
237
240 bool initDirichlet(double time = 0.0);
242 bool hasTimeDependentDirichlet() const;
243
248 virtual bool updateDirichlet(double time = 0.0,
249 const Vector* prevSol = nullptr,
250 bool tangent = false);
251
253 virtual bool updateConfiguration(const Vector&) { return true; }
255 virtual bool updateRotations(const RealArray&, double = 0.0) { return true; }
256
259 bool updateGrid(const RealArray& displ);
262 bool updateGrid(const std::string& field);
263
266 void setRefined(int nref) { isRefined = nref; }
268 int getRefined() const { return isRefined; }
269
273 bool hasElementActivator(double t1 = -1.0, double t0 = 0.0) const;
274
279 void updateForNewElements(Vector& solution, const TimeDomain& time,
280 int verbose = 0) const;
281
282
283 // Computational methods
284 // =====================
285
291 virtual bool assembleSystem(const TimeDomain& time, const Vectors& prevSol,
292 bool newLHSmatrix = true, bool poorConvg = false);
293
299 bool assembleSystem(double t0 = 0.0, const Vectors& pSol = Vectors())
300 { return this->assembleSystem(TimeDomain(t0),pSol); }
301
306 bool extractLoadVec(Vector& loadVec, size_t idx = 0,
307 const char* hd = nullptr) const;
309 bool extractScalars(RealArray& values) const;
311 double extractScalar(size_t idx = 0) const;
312
315 bool applyDirichlet(Vector& glbVec) const;
316
324 bool solveEqSystem(Vector& solution, size_t idxRHS, double* rCond,
325 int printSol = 0, bool dumpEqSys = false,
326 const char* compName = "displacement");
327
334 virtual bool solveSystem(Vector& solution, int printSol, double* rCond,
335 const char* compName = "displacement",
336 size_t idxRHS = 0)
337 {
338 return this->solveEqSystem(solution,idxRHS,rCond,printSol,true,compName);
339 }
340
345 bool solveSystem(Vector& solution, int printSol = 0,
346 const char* compName = "displacement")
347 {
348 return this->solveSystem(solution,printSol,nullptr,compName);
349 }
350
355 bool solveSystem(Vectors& solution, int printSol = 0,
356 const char* cmpName = "displacement");
357
365 void getWorstDofs(const Vector& x, const Vector& r,
366 size_t nWorst, double eps, int iteNorm,
367 std::map<std::pair<int,int>,RealArray>& worst) const;
368
375 virtual void iterationNorms(const Vector& x, const Vector& r, double& eNorm,
376 double& rNorm, double& dNorm) const;
377
385 double solutionNorms(const Vector& x, double* inf = nullptr,
386 size_t* ind = nullptr, size_t nf = 0,
387 char type = 'D') const;
388
396 bool solutionNorms(const TimeDomain& time,
397 const Vectors& psol, const Vectors& ssol,
398 Vectors& gNorm, Matrix* eNorm = nullptr,
399 const char* name = nullptr);
407 bool solutionNorms(const TimeDomain& time, const Vectors& psol,
408 Vectors& gNorm, Matrix* eNorm = nullptr)
409 { return this->solutionNorms(time,psol,Vectors(),gNorm,eNorm); }
418 bool solutionNorms(const Vector& psol, const Vectors& ssol,
419 Matrix& eNorm, Vectors& gNorm,
420 const char* name = nullptr)
421 {
422 return this->solutionNorms(TimeDomain(),Vectors(1,psol),ssol,
423 gNorm,&eNorm,name);
424 }
432 bool solutionNorms(const Vector& psol, Matrix& eNorm, Vectors& gNorm)
433 {
434 return this->solutionNorms(TimeDomain(),Vectors(1,psol),Vectors(),
435 gNorm,&eNorm);
436 }
445 bool solutionNorms(const Vector& psol, const Vectors& ssol, Vectors& gNorm,
446 const char* name = nullptr)
447 {
448 return this->solutionNorms(TimeDomain(),Vectors(1,psol),ssol,gNorm,
449 nullptr,name);
450 }
451
459 virtual void printStep(int istep, const TimeDomain& time) const;
460
466 virtual void printSolutionSummary(const Vector& solution, int printSol = 0,
467 const char* compName = nullptr,
468 std::streamsize outPrec = 0);
469
475 bool getCurrentReactions(RealArray& RF, const Vector& psol,
476 int pcode = 0) const;
479 bool haveReactions(int pcode = 0) const;
481 virtual const RealArray* getReactionForces() const;
482
491 bool systemModes(std::vector<Mode>& solution,
492 int nev, int ncv, int iop, double shift,
493 size_t iA = 0, size_t iB = 1);
498 bool systemModes(std::vector<Mode>& solution, size_t iA = 0, size_t iB = 1)
499 {
500 return this->systemModes(solution,opt.nev,opt.ncv,opt.eig,opt.shift,iA,iB);
501 }
502
504 virtual bool haveBoundaryReactions(bool = false) const { return false; }
505
511 bool assembleForces(const Vector& solution, double t0,
512 RealArray* R, Vector* S = nullptr);
513
514
515 // Post-processing methods
516 // =======================
517
527 virtual bool project(Matrix& ssol, const Vector& psol,
528 SIMoptions::ProjectionMethod method = SIMoptions::GLOBAL,
529 const TimeDomain& time = TimeDomain()) const;
537 bool project(Vector& ssol, const Vector& psol,
538 SIMoptions::ProjectionMethod method = SIMoptions::GLOBAL,
539 size_t iComp = 0) const;
540
544 bool projectAnaSol(Vector& ssol, SIMoptions::ProjectionMethod method) const;
545
554 bool project(RealArray& values, const FunctionBase* f,
555 int basis = 1, int iField = 0, int nFields = 1,
556 SIMoptions::ProjectionMethod method = SIMoptions::GLOBAL,
557 double time = 0.0) const;
558
562 bool evalSecondarySolution(Matrix& field, int pindx) const;
563
565 virtual bool fieldProjections() const;
566
568 virtual bool haveAnaSol() const { return mySol ? true : false; }
570 virtual bool haveDualSol() const { return dualField ? true : false; }
571
576 NormBase* getNormIntegrand() const;
581 ForceBase* getBoundaryForceIntegrand(const Vec3* X0 = nullptr) const;
587
589 const SAM* getSAM() const { return mySam; }
590
591protected:
595 VecFunc* getVecFunc(size_t patch, Property::Type ptype) const;
596
606 virtual bool addConstraint(int patch, int lndx, int ldim, int dirs, int code,
607 int& ngnod, char basis = 1, bool ovrD = false);
608
610 virtual void preprocessA() {}
612 virtual bool preprocessBeforeAsmInit(int&) { return true; }
614 virtual bool preprocessB() { return true; }
616 virtual void preprocessResultPoints() = 0;
617
621 int renumberNodes(bool renumMNPC = false);
623 virtual bool renumberNodes(const std::map<int,int>&) { return true; }
624
635 virtual bool extractPatchSolution(IntegrandBase* problem,
636 const Vectors& sol, size_t pindx) const;
637
638public:
645 void registerDependency(const std::string& name, SIMdependency* sim,
646 short int nvc = 1, unsigned char basis = 1);
647
651 bool extractPatchSolution(const Vectors& sol, size_t pindx) const
652 { return this->extractPatchSolution(myProblem,sol,pindx); }
653
661 size_t extractPatchSolution(const RealArray& sol, RealArray& vec,
662 const ASMbase* pch,
663 unsigned char nndof = 0,
664 unsigned char basis = 0) const;
665
672 bool injectPatchSolution(RealArray& sol, const RealArray& vec,
673 const ASMbase* pch,
674 unsigned char nndof = 0,
675 unsigned char basis = 0) const;
676
684 bool extractElmRes(const Matrix& glbRes, Vector& elRes,
685 size_t row, int pindx, std::string& name,
686 const char* prefix = nullptr) const;
692 bool extractElmRes(const Matrix& glbRes, Vector& elRes,
693 size_t row, int pindx) const;
698 bool extractElmRes(const Vector& glbRes, Vector& elRes, int pindx) const;
699
705 int getLocalPatchIndex(int patchNo) const;
706
708 const PatchVec& getFEModel() const { return myModel; }
714 ASMbase* getPatch(int idx, bool glbIndex = false) const;
715
717 bool setPatchMaterial(size_t patch) const;
718
720 const std::map<int,int>& getGlob2LocMap() const { return myGlb2Loc; }
721
723 PropertyVec::const_iterator begin_prop() const { return myProps.begin(); }
725 PropertyVec::const_iterator end_prop() const { return myProps.end(); }
726
730 SystemMatrix* getRayleighDampingMatrix(size_t iM = 1, size_t iK = 0) const;
732 SystemMatrix* getLHSmatrix(size_t idx = 0, bool copy = false) const;
734 SystemVector* getRHSvector(size_t idx = 0, bool copy = false) const;
736 void addToRHSvector(size_t idx, const SystemVector& vec, double scale = 1.0);
737
739 RealFunc* getSclFunc(int code) const;
740
742 void setMDflag(char flag) { mdFlag = flag; }
744 bool isFirst() const { return mdFlag <= 1; }
745
747 void dumpEqSys(bool initialBlankLine = false);
749 void dumpSolVec(const Vector& x,bool isExpanded = true, bool expOnly = false);
750
752 virtual int printNRforces(const IntVec& = {}) const { return 0; }
753
754protected:
756 char getMDflag() const { return mdFlag; }
758 virtual void shiftGlobalNums(int, int) {}
759
761 virtual bool initMaterial(size_t) { return true; }
763 virtual bool initBodyLoad(size_t) { return true; }
765 virtual bool initNeumann(size_t) { return true; }
766
769 const TimeDomain&) { return true; }
774 virtual bool assembleDiscreteItems(const IntegrandBase* itg,
775 const TimeDomain& time, const Vectors&)
776 { return this->assembleDiscreteTerms(itg,time); }
777
779 virtual double externalEnergy(const Vectors& psol, const TimeDomain&) const;
780
782 virtual bool postProcessNorms(Vectors&, Matrix*) { return true; }
783
787 void generateThreadGroups(const Property& p, bool silence = false);
788
790 void changeNumThreads();
791
796 bool addMADOF(unsigned char basis, unsigned char nndof, bool other = true);
797
799 double* theExtEnerg() { return &extEnergy; }
801 const double* getExtEnerg() const { return &extEnergy; }
802
803private:
807 const IntVec& getMADOF(unsigned char basis, unsigned char nndof) const;
808
809public:
810 static bool ignoreDirichlet;
811 static bool preserveNOrder;
812
813protected:
815 typedef std::map<int,RealFunc*> SclFuncMap;
817 typedef std::map<int,VecFunc*> VecFuncMap;
819 typedef std::map<int,TractionFunc*> TracFuncMap;
820
822 typedef std::multimap<int,IntegrandBase*> IntegrandMap;
823
824 // Model attributes
825 unsigned char nsd;
835
836 std::vector<FunctionBase*> extrFunc;
837
844 bool lagMTOK;
845 bool fixZeros;
846
848 struct DumpData
849 {
850 std::string fname;
852 std::set<int> step;
853 bool expand;
854 int count;
855 double eps;
856
858 DumpData() : format(LinAlg::FLAT), expand(false), count(0), eps(1.0e-6) {}
859
861 bool doDump() { return !fname.empty() && step.find(++count) != step.end(); }
862 };
863
864 // Post-processing attributes
865 std::vector<DumpData> lhsDump;
866 std::vector<DumpData> rhsDump;
867 std::vector<DumpData> solDump;
868
869 // Parallel computing attributes
873 std::map<int,int> myGlb2Loc;
874 const std::map<int,int>* g2l;
875 std::map<int,int> myDegenElm;
876 std::set<int> myDupNodes;
877
878 // Equation solver attributes
883
884private:
885 size_t nIntGP;
886 size_t nBouGP;
887 size_t nDofS;
888 char mdFlag;
889
891 mutable std::map<int,IntVec> extraMADOFs;
892
893 mutable double extEnergy;
895};
896
897#endif
std::vector< int > IntVec
General integer vector.
Definition ASMbase.h:25
std::vector< Real > RealArray
A real-valued array without algebraic operations.
Definition ImmersedBoundaries.h:32
Global algebraic operations on index 1-based matrices and vectors.
std::vector< Vector > Vectors
An array of real-valued vectors with algebraic operations.
Definition MatVec.h:37
Representation of a distributed physical property.
std::vector< Property > PropertyVec
Vector of properties.
Definition Property.h:64
Administration base class for FEM simulators.
Administration of simulators with dependencies to other simulators.
Time domain representation for time-dependent and nonlinear solvers.
Base class to check for internal boundary integrand contributions.
Definition Interface.h:40
Base class for spline-based finite element (FE) assembly drivers.
Definition ASMbase.h:72
Class for storage of general algebraic system of equations.
Definition AlgEqSystem.h:33
Class for analytical solution fields (primary and secondary solution).
Definition AnaSol.h:32
Base class representing a system level boundary force quantity.
Definition IntegrandBase.h:534
Base class for unary spatial functions of arbitrary result type.
Definition Function.h:147
Base class representing a system level integrated quantity.
Definition IntegrandBase.h:42
Class for linear solver parameters.
Definition LinSolParams.h:67
Base class representing a system level norm quantity.
Definition IntegrandBase.h:379
Scalar-valued unary function of a spatial point.
Definition Function.h:193
This class contains data and functions for the assembly of FE matrices.
Definition SAM.h:39
Administration base class for FEM simulators.
Definition SIMadmin.h:32
std::vector< int > IntVec
Convenience alias.
Definition SIMadmin.h:34
SIMoptions & opt
Simulation control parameters.
Definition SIMadmin.h:82
Base class for NURBS-based FEM simulators.
Definition SIMbase.h:72
size_t getNoElms(bool includeXelms=false, bool includeZelms=false) const
Returns the model size in terms of number of elements.
Definition SIMbase.C:851
virtual ASM::InterfaceChecker * getInterfaceChecker(size_t) const
Returns interface checker type for model.
Definition SIMbase.h:161
virtual bool mixedProblem() const
Returns whether a mixed formulation is used (used by HDF5 output).
Definition SIMbase.h:175
int findClosestNode(const Vec3 &) const
Finds the node that is closest to the given point X.
Definition SIMbase.C:1192
virtual bool assembleDiscreteTerms(const IntegrandBase *, const TimeDomain &)
Assembles problem-dependent discrete terms, if any.
Definition SIMbase.h:768
bool haveReactions(int pcode=0) const
Checks for total reaction forces associated with a boundary.
Definition SIMbase.C:2167
void getWorstDofs(const Vector &x, const Vector &r, size_t nWorst, double eps, int iteNorm, std::map< std::pair< int, int >, RealArray > &worst) const
Finds the DOFs showing the worst convergence behavior.
Definition SIMbase.C:1626
RealFunc * getSclFunc(int code) const
Returns a scalar function associated with code.
Definition SIMbase.C:596
bool extractPatchSolution(const Vectors &sol, size_t pindx) const
Extracts all local solution vector(s) for a specified patch.
Definition SIMbase.h:651
bool systemModes(std::vector< Mode > &solution, size_t iA=0, size_t iB=1)
Performs a generalized eigenvalue analysis of the assembled system.
Definition SIMbase.h:498
virtual std::vector< IntVec > getElmConnectivities() const =0
Obtain element-element connectivities.
virtual bool preprocessBeforeAsmInit(int &)
Specialized preprocessing performed before assembly initialization.
Definition SIMbase.h:612
bool addMADOF(unsigned char basis, unsigned char nndof, bool other=true)
Adds a MADOF with an extraordinary number of DOFs on a given basis.
Definition SIMbase.C:2802
bool solutionNorms(const TimeDomain &time, const Vectors &psol, Vectors &gNorm, Matrix *eNorm=nullptr)
Integrates some solution norm quantities.
Definition SIMbase.h:407
virtual std::string getName() const
Returns the name of this simulator.
Definition SIMbase.h:173
virtual bool updateDirichlet(double time=0.0, const Vector *prevSol=nullptr, bool tangent=false)
Updates the time-dependent in-homogeneous Dirichlet coefficients.
Definition SIMbase.C:950
bool isFixed(int inod, int dof=123) const
Returns true if all DOFs in the specified global node are fixed.
Definition SIMbase.C:1678
double extractScalar(size_t idx=0) const
Extracts an assembled global scalar quantity.
Definition SIMbase.C:1475
virtual bool updateConfiguration(const Vector &)
Updates problem-dependent state based on the current solution.
Definition SIMbase.h:253
bool evalSecondarySolution(Matrix &field, int pindx) const
Evaluates the secondary solution field for specified patch.
Definition SIMbase.C:2677
std::map< int, RealFunc * > SclFuncMap
Scalar field container.
Definition SIMbase.h:815
size_t getNoConstraints() const
Returns the number of constraint equations in the model.
Definition SIMbase.C:892
bool solutionNorms(const Vector &psol, const Vectors &ssol, Vectors &gNorm, const char *name=nullptr)
Integrates some solution norm quantities.
Definition SIMbase.h:445
ForceBase * getNodalForceIntegrand() const
Returns a pointer to a force integrand object for this simulator.
Definition SIMbase.C:1821
virtual bool renumberNodes(const std::map< int, int > &)
Interface for renumbering of app-specific node number tables.
Definition SIMbase.h:623
LinSolParams * myGl2Params
Input parameters for PETSc, for L2 projection.
Definition SIMbase.h:882
virtual bool project(Matrix &ssol, const Vector &psol, SIMoptions::ProjectionMethod method=SIMoptions::GLOBAL, const TimeDomain &time=TimeDomain()) const
Projects the secondary solution associated with a primary solution.
Definition SIMbase.C:2275
virtual bool haveBoundaryReactions(bool=false) const
Returns whether reaction forces are to be computed or not.
Definition SIMbase.h:504
virtual bool preprocessB()
Preprocessing performed after the system assembly initialization.
Definition SIMbase.h:614
double solutionNorms(const Vector &x, double *inf=nullptr, size_t *ind=nullptr, size_t nf=0, char type='D') const
Evaluates some norms of the primary solution vector.
Definition SIMbase.C:1794
int getGlobalNode(int node) const
Returns the global node number from a process-local node number.
Definition SIMbase.C:1688
std::set< int > myDupNodes
Set of duplicated nodes.
Definition SIMbase.h:876
std::vector< DumpData > rhsDump
Right-hand-side vector dump specifications.
Definition SIMbase.h:866
std::map< int, int > myDegenElm
Degenerated elements mapping.
Definition SIMbase.h:875
void setMDflag(char flag)
Sets the multi-dimension simulator sequence flag.
Definition SIMbase.h:742
bool solveSystem(Vector &solution, int printSol=0, const char *compName="displacement")
Solves the assembled linear system of equations for a given load.
Definition SIMbase.h:345
int renumberNodes(bool renumMNPC=false)
Renumbers the global node numbers after resolving patch topology.
Definition SIMbase.C:535
virtual bool initBodyLoad(size_t)
Initializes the body load properties for current patch.
Definition SIMbase.h:763
bool readModel(const char *fileName)
Reads model data from the specified input file *fileName.
Definition SIMbase.C:119
bool projectAnaSol(Vector &ssol, SIMoptions::ProjectionMethod method) const
Projects the analytical secondary solution, if any.
Definition SIMbase.C:2573
size_t getNoSolutions(bool allocated=false) const
Returns the number of solution vectors.
Definition SIMbase.C:880
bool extractLoadVec(Vector &loadVec, size_t idx=0, const char *hd=nullptr) const
Extracts the assembled load vector for inspection/visualization.
Definition SIMbase.C:1432
VecFuncMap myVectors
Vector property fields.
Definition SIMbase.h:829
bool isFirst() const
Returns true, if this is the equation system owner.
Definition SIMbase.h:744
virtual bool updateRotations(const RealArray &, double=0.0)
Updates the nodal rotations for problems with rotational DOFs.
Definition SIMbase.h:255
int getRefined() const
Returns current refinement status.
Definition SIMbase.h:268
virtual bool assembleDiscreteItems(const IntegrandBase *itg, const TimeDomain &time, const Vectors &)
Assembles problem-dependent discrete terms, if any.
Definition SIMbase.h:774
void addToRHSvector(size_t idx, const SystemVector &vec, double scale=1.0)
Adds a system vector to the given right-hand-side vector.
Definition SIMbase.C:1774
bool initSystem(LinAlg::MatrixType mType, size_t nMats=1, size_t nVec=1, size_t nScl=0, bool withRF=false)
Allocates the system matrices of the FE problem to be solved.
Definition SIMbase.C:603
size_t nIntGP
Number of interior integration points in the whole model.
Definition SIMbase.h:885
bool systemModes(std::vector< Mode > &solution, int nev, int ncv, int iop, double shift, size_t iA=0, size_t iB=1)
Performs a generalized eigenvalue analysis of the assembled system.
Definition SIMbase.C:2187
Vec4 getNodeCoord(int inod) const
Returns the spatial coordinates of the specified global node.
Definition SIMbase.C:1662
std::vector< DumpData > lhsDump
Coefficient matrix dump specifications.
Definition SIMbase.h:865
int getLocalNode(int node) const
Returns the process-local node number from a global node number.
Definition SIMbase.C:1695
virtual void clearProperties()
Initializes the property containers of the model.
Definition SIMbase.C:126
bool hasElementActivator(double t1=-1.0, double t0=0.0) const
Returns true if an element activation function is specified.
Definition SIMbase.C:1002
virtual void preprocessResultPoints()=0
Preprocesses the result sampling points.
int nGlbNodes
Total number of unique nodes in the model.
Definition SIMbase.h:842
PatchVec myModel
The actual NURBS/spline model.
Definition SIMbase.h:826
virtual ~SIMbase()
The destructor frees the dynamically allocated objects.
Definition SIMbase.C:83
bool solveEqSystem(Vector &solution, size_t idxRHS, double *rCond, int printSol=0, bool dumpEqSys=false, const char *compName="displacement")
Solves the assembled linear system of equations for a given load.
Definition SIMbase.C:1487
bool setPatchMaterial(size_t patch) const
Initializes material properties for the given patch.
Definition SIMbase.C:2792
virtual bool addConstraint(int patch, int lndx, int ldim, int dirs, int code, int &ngnod, char basis=1, bool ovrD=false)
Preprocesses a user-defined Dirichlet boundary property.
Definition SIMbase.C:453
SclFuncMap myScalars
Scalar property fields.
Definition SIMbase.h:828
virtual bool haveDualSol() const
Returns whether a dual solution is available or not.
Definition SIMbase.h:570
void generateThreadGroups(const Property &p, bool silence=false)
Generates element groups for multi-threading of boundary integrals.
Definition SIMbase.C:567
std::multimap< int, IntegrandBase * > IntegrandMap
Property code to integrand map.
Definition SIMbase.h:822
virtual bool initMaterial(size_t)
Initializes material properties for integration of interior terms.
Definition SIMbase.h:761
size_t getNoDOFs(bool subSim=false) const
Returns the model size in terms of number of DOFs.
Definition SIMbase.C:821
const std::map< int, int > * g2l
Pointer to global-to-local node mapping.
Definition SIMbase.h:874
std::map< int, VecFunc * > VecFuncMap
Vector field container.
Definition SIMbase.h:817
PropertyVec::const_iterator end_prop() const
Returns the end of the property array.
Definition SIMbase.h:725
static bool preserveNOrder
Set to true to preserve node ordering.
Definition SIMbase.h:811
virtual double externalEnergy(const Vectors &psol, const TimeDomain &) const
Computes (possibly problem-dependent) external energy contribution.
Definition SIMbase.C:2100
virtual bool assembleSystem(const TimeDomain &time, const Vectors &prevSol, bool newLHSmatrix=true, bool poorConvg=false)
Administers assembly of the linear equation system.
Definition SIMbase.C:1229
bool setMode(int mode, bool needIntegr=true, bool resetSol=false)
Defines the solution mode before the element assembly is started.
Definition SIMbase.C:678
PropertyVec::const_iterator begin_prop() const
Returns the beginning of the property array.
Definition SIMbase.h:723
bool fixZeros
If true, constrain zero pivots before solving.
Definition SIMbase.h:845
bool lagMTOK
Indicates if global multipliers is OK with multithreading.
Definition SIMbase.h:844
void initLHSbuffers()
Initializes left-hand-side element matrix buffers for integrand.
Definition SIMbase.C:658
double * theExtEnerg()
Returns a pointer to the external energy path integral value.
Definition SIMbase.h:799
virtual bool haveAnaSol() const
Returns whether an analytical solution is available or not.
Definition SIMbase.h:568
bool assembleSystem(double t0=0.0, const Vectors &pSol=Vectors())
Administers assembly of the linear equation system.
Definition SIMbase.h:299
virtual bool postProcessNorms(Vectors &, Matrix *)
Applies app-specific post-processing on norms.
Definition SIMbase.h:782
void changeNumThreads()
Called if number of threads changes.
Definition SIMbase.C:575
bool setAssociatedRHS(size_t iMat, size_t iVec)
Associates a system vector to a system matrix.
Definition SIMbase.C:672
size_t getNoFields(int basis=0) const
Returns the number of primary solution fields.
Definition SIMbase.C:815
int getNoPatches() const
Returns the total number of patches in the model.
Definition SIMbase.h:200
bool extractScalars(RealArray &values) const
Extracts the assembled global scalar quantities.
Definition SIMbase.C:1462
void getBoundaryNodes(int pcode, IntVec &glbNodes, std::vector< Vec3 > *XYZ=nullptr) const
Finds the list of global nodes associated with a boundary.
Definition SIMbase.C:1113
void setIntegrationPrm(unsigned short int i, double prm)
Initializes an integration parameter for the integrand.
Definition SIMbase.C:701
IntegrandBase * myProblem
The main integrand of this simulator.
Definition SIMbase.h:831
char mdFlag
Sequence flag for multi-dimensional simulators.
Definition SIMbase.h:888
std::vector< FunctionBase * > extrFunc
Extraction functions for VCP.
Definition SIMbase.h:836
ForceBase * getBoundaryForceIntegrand(const Vec3 *X0=nullptr) const
Returns a pointer to a force integrand object for this simulator.
Definition SIMbase.C:1815
unsigned char getNoBasis() const
Returns the number of bases in the model.
Definition SIMbase.C:904
void clearProblem()
Clears the reference to the problem-specific data object.
Definition SIMbase.h:167
SAM * mySam
Auxiliary data for FE assembly management.
Definition SIMbase.h:880
static bool ignoreDirichlet
Set to true for free vibration analysis.
Definition SIMbase.h:810
void registerDependency(const std::string &name, SIMdependency *sim, short int nvc=1, unsigned char basis=1)
Registers a dependency on a field from another SIM object.
Definition SIMbase.C:2855
virtual bool solveSystem(Vector &solution, int printSol, double *rCond, const char *compName="displacement", size_t idxRHS=0)
Solves the assembled linear system of equations for a given load.
Definition SIMbase.h:334
bool solutionNorms(const Vector &psol, const Vectors &ssol, Matrix &eNorm, Vectors &gNorm, const char *name=nullptr)
Integrates some solution norm quantities.
Definition SIMbase.h:418
bool injectPatchSolution(RealArray &sol, const RealArray &vec, const ASMbase *pch, unsigned char nndof=0, unsigned char basis=0) const
Injects a patch-wise solution vector into the global vector.
Definition SIMbase.C:2656
std::map< int, IntVec > extraMADOFs
Additional MADOF arrays with varying DOF counts per node.
Definition SIMbase.h:891
bool initDirichlet(double time=0.0)
Initializes time-dependent in-homogeneous Dirichlet coefficients.
Definition SIMbase.C:926
bool getCurrentReactions(RealArray &RF, const Vector &psol, int pcode=0) const
Computes the total reaction forces in the model.
Definition SIMbase.C:2135
IntVec myLoc2Glb
Local-to-global node number mapping.
Definition SIMbase.h:872
IntVec getNodeSet(const std::string &setName) const
Returns a predefined node set.
Definition SIMbase.C:1175
bool applyDirichlet(Vector &glbVec) const
Applies the Dirichlet conditions to given vector.
Definition SIMbase.C:1481
virtual bool extractPatchSolution(IntegrandBase *problem, const Vectors &sol, size_t pindx) const
Extracts all local solution vector(s) for a specified patch.
Definition SIMbase.C:2538
virtual void iterationNorms(const Vector &x, const Vector &r, double &eNorm, double &rNorm, double &dNorm) const
Evaluates some iteration norms for convergence assessment.
Definition SIMbase.C:1785
char getMDflag() const
Returns the multi-dimension simulator sequence flag.
Definition SIMbase.h:756
FunctionBase * dualField
Dual solution field (extraction function)
Definition SIMbase.h:834
std::vector< DumpData > solDump
Solution vector dump specifications.
Definition SIMbase.h:867
AnaSol * mySol
Analytical/Exact solution.
Definition SIMbase.h:833
virtual int printNRforces(const IntVec &={}) const
Prints out nodal reaction forces to the log stream.
Definition SIMbase.h:752
const double * getExtEnerg() const
Returns a const pointer to the external energy path integral value.
Definition SIMbase.h:801
SystemVector * getRHSvector(size_t idx=0, bool copy=false) const
Returns current system right-hand-side vector.
Definition SIMbase.C:1765
virtual const RealArray * getReactionForces() const
Returns current reaction force container.
Definition SIMbase.C:2181
const std::map< int, int > & getGlob2LocMap() const
Returns a const reference to our global-to-local node mapping.
Definition SIMbase.h:720
const SAM * getSAM() const
Returns a const pointer to the SAM object of this simulator.
Definition SIMbase.h:589
virtual bool initNeumann(size_t)
Initializes for integration of Neumann terms for a given property.
Definition SIMbase.h:765
Vector prevForces
Reaction forces of previous time step.
Definition SIMbase.h:894
virtual void initForSingleStep()
Interface for app-specific single-step simulation initialisation.
Definition SIMbase.h:97
virtual void printStep(int istep, const TimeDomain &time) const
Prints out load/time step identification.
Definition SIMbase.C:1567
virtual bool merge(SIMbase *that, const std::map< int, int > *old2new=nullptr, int poff=0)
Merges the global equation system of that simulator with this.
Definition SIMbase.C:492
bool updateGrid(const RealArray &displ)
Updates the grid coordinates.
Definition SIMbase.C:963
void updateForNewElements(Vector &solution, const TimeDomain &time, int verbose=0) const
Modifies the current solution vector when activating elements.
Definition SIMbase.C:1030
int isRefined
Indicates if the model is adaptively refined.
Definition SIMbase.h:843
virtual void preprocessA()
Preprocessing performed before the FEM model generation.
Definition SIMbase.h:610
ASMbase * getPatch(int idx, bool glbIndex=false) const
Returns a pointer to a specified patch of our FEM model.
Definition SIMbase.C:176
double extEnergy
Path integral of external forces.
Definition SIMbase.h:893
SystemMatrix * getRayleighDampingMatrix(size_t iM=1, size_t iK=0) const
Returns current Rayleigh system damping matrix.
Definition SIMbase.C:1702
IntVec myPatches
Global patch numbers for current processor.
Definition SIMbase.h:871
TracFuncMap myTracs
Traction property fields.
Definition SIMbase.h:830
void setRefined(int nref)
Sets the refinement status (for restart of adaptive simulations).
Definition SIMbase.h:266
IntegrandMap myInts
Set of all integrands involved.
Definition SIMbase.h:832
const LinSolParams * getSolParams() const
Returns the linear equation solver parameters (for PETSc).
Definition SIMbase.h:178
void dumpSolVec(const Vector &x, bool isExpanded=true, bool expOnly=false)
Dumps a solution vector to file.
Definition SIMbase.C:2928
const PatchVec & getFEModel() const
Returns a const reference to our FEM model.
Definition SIMbase.h:708
virtual size_t getNoRHS() const
Returns the number of right-hand-side vectors.
Definition SIMbase.C:898
virtual bool createFEMmodel(char resetNumb)=0
Creates the computational FEM model from the spline patches.
bool solutionNorms(const Vector &psol, Matrix &eNorm, Vectors &gNorm)
Integrates some solution norm quantities.
Definition SIMbase.h:432
virtual void initForMultiStep()
Interface for app-specific multi-step simulation initialisation.
Definition SIMbase.h:99
size_t getNoNodes(int basis=0) const
Returns the model size in terms of number of unique nodes.
Definition SIMbase.C:827
size_t nDofS
Number of degrees of freedom in this sub-simulator.
Definition SIMbase.h:887
virtual bool printProblem() const
Prints out problem-specific data to the log stream.
Definition SIMbase.C:756
LinSolParams * mySolParams
Input parameters for PETSc.
Definition SIMbase.h:881
virtual bool preprocessC(const IntVec &ignored, bool fixDup, double time0)
Performs some pre-processing tasks on the FE model.
Definition SIMbase.C:209
void setQuadratureRule(size_t ng, bool redimBuffers=false, bool printQP=false)
Defines the spatial numerical integration scheme to use.
Definition SIMbase.C:714
AlgEqSystem * myEqSys
The actual linear equation system.
Definition SIMbase.h:879
int nGlPatches
Number of global patches.
Definition SIMbase.h:870
virtual bool fieldProjections() const
Returns whether projections must be handled through fields or not.
Definition SIMbase.C:2687
void dumpEqSys(bool initialBlankLine=false)
Dumps left-hand-side matrix and right-hand-side vector to file.
Definition SIMbase.C:2863
PropertyVec myProps
Physical property mapping.
Definition SIMbase.h:827
virtual void shiftGlobalNums(int, int)
Shifts global node and element numbers by constant offsets.
Definition SIMbase.h:758
std::map< int, int > myGlb2Loc
Global-to-local node number mapping.
Definition SIMbase.h:873
bool hasTimeDependentDirichlet() const
Checks for time-dependent in-homogeneous Dirichlet conditions.
Definition SIMbase.C:916
unsigned char nsd
Number of spatial dimensions.
Definition SIMbase.h:825
bool extractElmRes(const Matrix &glbRes, Vector &elRes, size_t row, int pindx, std::string &name, const char *prefix=nullptr) const
Extracts element results for a specified patch.
Definition SIMbase.C:2709
virtual unsigned short int getNoParamDim() const =0
Returns the number of parameter dimensions in the model.
bool getElmNodes(IntVec &mnpc, int iel) const
Finds the Matrix of Nodal Point Correspondance for element iel.
Definition SIMbase.C:864
virtual size_t getNoSpaceDim() const
Returns the number of spatial dimensions in the model.
Definition SIMbase.h:183
size_t nBouGP
Number of boundary integration points in the whole model.
Definition SIMbase.h:886
char getNodeType(int inod) const
Returns the type (DOF classification) of the specified global node.
Definition SIMbase.C:1656
const IntegrandBase * getProblem() const
Returns a pointer to the problem-specific data object.
Definition SIMbase.h:158
std::map< int, TractionFunc * > TracFuncMap
Traction field container.
Definition SIMbase.h:819
NormBase * getNormIntegrand() const
Returns a pointer to a norm integrand object for this simulator.
Definition SIMbase.C:1809
size_t getNoEquations() const
Returns the number of unknowns in the linear equation system.
Definition SIMbase.C:886
virtual void printSolutionSummary(const Vector &solution, int printSol=0, const char *compName=nullptr, std::streamsize outPrec=0)
Prints a summary of the calculated solution to std::cout.
Definition SIMbase.C:1573
const IntVec & getMADOF(unsigned char basis, unsigned char nndof) const
Returns an extraordinary MADOF array.
Definition SIMbase.C:2842
int getLocalPatchIndex(int patchNo) const
Returns the local patch index for the given global patch number.
Definition SIMbase.C:157
bool assembleForces(const Vector &solution, double t0, RealArray *R, Vector *S=nullptr)
Assembles reaction and interface forces for specified boundaries.
Definition SIMbase.C:2959
VecFunc * getVecFunc(size_t patch, Property::Type ptype) const
Returns a vector function associated with given patch and property.
Definition SIMbase.C:583
SystemMatrix * getLHSmatrix(size_t idx=0, bool copy=false) const
Returns current system left-hand-side matrix.
Definition SIMbase.C:1756
Class administering inter-SIM field dependencies.
Definition SIMdependency.h:30
std::vector< ASMbase * > PatchVec
Spline patch container.
Definition SIMdependency.h:33
virtual void registerDependency(SIMdependency *sim, const std::string &name, short int nvc, const PatchVec &patches, char diffBasis=0, int component=1)
Registers a dependency on a field from another SIM object.
Definition SIMdependency.C:21
int ncv
Number of Arnoldi vectors.
Definition SIMoptions.h:82
int eig
Eigensolver method (1,...,5)
Definition SIMoptions.h:80
double shift
Eigenvalue shift.
Definition SIMoptions.h:83
int nev
Number of eigenvalues/vectors.
Definition SIMoptions.h:81
ProjectionMethod
Enum defining the available projection methods.
Definition SIMoptions.h:107
Scalar-valued unary function of a scalar value.
Definition Function.h:127
Base class for representing a system matrix on different formats.
Definition SystemMatrix.h:220
Base class for representing a system vector on different formats.
Definition SystemMatrix.h:32
Vector-valued binary function of a spatial point and normal vector.
Definition Function.h:292
Simple class for representing a point in 3D space.
Definition Vec3.h:27
Simple class for representing a point in 3D space and time.
Definition Vec3.h:209
Vector-valued unary function of a spatial point.
Definition Function.h:242
A vector class with some added algebraic operations.
Definition matrix.h:64
Linear algebra scope.
Definition LinAlgenums.h:19
MatrixType
The available system matrix formats and associated solvers.
Definition LinAlgenums.h:22
StorageFormat
Enumeration of matrix storage formats.
Definition LinAlgenums.h:43
Struct for storage of data associated with one mode shape.
Definition SIMbase.h:47
Mode()
Default constructor.
Definition SIMbase.h:55
double eigVal
Eigenvalue associated with this mode.
Definition SIMbase.h:49
Vector eqnVec
Eigenvector associated with this mode in equation order.
Definition SIMbase.h:52
Vector eigVec
Eigenvector associated with this mode.
Definition SIMbase.h:51
double damping
Modal damping coefficient.
Definition SIMbase.h:50
bool computeDamping(const SystemMatrix &mat)
Compute modal damping based on the given damping matrix.
Definition SIMbase.C:2262
bool orthonormalize(const SystemMatrix &mat)
Orthonormalize the eigenvector w.r.t. the given matrix.
Definition SIMbase.C:2234
int eigNo
Eigenvalue identifier.
Definition SIMbase.h:48
Struct for representing a distributed physical property.
Definition Property.h:26
Type
The available property types.
Definition Property.h:32
A struct with data for system matrix/vector dumps.
Definition SIMbase.h:849
int count
Internal step counter, dump only when step==count.
Definition SIMbase.h:854
DumpData()
Default constructor.
Definition SIMbase.h:858
std::set< int > step
Dump step identifiers.
Definition SIMbase.h:852
double eps
Zero tolerance for printing small values.
Definition SIMbase.h:855
std::string fname
File name.
Definition SIMbase.h:850
LinAlg::StorageFormat format
File format flag.
Definition SIMbase.h:851
bool expand
If true, dump expanded solution vectors.
Definition SIMbase.h:853
bool doDump()
Checks if the matrix or vector should be dumped now.
Definition SIMbase.h:861
Struct representing the time domain.
Definition TimeDomain.h:23