-
Notifications
You must be signed in to change notification settings - Fork 8
/
SIMDynElasticity.h
144 lines (107 loc) · 4.59 KB
/
SIMDynElasticity.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// $Id$
//==============================================================================
//!
//! \file SIMDynElasticity.h
//!
//! \date Dec 04 2015
//!
//! \author Knut Morten Okstad / SINTEF
//!
//! \brief Dynamic simulation driver for elasticity problems with fracture.
//!
//==============================================================================
#ifndef _SIM_DYN_ELASTICITY_H_
#define _SIM_DYN_ELASTICITY_H_
#include "NonLinSIM.h"
class ElasticBase;
class RealFunc;
namespace tinyxml2 { class XMLElement; }
/*!
\brief Linear quasi-static solution driver.
*/
class LinSIM : public NonLinSIM
{
public:
//! \brief The constructor forwards to the parent class constructor.
explicit LinSIM(SIMbase& sim) : NonLinSIM(sim,NonLinSIM::NONE_UPTAN) {}
//! \brief Empty destructor.
virtual ~LinSIM() {}
};
/*!
\brief Driver class for dynamic elasticity problems with fracture.
*/
template< class Dim, class DynSIM, class Sim>
class SIMDynElasticity : public Sim
{
public:
//! \brief Default constructor.
SIMDynElasticity();
//! \brief Constructor for mixed problems.
explicit SIMDynElasticity(const std::vector<unsigned char>& nf);
//! \brief Empty destructor.
virtual ~SIMDynElasticity() {}
//! \brief Prints out problem-specific data to the log stream.
void printProblem() const override;
//! \brief Initializes the problem.
bool init(const TimeStep& tp, bool = false) override;
//! \brief Saves the converged results of a given time step to VTF file.
//! \param[in] tp Time stepping parameters
//! \param nBlock Running result block counter
bool saveStep(const TimeStep& tp, int& nBlock) override;
//! \brief Advances the time step one step forward.
bool advanceStep(TimeStep& tp) override { return dSim.advanceStep(tp,false); }
//! \brief Prints out time step identification.
//! \param[in] istep Time step counter
//! \param[in] time Parameters for time-dependent simulations
void printStep(int istep, const TimeDomain& time) const override;
//! \brief Computes the solution for the current time step.
bool solveStep(TimeStep& tp) override;
//! \brief Computes solution norms, etc. on the converged solution.
bool postSolve(TimeStep& tp);
//! \brief Updates the strain energy density for the current solution.
bool updateStrainEnergyDensity(const TimeStep& tp);
//! \brief Returns the tensile energy in gauss points.
const RealArray* getTensileEnergy() const;
//! \brief Returns a const reference to the global norms.
const Vector& getGlobalNorms() const { return gNorm; }
//! \brief Dummy method.
void parseStaggering(const tinyxml2::XMLElement*) {}
//! \brief Assigns the file name for global energy output.
void setEnergyFile(const char* fName);
//! \brief Returns a const reference to current solution vector.
const Vector& getSolution(int i) const override { return dSim.getSolution(i);}
//! \brief Returns a const reference to the solution vectors.
const Vectors& getSolutions() const override { return dSim.getSolutions(); }
//! \brief Returns a reference to the solution vectors (for assignment).
Vectors& theSolutions() override { return dSim.theSolutions(); }
//! \brief Updates the solution vectors.
void setSolutions(const Vectors& dvec);
//! \brief Solves the linearized system of current iteration.
//! \param[in] tp Time stepping parameters
//! \param[in] stage Option, 1: solve only the first iteration,
//! 2: solve for the remaining iterations, else: solve the whole time step
SIM::ConvStatus solveIteration(TimeStep& tp, char stage = 0);
//! \brief Returns the maximum number of iterations.
int getMaxit() const { return dSim.getMaxit(); }
//! \brief Checks whether an internal crack pressure has been specified.
RealFunc* haveCrackPressure() const;
//! \brief Serializes current internal state for restarting purposes.
bool serialize(SIMsolution::SerializeMap& data) const override;
//! \brief Restores the internal state from serialized data.
bool deSerialize(const SIMsolution::SerializeMap& data) override;
protected:
//! \brief Returns the actual integrand.
ElasticBase* getIntegrand() override;
using Sim::parse;
//! \brief Parses a data section from an XML element.
bool parse(const tinyxml2::XMLElement* elem) override;
private:
std::string energFile; //!< File name for global energy output
DynSIM dSim; //!< Dynamic solution driver
Matrix projSol; //!< Projected secondary solution fields
Matrix eNorm; //!< Element norm values
Vector gNorm; //!< Global norm values
int vtfStep; //!< VTF file step counter
int outPrec; //!< Precision on solution norm outputs
};
#endif