v0.13.1
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Example Struct Reference

[Example] More...

Collaboration diagram for Example:
[legend]

Classes

struct  BoundaryOp
 
struct  CommonData
 [Example] More...
 
struct  OpCalcSurfaceAverageTemperature
 
struct  OpError
 
struct  OpError< 1 >
 
struct  OpFirst
 
struct  OpFluxRhs
 
struct  OpRadiationLhs
 
struct  OpRadiationRhs
 
struct  OpRhs
 
struct  OpSecond
 [Operator] More...
 
struct  OpZero
 [Common data] More...
 
struct  PlasticityTimeScale
 

Public Member Functions

 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 [Run problem] More...
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 Example (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 

Private Types

enum  BoundingBox {
  CENTER_X = 0 , CENTER_Y , MAX_X , MAX_Y ,
  MIN_X , MIN_Y , LAST_BB
}
 

Private Member Functions

MoFEMErrorCode setupProblem ()
 [Run problem] More...
 
MoFEMErrorCode createCommonData ()
 [Set up problem] More...
 
MoFEMErrorCode bC ()
 [Create common data] More...
 
MoFEMErrorCode OPs ()
 [Boundary condition] More...
 
MoFEMErrorCode tsSolve ()
 [Push operators to pipeline] More...
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode bC ()
 
MoFEMErrorCode OPs ()
 
MoFEMErrorCode tsSolve ()
 
MoFEMErrorCode postProcess ()
 [Solve] More...
 
MoFEMErrorCode checkResults ()
 [Postprocess results] More...
 
template<int DIM>
Range getEntsOnMeshSkin ()
 [Check] More...
 
MoFEMErrorCode readMesh ()
 [run problem] More...
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode boundaryCondition ()
 [Set up problem] More...
 
MoFEMErrorCode assembleSystem ()
 [Applying essential BC] More...
 
MoFEMErrorCode solveSystem ()
 [Push operators to pipeline] More...
 
MoFEMErrorCode outputResults ()
 [Solve] More...
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode setUp ()
 [Run all] More...
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode setFieldValues ()
 [Create common data] More...
 
MoFEMErrorCode pushOperators ()
 [Set density distribution] More...
 
MoFEMErrorCode integrateElements ()
 [Push operators to pipeline] More...
 
MoFEMErrorCode postProcess ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode setIntegrationRules ()
 [Set up problem] More...
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode boundaryCondition ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode outputResults ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode assembleSystemIntensity ()
 [Calculate flux on boundary] More...
 
MoFEMErrorCode assembleSystemFlux ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode calculateFlux (double &calc_flux)
 [Set up problem] More...
 
MoFEMErrorCode outputResults (const int i)
 [Solve] More...
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode setIntegrationRules ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode boundaryCondition ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode outputResults ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode bC ()
 
MoFEMErrorCode OPs ()
 
MoFEMErrorCode kspSolve ()
 [Push operators to pipeline] More...
 
MoFEMErrorCode postProcess ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode setIntegrationRules ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode boundaryCondition ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode outputResults ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode boundaryCondition ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode outputResults ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode addMatBlockOps (boost::ptr_vector< ForcesAndSourcesCore::UserDataOperator > &pipeline, std::string field_name, std::string block_name, boost::shared_ptr< MatrixDouble > mat_D_Ptr, Sev sev)
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode boundaryCondition ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode outputResults ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode boundaryCondition ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode outputResults ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode boundaryCondition ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode outputResults ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode createCommonData ()
 
MoFEMErrorCode boundaryCondition ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode outputResults ()
 
MoFEMErrorCode checkResults ()
 

Static Private Member Functions

static std::pair< int, int > getCoordsInImage (double x, double y)
 
static double rhsSource (const double x, const double y, const double)
 
static double lhsFlux (const double x, const double y, const double)
 
static int integrationRule (int, int, int p_data)
 

Private Attributes

MoFEM::InterfacemField
 
boost::shared_ptr< PlasticOps::CommonDatacommonPlasticDataPtr
 
boost::shared_ptr< HenckyOps::CommonDatacommonHenckyDataPtr
 
boost::shared_ptr< DomainElereactionFe
 
std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > uXScatter
 
std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > uYScatter
 
std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > uZScatter
 
boost::shared_ptr< std::vector< unsigned char > > boundaryMarker
 
boost::shared_ptr< std::vector< unsigned char > > reactionMarker
 
boost::shared_ptr< ContactOps::CommonDatacommonDataPtr
 
boost::shared_ptr< PostProcElepostProcFe
 
SimplesimpleInterface
 
boost::shared_ptr< CommonDatacommonDataPtr
 
FieldApproximationBase base
 
FieldSpace space
 
boost::shared_ptr< VectorDouble > approxVals
 
boost::shared_ptr< MatrixDouble > approxGradVals
 
Range pinchNodes
 
boost::shared_ptr< MatrixDouble > matDPtr
 
SmartPetscObj< Mat > M
 
SmartPetscObj< Mat > K
 
SmartPetscObj< EPS > ePS
 
std::array< SmartPetscObj< Vec >, 6 > rigidBodyMotion
 
boost::shared_ptr< MatrixDouble > matGradPtr
 
boost::shared_ptr< MatrixDouble > matStrainPtr
 
boost::shared_ptr< MatrixDouble > matStressPtr
 
boost::shared_ptr< MatrixDouble > matAccelerationPtr
 
boost::shared_ptr< MatrixDouble > matInertiaPtr
 
boost::shared_ptr< MatrixDouble > matTangentPtr
 
boost::shared_ptr< FEMethoddomianLhsFEPtr
 
boost::shared_ptr< FEMethoddomianRhsFEPtr
 

Static Private Attributes

static std::vector< doublerZ
 
static std::vector< MatrixIntiI
 
static std::array< double, LAST_BBaveMaxMin
 
static int focalIndex
 
static int savitzkyGolayNormalisation
 
static const int * savitzkyGolayWeights
 
static ApproxFieldFunction< FIELD_DIMapproxFunction
 

Detailed Description

[Example]

Examples
contact.cpp, eigen_elastic.cpp, heat_method.cpp, helmholtz.cpp, nonlinear_elastic.cpp, phase.cpp, plastic.cpp, plot_base.cpp, and shallow_wave.cpp.

Definition at line 139 of file plastic.cpp.

Member Enumeration Documentation

◆ BoundingBox

enum Example::BoundingBox
private
Enumerator
CENTER_X 
CENTER_Y 
MAX_X 
MAX_Y 
MIN_X 
MIN_Y 
LAST_BB 
Examples
phase.cpp.

Definition at line 98 of file phase.cpp.

98 {
99 CENTER_X = 0,
100 CENTER_Y,
101 MAX_X,
102 MAX_Y,
103 MIN_X,
104 MIN_Y,
105 LAST_BB
106 };
@ MAX_X
Definition: phase.cpp:101
@ MIN_X
Definition: phase.cpp:103
@ MIN_Y
Definition: phase.cpp:104
@ CENTER_X
Definition: phase.cpp:99
@ MAX_Y
Definition: phase.cpp:102
@ CENTER_Y
Definition: phase.cpp:100
@ LAST_BB
Definition: phase.cpp:105

Constructor & Destructor Documentation

◆ Example() [1/14]

Example::Example ( MoFEM::Interface m_field)
inline

Definition at line 141 of file plastic.cpp.

141: mField(m_field) {}
MoFEM::Interface & mField
Definition: plastic.cpp:146

◆ Example() [2/14]

Example::Example ( MoFEM::Interface m_field)
inline

Definition at line 135 of file contact.cpp.

135: mField(m_field) {}

◆ Example() [3/14]

Example::Example ( MoFEM::Interface m_field)
inline

Definition at line 39 of file helmholtz.cpp.

39: mField(m_field) {}

◆ Example() [4/14]

Example::Example ( MoFEM::Interface m_field)
inline

Definition at line 25 of file integration.cpp.

25: mField(m_field) {}

◆ Example() [5/14]

Example::Example ( MoFEM::Interface m_field)
inline

Definition at line 50 of file plot_base.cpp.

50: mField(m_field) {}

◆ Example() [6/14]

Example::Example ( MoFEM::Interface m_field)
inline

Definition at line 81 of file phase.cpp.

81: mField(m_field) {}

◆ Example() [7/14]

Example::Example ( MoFEM::Interface m_field)
inline

Definition at line 53 of file approximaton.cpp.

53: mField(m_field) {}

◆ Example() [8/14]

Example::Example ( MoFEM::Interface m_field)
inline

Definition at line 45 of file radiation.cpp.

45: mField(m_field) {}

◆ Example() [9/14]

Example::Example ( MoFEM::Interface m_field)
inline

Definition at line 46 of file heat_method.cpp.

46: mField(m_field) {}

◆ Example() [10/14]

Example::Example ( MoFEM::Interface m_field)
inline

Definition at line 67 of file elastic.cpp.

67: mField(m_field) {}

◆ Example() [11/14]

Example::Example ( MoFEM::Interface m_field)
inline

Definition at line 49 of file eigen_elastic.cpp.

49: mField(m_field) {}

◆ Example() [12/14]

Example::Example ( MoFEM::Interface m_field)
inline

Definition at line 60 of file nonlinear_elastic.cpp.

60: mField(m_field) {}

◆ Example() [13/14]

Example::Example ( MoFEM::Interface m_field)
inline

Definition at line 58 of file nonlinear_dynamic_elastic.cpp.

58: mField(m_field) {}

◆ Example() [14/14]

Example::Example ( MoFEM::Interface m_field)
inline

Definition at line 339 of file shallow_wave.cpp.

339: mField(m_field) {}

Member Function Documentation

◆ addMatBlockOps()

MoFEMErrorCode Example::addMatBlockOps ( boost::ptr_vector< ForcesAndSourcesCore::UserDataOperator > &  pipeline,
std::string  field_name,
std::string  block_name,
boost::shared_ptr< MatrixDouble >  mat_D_Ptr,
Sev  sev 
)
private

[Calculate elasticity tensor]

[Calculate elasticity tensor]

Definition at line 88 of file elastic.cpp.

91 {
93
94 struct OpMatBlocks : public DomainEleOp {
95 OpMatBlocks(std::string field_name, boost::shared_ptr<MatrixDouble> m,
96 double bulk_modulus_K, double shear_modulus_G,
97 MoFEM::Interface &m_field, Sev sev,
98 std::vector<const CubitMeshSets *> meshset_vec_ptr)
99 : DomainEleOp(field_name, DomainEleOp::OPROW), matDPtr(m),
100 bulkModulusKDefault(bulk_modulus_K),
101 shearModulusGDefault(shear_modulus_G) {
102 std::fill(&(doEntities[MBEDGE]), &(doEntities[MBMAXTYPE]), false);
103 CHK_THROW_MESSAGE(extractBlockData(m_field, meshset_vec_ptr, sev),
104 "Can not get data from block");
105 }
106
107 MoFEMErrorCode doWork(int side, EntityType type,
110
111 for (auto &b : blockData) {
112
113 if (b.blockEnts.find(getFEEntityHandle()) != b.blockEnts.end()) {
114 CHKERR getMatDPtr(matDPtr, b.bulkModulusK, b.shearModulusG);
116 }
117 }
118
119 CHKERR getMatDPtr(matDPtr, bulkModulusKDefault, shearModulusGDefault);
121 }
122
123 private:
124 boost::shared_ptr<MatrixDouble> matDPtr;
125
126 struct BlockData {
127 double bulkModulusK;
128 double shearModulusG;
129 Range blockEnts;
130 };
131
132 double bulkModulusKDefault;
133 double shearModulusGDefault;
134 std::vector<BlockData> blockData;
135
137 extractBlockData(MoFEM::Interface &m_field,
138 std::vector<const CubitMeshSets *> meshset_vec_ptr,
139 Sev sev) {
141
142 for (auto m : meshset_vec_ptr) {
143 MOFEM_TAG_AND_LOG("WORLD", sev, "MatBlock") << *m;
144 std::vector<double> block_data;
145 CHKERR m->getAttributes(block_data);
146 if (block_data.size() != 2) {
147 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
148 "Expected that block has two attribute");
149 }
150 auto get_block_ents = [&]() {
151 Range ents;
152 CHKERR
153 m_field.get_moab().get_entities_by_handle(m->meshset, ents, true);
154 return ents;
155 };
156
157 double young_modulus = block_data[0];
158 double poisson_ratio = block_data[1];
159 double bulk_modulus_K = young_modulus / (3 * (1 - 2 * poisson_ratio));
160 double shear_modulus_G = young_modulus / (2 * (1 + poisson_ratio));
161
162 MOFEM_TAG_AND_LOG("WORLD", sev, "MatBlock")
163 << "E = " << young_modulus << " nu = " << poisson_ratio;
164
165 blockData.push_back(
166 {bulk_modulus_K, shear_modulus_G, get_block_ents()});
167 }
168 MOFEM_LOG_CHANNEL("WORLD");
170 }
171
172 MoFEMErrorCode getMatDPtr(boost::shared_ptr<MatrixDouble> mat_D_ptr,
173 double bulk_modulus_K, double shear_modulus_G) {
175 //! [Calculate elasticity tensor]
176 auto set_material_stiffness = [&]() {
182 double A = (SPACE_DIM == 2)
183 ? 2 * shear_modulus_G /
184 (bulk_modulus_K + (4. / 3.) * shear_modulus_G)
185 : 1;
186 auto t_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*mat_D_ptr);
187 t_D(i, j, k, l) =
188 2 * shear_modulus_G * ((t_kd(i, k) ^ t_kd(j, l)) / 4.) +
189 A * (bulk_modulus_K - (2. / 3.) * shear_modulus_G) * t_kd(i, j) *
190 t_kd(k, l);
191 };
192 //! [Calculate elasticity tensor]
193 constexpr auto size_symm = (SPACE_DIM * (SPACE_DIM + 1)) / 2;
194 mat_D_ptr->resize(size_symm * size_symm, 1);
195 set_material_stiffness();
197 }
198 };
199
200 pipeline.push_back(new OpMatBlocks(
202
203 // Get blockset using regular expression
205
206 (boost::format("%s(.*)") % block_name).str()
207
208 ))
209
210 ));
211
213}
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
Definition: LogManager.hpp:345
constexpr int SPACE_DIM
Kronecker Delta class symmetric.
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
Definition: definitions.h:595
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
constexpr double shear_modulus_G
Definition: elastic.cpp:63
constexpr double bulk_modulus_K
Definition: elastic.cpp:62
FTensor::Index< 'm', SPACE_DIM > m
constexpr auto t_kd
SeverityLevel
Severity levels.
Definition: LogManager.hpp:33
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
Definition: LogManager.hpp:277
MoFEMErrorCode getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
get cubit meshset
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
double young_modulus
Definition: plastic.cpp:107
constexpr auto size_symm
Definition: plastic.cpp:44
constexpr AssemblyType A
Definition: plastic.cpp:46
constexpr auto field_name
virtual moab::Interface & get_moab()=0
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)
Interface for managing meshsets containing materials and boundary conditions.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.

◆ assembleSystem() [1/9]

MoFEMErrorCode Example::assembleSystem ( )
private

[Applying essential BC]

[Boundary condition]

[Push operators to pipeline]

Examples
eigen_elastic.cpp, heat_method.cpp, helmholtz.cpp, nonlinear_elastic.cpp, plot_base.cpp, and shallow_wave.cpp.

Definition at line 154 of file helmholtz.cpp.

154 {
157
158 double k = 90;
159 CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-k", &k, PETSC_NULL);
160
161 auto beta = [](const double, const double, const double) { return -1; };
162 auto k2 = [k](const double, const double, const double) { return pow(k, 2); };
163 auto kp = [k](const double, const double, const double) { return k; };
164 auto km = [k](const double, const double, const double) { return -k; };
165 auto integration_rule = [](int, int, int p_data) { return 2 * p_data; };
166
167 auto set_domain = [&]() {
169 auto det_ptr = boost::make_shared<VectorDouble>();
170 auto jac_ptr = boost::make_shared<MatrixDouble>();
171 auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
172 pipeline_mng->getOpDomainLhsPipeline().push_back(
173 new OpCalculateHOJac<2>(jac_ptr));
174 pipeline_mng->getOpDomainLhsPipeline().push_back(
175 new OpInvertMatrix<2>(jac_ptr, det_ptr, inv_jac_ptr));
176 pipeline_mng->getOpDomainLhsPipeline().push_back(
177 new OpSetHOInvJacToScalarBases<2>(H1, inv_jac_ptr));
178 pipeline_mng->getOpDomainLhsPipeline().push_back(
180
181 pipeline_mng->getOpDomainLhsPipeline().push_back(
182 new OpSetBc("P_REAL", true, boundaryMarker));
183
184 pipeline_mng->getOpDomainLhsPipeline().push_back(
185 new OpDomainGradGrad("P_REAL", "P_REAL", beta));
186 pipeline_mng->getOpDomainLhsPipeline().push_back(
187 new OpDomainGradGrad("P_IMAG", "P_IMAG", beta));
188
189 pipeline_mng->getOpDomainLhsPipeline().push_back(
190 new OpDomainMass("P_REAL", "P_REAL", k2));
191 pipeline_mng->getOpDomainLhsPipeline().push_back(
192 new OpDomainMass("P_IMAG", "P_IMAG", k2));
193
194 pipeline_mng->getOpDomainLhsPipeline().push_back(new OpUnSetBc("P_REAL"));
195
198 };
199
200 auto set_boundary = [&]() {
202 pipeline_mng->getOpBoundaryLhsPipeline().push_back(
203 new OpSetBc("P_REAL", true, boundaryMarker));
204 pipeline_mng->getOpBoundaryLhsPipeline().push_back(
205 new OpBoundaryMass("P_IMAG", "P_REAL", kp));
206 pipeline_mng->getOpBoundaryLhsPipeline().push_back(
207 new OpBoundaryMass("P_REAL", "P_IMAG", km));
208 pipeline_mng->getOpBoundaryLhsPipeline().push_back(new OpUnSetBc("P_REAL"));
209
210 pipeline_mng->getOpBoundaryLhsPipeline().push_back(
211 new OpSetBc("P_REAL", false, boundaryMarker));
212 pipeline_mng->getOpBoundaryLhsPipeline().push_back(
213 new OpBoundaryMass("P_REAL", "P_REAL", beta));
214 pipeline_mng->getOpBoundaryLhsPipeline().push_back(new OpUnSetBc("P_REAL"));
215
216 pipeline_mng->getOpBoundaryRhsPipeline().push_back(
217 new OpSetBc("P_REAL", false, boundaryMarker));
218 pipeline_mng->getOpBoundaryRhsPipeline().push_back(
219 new OpBoundarySource("P_REAL", beta));
220 pipeline_mng->getOpBoundaryRhsPipeline().push_back(new OpUnSetBc("P_REAL"));
221
225 };
226
227 CHKERR set_domain();
228 CHKERR set_boundary();
229
231}
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, FIELD_DIM > OpDomainMass
@ H1
continuous field
Definition: definitions.h:85
auto integration_rule
boost::ptr_vector< UserDataOperator > & getOpDomainLhsPipeline()
Get the Op Domain Lhs Pipeline object.
boost::ptr_vector< UserDataOperator > & getOpBoundaryLhsPipeline()
Get the Op Boundary Lhs Pipeline object.
boost::ptr_vector< UserDataOperator > & getOpBoundaryRhsPipeline()
Get the Op Boundary Rhs Pipeline object.
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpGradGrad< 1, 1, SPACE_DIM > OpDomainGradGrad
Definition: helmholtz.cpp:27
FormsIntegrators< EdgeEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, 1 > OpBoundarySource
Definition: helmholtz.cpp:33
PetscErrorCode PetscOptionsGetScalar(PetscOptions *, const char pre[], const char name[], PetscScalar *dval, PetscBool *set)
FormsIntegrators< BoundaryEleOp >::Assembly< PETSC >::BiLinearForm< G >::OpMass< 1, SPACE_DIM > OpBoundaryMass
[Only used with Hencky/nonlinear material]
Definition: plastic.cpp:82
boost::shared_ptr< std::vector< unsigned char > > boundaryMarker
Definition: plastic.cpp:162
Set indices on entities on finite element.
Set inverse jacobian to base functions.
Modify integration weights on face to take in account higher-order geometry.
PipelineManager interface.
MoFEMErrorCode setBoundaryLhsIntegrationRule(RuleHookFun rule)
MoFEMErrorCode setBoundaryRhsIntegrationRule(RuleHookFun rule)
MoFEMErrorCode setDomainLhsIntegrationRule(RuleHookFun rule)

◆ assembleSystem() [2/9]

MoFEMErrorCode Example::assembleSystem ( )
private

◆ assembleSystem() [3/9]

MoFEMErrorCode Example::assembleSystem ( )
private

◆ assembleSystem() [4/9]

MoFEMErrorCode Example::assembleSystem ( )
private

◆ assembleSystem() [5/9]

MoFEMErrorCode Example::assembleSystem ( )
private

◆ assembleSystem() [6/9]

MoFEMErrorCode Example::assembleSystem ( )
private

◆ assembleSystem() [7/9]

MoFEMErrorCode Example::assembleSystem ( )
private

◆ assembleSystem() [8/9]

MoFEMErrorCode Example::assembleSystem ( )
private

◆ assembleSystem() [9/9]

MoFEMErrorCode Example::assembleSystem ( )
private

◆ assembleSystemFlux()

MoFEMErrorCode Example::assembleSystemFlux ( )
private
Examples
phase.cpp.

◆ assembleSystemIntensity()

MoFEMErrorCode Example::assembleSystemIntensity ( )
private

[Calculate flux on boundary]

[Push operators to pipeline]

Examples
phase.cpp.

Definition at line 433 of file phase.cpp.

433 {
435
436 auto *pipeline_mng = mField.getInterface<PipelineManager>();
437
438 pipeline_mng->getDomainLhsFE().reset();
439 pipeline_mng->getDomainRhsFE().reset();
440 pipeline_mng->getBoundaryRhsFE().reset();
441
442 auto rule_vol = [](int, int, int order) { return 2 * (order + 1); };
443 pipeline_mng->setDomainLhsIntegrationRule(rule_vol);
444 pipeline_mng->setDomainRhsIntegrationRule(rule_vol);
445
446 auto det_ptr = boost::make_shared<VectorDouble>();
447 auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
448 auto jac_ptr = boost::make_shared<MatrixDouble>();
449 pipeline_mng->getOpDomainLhsPipeline().push_back(new OpSetHOWeightsOnFace());
450 pipeline_mng->getOpDomainLhsPipeline().push_back(
451 new OpCalculateHOJacForFace(jac_ptr));
452 pipeline_mng->getOpDomainLhsPipeline().push_back(
453 new OpInvertMatrix<2>(jac_ptr, det_ptr, inv_jac_ptr));
454 pipeline_mng->getOpDomainLhsPipeline().push_back(new OpMakeHdivFromHcurl());
455 pipeline_mng->getOpDomainLhsPipeline().push_back(
457 pipeline_mng->getOpDomainLhsPipeline().push_back(
458 new OpSetInvJacHcurlFace(inv_jac_ptr));
459 pipeline_mng->getOpDomainLhsPipeline().push_back(new OpSetHOWeightsOnFace());
460
461 pipeline_mng->getOpDomainLhsPipeline().push_back(
462 new OpHdivHdiv("S", "S", lhsFlux));
463 auto unity = []() { return 1; };
464 pipeline_mng->getOpDomainLhsPipeline().push_back(
465 new OpHdivU("S", "PHI", unity, true));
466
467 pipeline_mng->getOpDomainRhsPipeline().push_back(new OpSetHOWeightsOnFace());
468 pipeline_mng->getOpDomainRhsPipeline().push_back(
469 new OpDomainSource("PHI", rhsSource));
470
472}
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, FIELD_DIM > OpDomainSource
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMixDivTimesScalar< 2 > OpHdivU
OpSetInvJacHcurlFaceImpl< 2 > OpSetInvJacHcurlFace
OpCalculateHOJacForFaceImpl< 2 > OpCalculateHOJacForFace
OpSetContravariantPiolaTransformOnFace2DImpl< 2 > OpSetContravariantPiolaTransformOnFace2D
static double rhsSource(const double x, const double y, const double)
Definition: phase.cpp:150
static double lhsFlux(const double x, const double y, const double)
Definition: phase.cpp:165
Make Hdiv space from Hcurl space in 2d.
boost::shared_ptr< FEMethod > & getDomainLhsFE()
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 3, SPACE_DIM > OpHdivHdiv
[Linear elastic problem]

◆ bC() [1/3]

MoFEMErrorCode Example::bC ( )
private

[Create common data]

[Boundary condition]

Examples
contact.cpp, and plastic.cpp.

Definition at line 393 of file plastic.cpp.

393 {
395
397 auto bc_mng = mField.getInterface<BcManager>();
398 auto prb_mng = mField.getInterface<ProblemsManager>();
399
400 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "REMOVE_X",
401 "U", 0, 0);
402 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "REMOVE_Y",
403 "U", 1, 1);
404 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(), "REMOVE_Z",
405 "U", 2, 2);
406 CHKERR bc_mng->removeBlockDOFsOnEntities(simple->getProblemName(),
407 "REMOVE_ALL", "U", 0, 3);
408
409 CHKERR bc_mng->pushMarkDOFsOnEntities<DisplacementCubitBcData>(
410 simple->getProblemName(), "U");
411
412 auto &bc_map = bc_mng->getBcMapByBlockName();
413 boundaryMarker = bc_mng->getMergedBlocksMarker(vector<string>{"FIX_"});
414
415 CHKERR bc_mng->pushMarkDOFsOnEntities(simple->getProblemName(), "REACTION",
416 "U", 0, 3);
417
418 for (auto bc : bc_map)
419 MOFEM_LOG("EXAMPLE", Sev::verbose) << "Marker " << bc.first;
420
421 // OK. We have problem with GMesh, it adding empty characters at the end of
422 // block. So first block is search by regexp. popMarkDOFsOnEntities should
423 // work with regexp.
424 std::string reaction_block_set;
425 for (auto bc : bc_map) {
426 if (bc_mng->checkBlock(bc, "REACTION")) {
427 reaction_block_set = bc.first;
428 break;
429 }
430 }
431
432 if (auto bc = bc_mng->popMarkDOFsOnEntities(reaction_block_set)) {
433 reactionMarker = bc->getBcMarkersPtr();
434
435 // Only take reaction from nodes
436 Range nodes;
437 CHKERR mField.get_moab().get_entities_by_type(0, MBVERTEX, nodes, true);
438 CHKERR prb_mng->markDofs(simple->getProblemName(), ROW,
439 ProblemsManager::MarkOP::AND, nodes,
441
442 } else {
443 MOFEM_LOG("EXAMPLE", Sev::warning) << "REACTION blockset does not exist";
444 }
445
446 if (!reactionMarker) {
447 MOFEM_LOG("EXAMPLE", Sev::warning) << "REACTION blockset does not exist";
448 }
449
451}
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition: acoustic.cpp:69
@ ROW
Definition: definitions.h:123
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:301
boost::shared_ptr< std::vector< unsigned char > > reactionMarker
Definition: plastic.cpp:163
Simple interface for fast problem set-up.
Definition: BcManager.hpp:23
Definition of the displacement bc data structure.
Definition: BCData.hpp:72
Problem manager is used to build and partition problems.
Simple interface for fast problem set-up.
Definition: Simple.hpp:26

◆ bC() [2/3]

MoFEMErrorCode Example::bC ( )
private

◆ bC() [3/3]

MoFEMErrorCode Example::bC ( )
private

◆ boundaryCondition() [1/9]

MoFEMErrorCode Example::boundaryCondition ( )
private

[Set up problem]

[Create common data]

[Applying essential BC]

[Boundary condition]

[Define gravity vector]

Examples
eigen_elastic.cpp, heat_method.cpp, helmholtz.cpp, nonlinear_elastic.cpp, plot_base.cpp, and shallow_wave.cpp.

Definition at line 106 of file helmholtz.cpp.

106 {
108
109 auto get_ents_on_mesh_skin = [&]() {
110 Range boundary_entities;
112 std::string entity_name = it->getName();
113 if (entity_name.compare(0, 2, "BC") == 0) {
114 CHKERR it->getMeshsetIdEntitiesByDimension(mField.get_moab(), 1,
115 boundary_entities, true);
116 }
117 }
118 // Add vertices to boundary entities
119 Range boundary_vertices;
120 CHKERR mField.get_moab().get_connectivity(boundary_entities,
121 boundary_vertices, true);
122 boundary_entities.merge(boundary_vertices);
123
124 return boundary_entities;
125 };
126
127 auto mark_boundary_dofs = [&](Range &&skin_edges) {
128 auto problem_manager = mField.getInterface<ProblemsManager>();
129 auto marker_ptr = boost::make_shared<std::vector<unsigned char>>();
130 problem_manager->markDofs(simpleInterface->getProblemName(), ROW,
131 skin_edges, *marker_ptr);
132 return marker_ptr;
133 };
134
135 auto remove_dofs_from_problem = [&](Range &&skin_edges) {
137 auto problem_manager = mField.getInterface<ProblemsManager>();
138 CHKERR problem_manager->removeDofsOnEntities(
139 simpleInterface->getProblemName(), "P_IMAG", skin_edges, 0, 1);
141 };
142
143 // Get global local vector of marked DOFs. Is global, since is set for all
144 // DOFs on processor. Is local since only DOFs on processor are in the
145 // vector. To access DOFs use local indices.
146 boundaryMarker = mark_boundary_dofs(get_ents_on_mesh_skin());
147 CHKERR remove_dofs_from_problem(get_ents_on_mesh_skin());
148
150}
@ BLOCKSET
Definition: definitions.h:148
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
Simple * simpleInterface
Definition: helmholtz.cpp:45
MoFEMErrorCode markDofs(const std::string problem_name, RowColData rc, const enum MarkOP op, const Range ents, std::vector< unsigned char > &marker) const
Create vector with marked indices.
const std::string getProblemName() const
Get the Problem Name.
Definition: Simple.hpp:334

◆ boundaryCondition() [2/9]

MoFEMErrorCode Example::boundaryCondition ( )
private

◆ boundaryCondition() [3/9]

MoFEMErrorCode Example::boundaryCondition ( )
private

◆ boundaryCondition() [4/9]

MoFEMErrorCode Example::boundaryCondition ( )
private

◆ boundaryCondition() [5/9]

MoFEMErrorCode Example::boundaryCondition ( )
private

◆ boundaryCondition() [6/9]

MoFEMErrorCode Example::boundaryCondition ( )
private

◆ boundaryCondition() [7/9]

MoFEMErrorCode Example::boundaryCondition ( )
private

◆ boundaryCondition() [8/9]

MoFEMErrorCode Example::boundaryCondition ( )
private

◆ boundaryCondition() [9/9]

MoFEMErrorCode Example::boundaryCondition ( )
private

◆ calculateFlux()

MoFEMErrorCode Example::calculateFlux ( double calc_flux)
private

[Set up problem]

[Calculate flux on boundary]

Examples
phase.cpp.

Definition at line 402 of file phase.cpp.

402 {
404 auto pipeline_mng = mField.getInterface<PipelineManager>();
405
406 pipeline_mng->getDomainLhsFE().reset();
407 pipeline_mng->getDomainRhsFE().reset();
408 pipeline_mng->getBoundaryRhsFE().reset();
409
410 auto rule_vol = [](int, int, int order) { return 2 * (order + 1); };
411 pipeline_mng->setBoundaryRhsIntegrationRule(rule_vol);
412
413 auto flux_ptr = boost::make_shared<MatrixDouble>();
414 pipeline_mng->getOpBoundaryRhsPipeline().push_back(
416 pipeline_mng->getOpBoundaryRhsPipeline().push_back(
417 new OpCalculateHVecVectorField<3>("S", flux_ptr));
418 pipeline_mng->getOpBoundaryRhsPipeline().push_back(
419 new BoundaryOp(flux_ptr, calc_flux));
420
421 calc_flux = 0;
422 CHKERR pipeline_mng->loopFiniteElements();
423 double global_flux_assembeld = 0;
424 MPI_Allreduce(&calc_flux, &global_flux_assembeld, 1, MPI_DOUBLE, MPI_SUM,
425 mField.get_comm());
426 calc_flux = global_flux_assembeld;
427
429}
virtual MPI_Comm & get_comm() const =0
Get vector field for H-div approximation.

◆ checkResults() [1/12]

MoFEMErrorCode Example::checkResults ( )
private

[Postprocess results]

[Postprocessing results]

[Print results]

[Check]

[Check results]

[Test example]

Examples
contact.cpp, eigen_elastic.cpp, heat_method.cpp, helmholtz.cpp, nonlinear_elastic.cpp, plot_base.cpp, and shallow_wave.cpp.

Definition at line 659 of file contact.cpp.

659{ return 0; }

◆ checkResults() [2/12]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [3/12]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [4/12]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [5/12]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [6/12]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [7/12]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [8/12]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [9/12]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [10/12]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [11/12]

MoFEMErrorCode Example::checkResults ( )
private

◆ checkResults() [12/12]

MoFEMErrorCode Example::checkResults ( )
private

◆ createCommonData() [1/11]

MoFEMErrorCode Example::createCommonData ( )
private

[Set up problem]

[Set integration rule]

[Create common data]

Examples
contact.cpp, eigen_elastic.cpp, heat_method.cpp, nonlinear_elastic.cpp, plastic.cpp, plot_base.cpp, and shallow_wave.cpp.

Definition at line 259 of file plastic.cpp.

259 {
261
262 auto get_command_line_parameters = [&]() {
264 CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-scale", &scale, PETSC_NULL);
265 CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-rho", &rho, PETSC_NULL);
266 CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-young_modulus",
267 &young_modulus, PETSC_NULL);
268 CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-poisson_ratio",
269 &poisson_ratio, PETSC_NULL);
270 CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-hardening", &H, PETSC_NULL);
271 CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-hardening_viscous", &visH,
272 PETSC_NULL);
273 CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-yield_stress", &sigmaY,
274 PETSC_NULL);
275 CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-cn", &cn, PETSC_NULL);
276 CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-zeta", &zeta, PETSC_NULL);
277 CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-eta", &zeta, PETSC_NULL);
278 CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-Qinf", &Qinf, PETSC_NULL);
279 CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-b_iso", &b_iso, PETSC_NULL);
280 CHKERR PetscOptionsGetBool(PETSC_NULL, "", "-large_strains",
281 &is_large_strains, PETSC_NULL);
282
283 CHKERR PetscOptionsGetInt(PETSC_NULL, "", "-order", &order, PETSC_NULL);
284 CHKERR PetscOptionsGetInt(PETSC_NULL, "", "-geom_order", &geom_order,
285 PETSC_NULL);
286
287 MOFEM_LOG("EXAMPLE", Sev::inform) << "Young modulus " << young_modulus;
288 MOFEM_LOG("EXAMPLE", Sev::inform) << "Poisson ratio " << poisson_ratio;
289 MOFEM_LOG("EXAMPLE", Sev::inform) << "Yield stress " << sigmaY;
290 MOFEM_LOG("EXAMPLE", Sev::inform) << "Hardening " << H;
291 MOFEM_LOG("EXAMPLE", Sev::inform) << "Viscous hardening " << visH;
292 MOFEM_LOG("EXAMPLE", Sev::inform) << "Saturation yield stress " << Qinf;
293 MOFEM_LOG("EXAMPLE", Sev::inform) << "Saturation exponent " << b_iso;
294 MOFEM_LOG("EXAMPLE", Sev::inform) << "cn " << cn;
295 MOFEM_LOG("EXAMPLE", Sev::inform) << "zeta " << zeta;
296 MOFEM_LOG("EXAMPLE", Sev::inform) << "eta " << zeta;
297
298 MOFEM_LOG("EXAMPLE", Sev::inform) << "order " << order;
299 MOFEM_LOG("EXAMPLE", Sev::inform) << "geom order " << geom_order;
300
301 PetscBool is_scale = PETSC_TRUE;
302 CHKERR PetscOptionsGetBool(PETSC_NULL, "", "-is_scale", &is_scale,
303 PETSC_NULL);
304 if (is_scale) {
307 rho *= scale;
308 sigmaY *= scale;
309 H *= scale;
310 Qinf *= scale;
311 visH *= scale;
312
313 MOFEM_LOG("EXAMPLE", Sev::inform)
314 << "Scaled Young modulus " << young_modulus;
315 MOFEM_LOG("EXAMPLE", Sev::inform)
316 << "Scaled Poisson ratio " << poisson_ratio;
317 MOFEM_LOG("EXAMPLE", Sev::inform) << "Scaled Yield stress " << sigmaY;
318 MOFEM_LOG("EXAMPLE", Sev::inform) << "Scaled Hardening " << H;
319 MOFEM_LOG("EXAMPLE", Sev::inform) << "Scaled Viscous hardening " << visH;
320 MOFEM_LOG("EXAMPLE", Sev::inform)
321 << "Scaled Saturation yield stress " << Qinf;
322 }
323
325 };
326
327 auto set_matrial_stiffness = [&]() {
334 const double bulk_modulus_K = young_modulus / (3 * (1 - 2 * poisson_ratio));
335 const double shear_modulus_G = young_modulus / (2 * (1 + poisson_ratio));
336
337 // Plane stress or when 1, plane strain or 3d
338 const double A = (SPACE_DIM == 2)
339 ? 2 * shear_modulus_G /
340 (bulk_modulus_K + (4. / 3.) * shear_modulus_G)
341 : 1;
342
343 auto t_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(
344 *commonPlasticDataPtr->mDPtr);
345 auto t_D_axiator = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(
346 *commonPlasticDataPtr->mDPtr_Axiator);
347 auto t_D_deviator = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(
348 *commonPlasticDataPtr->mDPtr_Deviator);
349
350 constexpr double third = boost::math::constants::third<double>();
351 t_D_axiator(i, j, k, l) = A *
352 (bulk_modulus_K - (2. / 3.) * shear_modulus_G) *
353 t_kd(i, j) * t_kd(k, l);
354 t_D_deviator(i, j, k, l) =
355 2 * shear_modulus_G * ((t_kd(i, k) ^ t_kd(j, l)) / 4.);
356 t_D(i, j, k, l) = t_D_axiator(i, j, k, l) + t_D_deviator(i, j, k, l);
357
359 };
360
361 auto make_d_mat = []() {
362 return boost::make_shared<MatrixDouble>(size_symm * size_symm, 1);
363 };
364
365 commonPlasticDataPtr = boost::make_shared<PlasticOps::CommonData>();
366 commonPlasticDataPtr->mDPtr = make_d_mat();
367 commonPlasticDataPtr->mDPtr_Axiator = make_d_mat();
368 commonPlasticDataPtr->mDPtr_Deviator = make_d_mat();
369
370 commonPlasticDataPtr->mGradPtr = boost::make_shared<MatrixDouble>();
371 commonPlasticDataPtr->mStrainPtr = boost::make_shared<MatrixDouble>();
372 commonPlasticDataPtr->mStressPtr = boost::make_shared<MatrixDouble>();
373
374 CHKERR get_command_line_parameters();
375 CHKERR set_matrial_stiffness();
376
377 if (is_large_strains) {
378 commonHenckyDataPtr = boost::make_shared<HenckyOps::CommonData>();
379 commonHenckyDataPtr->matGradPtr = commonPlasticDataPtr->mGradPtr;
381 commonHenckyDataPtr->matLogCPlastic =
382 commonPlasticDataPtr->getPlasticStrainPtr();
383 commonPlasticDataPtr->mStrainPtr = commonHenckyDataPtr->getMatLogC();
384 commonPlasticDataPtr->mStressPtr =
385 commonHenckyDataPtr->getMatHenckyStress();
386 }
387
389}
constexpr double third
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
double Qinf
Definition: plastic.cpp:116
double rho
Definition: plastic.cpp:109
double visH
Definition: plastic.cpp:112
double scale
Definition: plastic.cpp:105
double zeta
Definition: plastic.cpp:114
double H
Definition: plastic.cpp:111
double b_iso
Definition: plastic.cpp:117
PetscBool is_large_strains
Definition: plastic.cpp:103
int geom_order
Order if fixed.
Definition: plastic.cpp:120
double sigmaY
Definition: plastic.cpp:110
double cn
Definition: plastic.cpp:113
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'i', 3 > i
boost::shared_ptr< PlasticOps::CommonData > commonPlasticDataPtr
Definition: plastic.cpp:154
boost::shared_ptr< HenckyOps::CommonData > commonHenckyDataPtr
Definition: plastic.cpp:155

◆ createCommonData() [2/11]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [3/11]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [4/11]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [5/11]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [6/11]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [7/11]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [8/11]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [9/11]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [10/11]

MoFEMErrorCode Example::createCommonData ( )
private

◆ createCommonData() [11/11]

MoFEMErrorCode Example::createCommonData ( )
private

◆ getCoordsInImage()

std::pair< int, int > Example::getCoordsInImage ( double  x,
double  y 
)
staticprivate
Examples
phase.cpp.

Definition at line 131 of file phase.cpp.

131 {
132
133 auto &m = iI[focalIndex];
134 x -= aveMaxMin[MIN_X];
135 y -= aveMaxMin[MIN_Y];
136 x *= (m.size1() - 1) / (aveMaxMin[MAX_X] - aveMaxMin[MIN_X]);
137 y *= (m.size2() - 1) / (aveMaxMin[MAX_Y] - aveMaxMin[MIN_Y]);
138 const auto p = std::make_pair<int, int>(std::round(x), std::round(y));
139
140#ifndef NDEBUG
141 if (p.first < 0 && p.first >= m.size1())
142 THROW_MESSAGE("Wrong index");
143 if (p.second < 0 && p.second >= m.size2())
144 THROW_MESSAGE("Wrong index");
145#endif
146
147 return p;
148}
static Index< 'p', 3 > p
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
Definition: definitions.h:561
FTensor::Index< 'm', 3 > m
static std::array< double, LAST_BB > aveMaxMin
Definition: phase.cpp:110
static int focalIndex
Definition: phase.cpp:112
static std::vector< MatrixInt > iI
Definition: phase.cpp:109

◆ getEntsOnMeshSkin()

template<int DIM>
Range Example::getEntsOnMeshSkin
private

[Check]

Examples
contact.cpp.

Definition at line 662 of file contact.cpp.

662 {
663 Range body_ents;
664 CHKERR mField.get_moab().get_entities_by_dimension(0, DIM, body_ents);
665 Skinner skin(&mField.get_moab());
666 Range skin_ents;
667 CHKERR skin.find_skin(0, body_ents, false, skin_ents);
668
669 return skin_ents;
670};

◆ integrateElements()

MoFEMErrorCode Example::integrateElements ( )
private

[Push operators to pipeline]

[Integrate]

Definition at line 218 of file integration.cpp.

218 {
220 // Zero global vector
221 CHKERR VecZeroEntries(commonDataPtr->petscVec);
222
223 // Integrate elements by executing operators in the pipeline
225 CHKERR pipeline_mng->loopFiniteElements();
226
227 // Assemble MPI vector
228 CHKERR VecAssemblyBegin(commonDataPtr->petscVec);
229 CHKERR VecAssemblyEnd(commonDataPtr->petscVec);
231}
MoFEMErrorCode loopFiniteElements(SmartPetscObj< DM > dm=nullptr)
Iterate finite elements.
boost::shared_ptr< ContactOps::CommonData > commonDataPtr
Definition: contact.cpp:150

◆ integrationRule()

static int Example::integrationRule ( int  ,
int  ,
int  p_data 
)
inlinestaticprivate

Definition at line 52 of file radiation.cpp.

52{ return 2 * p_data; };

◆ kspSolve()

MoFEMErrorCode Example::kspSolve ( )
private

[Push operators to pipeline]

[Solve]

Definition at line 230 of file radiation.cpp.

230 {
234 auto ts = pipeline_mng->createTSIM();
235
236 double ftime = 1;
237 CHKERR TSSetDuration(ts, PETSC_DEFAULT, ftime);
238 CHKERR TSSetFromOptions(ts);
239 CHKERR TSSetExactFinalTime(ts, TS_EXACTFINALTIME_MATCHSTEP);
240
241 auto T = smartCreateDMVector(simple->getDM());
242 CHKERR DMoFEMMeshToLocalVector(simple->getDM(), T, INSERT_VALUES,
243 SCATTER_FORWARD);
244
245 CHKERR TSSolve(ts, T);
246 CHKERR TSGetTime(ts, &ftime);
247
248 PetscInt steps, snesfails, rejects, nonlinits, linits;
249 CHKERR TSGetTimeStepNumber(ts, &steps);
250 CHKERR TSGetSNESFailures(ts, &snesfails);
251 CHKERR TSGetStepRejections(ts, &rejects);
252 CHKERR TSGetSNESIterations(ts, &nonlinits);
253 CHKERR TSGetKSPIterations(ts, &linits);
254 MOFEM_LOG_C("EXAMPLE", Sev::inform,
255 "steps %d (%d rejected, %d SNES fails), ftime %g, nonlinits "
256 "%d, linits %d",
257 steps, rejects, snesfails, ftime, nonlinits, linits);
258
260}
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:304
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
Definition: DMMMoFEM.cpp:470
auto smartCreateDMVector(DM dm)
Get smart vector from DM.
Definition: DMMoFEM.hpp:965
SmartPetscObj< TS > createTSIM(SmartPetscObj< DM > dm=nullptr)
Create TS (time) implicit solver.
const double T

◆ lhsFlux()

double Example::lhsFlux ( const double  x,
const double  y,
const double   
)
staticprivate
Examples
phase.cpp.

Definition at line 165 of file phase.cpp.

165 {
166 const auto idx = getCoordsInImage(x, y);
167 const auto &m = iI[focalIndex];
168 return 1. / m(idx.first, idx.second);
169}
static std::pair< int, int > getCoordsInImage(double x, double y)
Definition: phase.cpp:131

◆ OPs() [1/3]

MoFEMErrorCode Example::OPs ( )
private

[Boundary condition]

[Push operators to pipeline]

Examples
contact.cpp, and plastic.cpp.

Definition at line 455 of file plastic.cpp.

455 {
457 auto pipeline_mng = mField.getInterface<PipelineManager>();
459 auto bc_mng = mField.getInterface<BcManager>();
460
461 auto add_domain_base_ops = [&](auto &pipeline) {
463
465 "GEOMETRY");
466
467 pipeline.push_back(new OpCalculateScalarFieldValuesDot(
468 "TAU", commonPlasticDataPtr->getPlasticTauDotPtr()));
469 pipeline.push_back(new OpCalculateScalarFieldValues(
470 "TAU", commonPlasticDataPtr->getPlasticTauPtr()));
472 "EP", commonPlasticDataPtr->getPlasticStrainPtr()));
474 "EP", commonPlasticDataPtr->getPlasticStrainDotPtr()));
476 "U", commonPlasticDataPtr->mGradPtr));
477
479 };
480
481 auto add_domain_stress_ops = [&](auto &pipeline, auto m_D_ptr) {
483
484 if (is_large_strains) {
485
486 if (commonPlasticDataPtr->mGradPtr != commonHenckyDataPtr->matGradPtr)
487 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
488 "Wrong pointer for grad");
489
490 pipeline.push_back(
492 pipeline.push_back(
494 pipeline.push_back(
496 pipeline.push_back(new OpCalculateHenckyPlasticStress<SPACE_DIM>(
497 "U", commonHenckyDataPtr, m_D_ptr));
498 pipeline.push_back(
500
501 } else {
502 pipeline.push_back(
504 commonPlasticDataPtr->mStrainPtr));
505 pipeline.push_back(
506 new OpPlasticStress("U", commonPlasticDataPtr, m_D_ptr, 1));
507 }
508
509 if (m_D_ptr != commonPlasticDataPtr->mDPtr_Axiator) {
510 pipeline.push_back(
512 pipeline.push_back(
514 }
515
517 };
518
519 auto add_domain_ops_lhs_mechanical = [&](auto &pipeline, auto m_D_ptr) {
521 pipeline.push_back(new OpSetBc("U", true, boundaryMarker));
522
523 if (is_large_strains) {
524 pipeline.push_back(
526 pipeline.push_back(
527 new OpKPiola("U", "U", commonHenckyDataPtr->getMatTangent()));
529 "U", "EP", commonPlasticDataPtr, commonHenckyDataPtr, m_D_ptr));
530 // pipeline.push_back(new OpCalculateArgLhs_LogStrain_dUdTau(
531 // "U", "TAU", commonPlasticDataPtr, commonHenckyDataPtr));
532 // pipeline.push_back(new OpCalculateArgLhs_LogStrain_dUdU(
533 // "U", "U", commonPlasticDataPtr, commonHenckyDataPtr));
534 } else {
535 pipeline.push_back(new OpKCauchy("U", "U", m_D_ptr));
536 pipeline.push_back(new OpCalculatePlasticInternalForceLhs_dEP(
537 "U", "EP", commonPlasticDataPtr, m_D_ptr));
538 // pipeline.push_back(
539 // new OpCalculateArgLhs_dUdTau("U", "TAU", commonPlasticDataPtr));
540 // pipeline.push_back(
541 // new OpCalculateArgLhs_dUdU("U", "U", commonPlasticDataPtr));
542 }
543
544 pipeline.push_back(new OpUnSetBc("U"));
546 };
547
548 auto add_domain_ops_rhs_mechanical = [&](auto &pipeline) {
550 pipeline.push_back(new OpSetBc("U", true, boundaryMarker));
551
553 pipeline, mField, "U", {boost::make_shared<PlasticityTimeScale>()},
554 "BODY_FORCE", Sev::inform);
555
556 // Calculate internal forces
557 if (is_large_strains) {
558 pipeline.push_back(new OpInternalForcePiola(
559 "U", commonHenckyDataPtr->getMatFirstPiolaStress()));
560 } else {
561 pipeline.push_back(
562 new OpInternalForceCauchy("U", commonPlasticDataPtr->mStressPtr));
563 }
564
565 pipeline.push_back(new OpUnSetBc("U"));
567 };
568
569 auto add_domain_ops_lhs_constrain = [&](auto &pipeline, auto m_D_ptr) {
571 pipeline.push_back(new OpSetBc("U", true, boundaryMarker));
572
573 if (is_large_strains) {
574 pipeline.push_back(new OpCalculateConstraintsLhs_LogStrain_dU(
575 "TAU", "U", commonPlasticDataPtr, commonHenckyDataPtr, m_D_ptr));
576 pipeline.push_back(new OpCalculatePlasticFlowLhs_LogStrain_dU(
577 "EP", "U", commonPlasticDataPtr, commonHenckyDataPtr, m_D_ptr));
578 } else {
579 pipeline.push_back(new OpCalculateConstraintsLhs_dU(
580 "TAU", "U", commonPlasticDataPtr, m_D_ptr));
581 pipeline.push_back(new OpCalculatePlasticFlowLhs_dU(
582 "EP", "U", commonPlasticDataPtr, m_D_ptr));
583 }
584
585 pipeline.push_back(new OpCalculatePlasticFlowLhs_dEP(
586 "EP", "EP", commonPlasticDataPtr, m_D_ptr));
587 pipeline.push_back(new OpCalculatePlasticFlowLhs_dTAU(
588 "EP", "TAU", commonPlasticDataPtr, m_D_ptr));
589 pipeline.push_back(new OpCalculateConstraintsLhs_dEP(
590 "TAU", "EP", commonPlasticDataPtr, m_D_ptr));
591 pipeline.push_back(
593
594 pipeline.push_back(new OpUnSetBc("U"));
596 };
597
598 auto add_domain_ops_rhs_constrain = [&](auto &pipeline, auto m_D_ptr) {
600 pipeline.push_back(new OpSetBc("U", true, boundaryMarker));
601
602 pipeline.push_back(
604 pipeline.push_back(
606
607 // if (is_large_strains) {
608 // pipeline.push_back(new OpCalculateArgRhs_LogStrain_dU(
609 // "U", commonPlasticDataPtr, commonHenckyDataPtr));
610 // } else {
611 // pipeline.push_back(new OpCalculateArgRhs_dU("U", commonPlasticDataPtr));
612 // }
613
614 pipeline.push_back(new OpUnSetBc("U"));
616 };
617
618 auto add_boundary_ops_lhs_mechanical = [&](auto &pipeline) {
622 mField, pipeline, simple->getProblemName(), "U");
624 };
625
626 auto add_boundary_ops_rhs_mechanical = [&](auto &pipeline) {
628
630 pipeline, {NOSPACE}, "GEOMETRY");
631
632 pipeline.push_back(new OpSetBc("U", true, boundaryMarker));
634 pipeline, mField, "U", {boost::make_shared<PlasticityTimeScale>()},
635 "FORCE", Sev::inform);
636
637 pipeline.push_back(new OpUnSetBc("U"));
638
639 auto u_mat_ptr = boost::make_shared<MatrixDouble>();
640 pipeline.push_back(
641 new OpCalculateVectorFieldValues<SPACE_DIM>("U", u_mat_ptr));
642
645 mField, pipeline, simple->getProblemName(), "U", u_mat_ptr,
646 {boost::make_shared<TimeScale>()}); // note displacements have no
647 // scaling
648
650 };
651
652 CHKERR add_domain_base_ops(pipeline_mng->getOpDomainLhsPipeline());
653 CHKERR add_domain_stress_ops(pipeline_mng->getOpDomainLhsPipeline(),
654 commonPlasticDataPtr->mDPtr);
655 CHKERR add_domain_ops_lhs_mechanical(pipeline_mng->getOpDomainLhsPipeline(),
656 commonPlasticDataPtr->mDPtr);
657 CHKERR add_domain_ops_lhs_constrain(pipeline_mng->getOpDomainLhsPipeline(),
658 commonPlasticDataPtr->mDPtr);
659 CHKERR
660 add_boundary_ops_lhs_mechanical(pipeline_mng->getOpBoundaryLhsPipeline());
661
662 CHKERR add_domain_base_ops(pipeline_mng->getOpDomainRhsPipeline());
663 CHKERR add_domain_stress_ops(pipeline_mng->getOpDomainRhsPipeline(),
664 commonPlasticDataPtr->mDPtr);
665 CHKERR add_domain_ops_rhs_mechanical(pipeline_mng->getOpDomainRhsPipeline());
666 CHKERR add_domain_ops_rhs_constrain(pipeline_mng->getOpDomainRhsPipeline(),
667 commonPlasticDataPtr->mDPtr);
668
669 // Boundary
670 CHKERR
671 add_boundary_ops_rhs_mechanical(pipeline_mng->getOpBoundaryRhsPipeline());
672
673 auto integration_rule_bc = [](int, int, int ao) { return 2 * ao; };
674
675 auto vol_rule = [](int, int, int ao) { return 2 * ao + geom_order - 1; };
676
677 CHKERR pipeline_mng->setDomainRhsIntegrationRule(vol_rule);
678 CHKERR pipeline_mng->setDomainLhsIntegrationRule(vol_rule);
679
680 CHKERR pipeline_mng->setBoundaryLhsIntegrationRule(integration_rule_bc);
681 CHKERR pipeline_mng->setBoundaryRhsIntegrationRule(integration_rule_bc);
682
683 auto create_reaction_pipeline = [&](auto &pipeline) {
685
686 if (reactionMarker) {
687
689 "GEOMETRY");
690
691 pipeline.push_back(
693 "U", commonPlasticDataPtr->mGradPtr));
695 "EP", commonPlasticDataPtr->getPlasticStrainPtr()));
696
697 if (is_large_strains) {
698
699 if (commonPlasticDataPtr->mGradPtr != commonHenckyDataPtr->matGradPtr)
700 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
701 "Wrong pointer for grad");
702
703 pipeline.push_back(
705 pipeline.push_back(
707 pipeline.push_back(
709 pipeline.push_back(new OpCalculateHenckyPlasticStress<SPACE_DIM>(
711 pipeline.push_back(
713
714 } else {
715 pipeline.push_back(new OpSymmetrizeTensor<SPACE_DIM>(
716 "U", commonPlasticDataPtr->mGradPtr,
717 commonPlasticDataPtr->mStrainPtr));
718 pipeline.push_back(new OpPlasticStress(
720 }
721
722 pipeline.push_back(new OpSetBc("U", false, reactionMarker));
723 // Calculate internal force
724 if (is_large_strains) {
725 pipeline.push_back(new OpInternalForcePiola(
726 "U", commonHenckyDataPtr->getMatFirstPiolaStress()));
727 } else {
728 pipeline.push_back(
729 new OpInternalForceCauchy("U", commonPlasticDataPtr->mStressPtr));
730 }
731 pipeline.push_back(new OpUnSetBc("U"));
732 }
733
735 };
736
737 reactionFe = boost::make_shared<DomainEle>(mField);
738 reactionFe->getRuleHook = vol_rule;
739
740 CHKERR create_reaction_pipeline(reactionFe->getOpPtrVector());
741
743}
@ L2
field with C-1 continuity
Definition: definitions.h:88
@ NOSPACE
Definition: definitions.h:83
OpCalculateScalarFieldValuesFromPetscVecImpl< PetscData::CTX_SET_X_T > OpCalculateScalarFieldValuesDot
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< G >::OpGradTimesTensor< 1, SPACE_DIM, SPACE_DIM > OpInternalForcePiola
Definition: plastic.cpp:77
FormsIntegrators< DomainEleOp >::Assembly< A >::BiLinearForm< GAUSS >::OpGradSymTensorGrad< 1, SPACE_DIM, SPACE_DIM, 0 > OpKCauchy
[Only used with Hooke equation (linear material model)]
Definition: plastic.cpp:61
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< G >::OpGradTimesSymTensor< 1, SPACE_DIM, SPACE_DIM > OpInternalForceCauchy
Definition: plastic.cpp:63
FormsIntegrators< DomainEleOp >::Assembly< A >::BiLinearForm< GAUSS >::OpGradTensorGrad< 1, SPACE_DIM, SPACE_DIM, 1 > OpKPiola
[Only used for dynamics]
Definition: plastic.cpp:75
boost::shared_ptr< DomainEle > reactionFe
Definition: plastic.cpp:156
Add operators pushing bases from local to physical configuration.
Natural boundary conditions.
Definition: Essential.hpp:101
Get value at integration points for scalar field.
Calculate symmetric tensor field rates ant integratio pts.
Calculate symmetric tensor field values at integration pts.
Get field gradients at integration pts for scalar filed rank 0, i.e. vector field.
Get values at integration pts for tensor filed rank 1, i.e. vector field.

◆ OPs() [2/3]

MoFEMErrorCode Example::OPs ( )
private

◆ OPs() [3/3]

MoFEMErrorCode Example::OPs ( )
private

◆ outputResults() [1/10]

MoFEMErrorCode Example::outputResults ( )
private

[Solve]

[Postprocess results]

Examples
eigen_elastic.cpp, heat_method.cpp, helmholtz.cpp, nonlinear_elastic.cpp, phase.cpp, plot_base.cpp, and shallow_wave.cpp.

Definition at line 255 of file helmholtz.cpp.

255 {
258 pipeline_mng->getDomainLhsFE().reset();
259 pipeline_mng->getDomainRhsFE().reset();
260 pipeline_mng->getBoundaryLhsFE().reset();
261 pipeline_mng->getBoundaryRhsFE().reset();
262
264
265 auto post_proc_fe = boost::make_shared<PostProcEle>(mField);
266
267 auto p_real_ptr = boost::make_shared<VectorDouble>();
268 auto p_imag_ptr = boost::make_shared<VectorDouble>();
269
270 post_proc_fe->getOpPtrVector().push_back(
271 new OpCalculateScalarFieldValues("P_REAL", p_real_ptr));
272 post_proc_fe->getOpPtrVector().push_back(
273 new OpCalculateScalarFieldValues("P_IMAG", p_imag_ptr));
274
276
277 post_proc_fe->getOpPtrVector().push_back(
278
279 new OpPPMap(
280
281 post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(),
282
283 {{"P_REAL", p_real_ptr}, {"P_IMAG", p_imag_ptr}},
284
285 {}, {}, {}
286
287 )
288
289 );
290
291 pipeline_mng->getDomainRhsFE() = post_proc_fe;
292 CHKERR pipeline_mng->loopFiniteElements();
293 CHKERR post_proc_fe->writeFile("out_helmholtz.h5m");
295}
ElementsAndOps< SPACE_DIM >::PostProcEle PostProcEle
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
Post post-proc data at points from hash maps.
boost::shared_ptr< FEMethod > & getDomainRhsFE()
boost::shared_ptr< FEMethod > & getBoundaryLhsFE()
boost::shared_ptr< FEMethod > & getBoundaryRhsFE()

◆ outputResults() [2/10]

MoFEMErrorCode Example::outputResults ( )
private

◆ outputResults() [3/10]

MoFEMErrorCode Example::outputResults ( )
private

◆ outputResults() [4/10]

MoFEMErrorCode Example::outputResults ( )
private

◆ outputResults() [5/10]

MoFEMErrorCode Example::outputResults ( )
private

◆ outputResults() [6/10]

MoFEMErrorCode Example::outputResults ( )
private

◆ outputResults() [7/10]

MoFEMErrorCode Example::outputResults ( )
private

◆ outputResults() [8/10]

MoFEMErrorCode Example::outputResults ( )
private

◆ outputResults() [9/10]

MoFEMErrorCode Example::outputResults ( )
private

◆ outputResults() [10/10]

MoFEMErrorCode Example::outputResults ( const int  i)
private

[Solve]

[Postprocess results]

Definition at line 504 of file phase.cpp.

504 {
507 pipeline_mng->getDomainLhsFE().reset();
508 pipeline_mng->getDomainRhsFE().reset();
509 pipeline_mng->getBoundaryRhsFE().reset();
510
512
513 auto post_proc_fe = boost::make_shared<PostProcEle>(mField);
514 auto jac_ptr = boost::make_shared<MatrixDouble>();
515 post_proc_fe->getOpPtrVector().push_back(
516 new OpCalculateHOJacForFace(jac_ptr));
517 post_proc_fe->getOpPtrVector().push_back(new OpMakeHdivFromHcurl());
518 post_proc_fe->getOpPtrVector().push_back(
520
521 auto s_ptr = boost::make_shared<VectorDouble>();
522 auto phi_ptr = boost::make_shared<MatrixDouble>();
523 post_proc_fe->getOpPtrVector().push_back(
524 new OpCalculateScalarFieldValues("S", s_ptr));
525 post_proc_fe->getOpPtrVector().push_back(
526 new OpCalculateHVecVectorField<3>("PHI", phi_ptr));
527
529
530 post_proc_fe->getOpPtrVector().push_back(
531
532 new OpPPMap(post_proc_fe->getPostProcMesh(),
533 post_proc_fe->getMapGaussPts(),
534
535 OpPPMap::DataMapVec{{"S", s_ptr}},
536
537 OpPPMap::DataMapMat{{"PHI", phi_ptr}},
538
540
542
543 )
544
545 );
546
547 // post_proc_fe->addFieldValuesPostProc("S");
548 // post_proc_fe->addFieldValuesPostProc("PHI");
549
550
551 pipeline_mng->getDomainRhsFE() = post_proc_fe;
552 CHKERR pipeline_mng->loopFiniteElements();
553 CHKERR post_proc_fe->writeFile("out_" + boost::lexical_cast<std::string>(i) +
554 ".h5m");
556}
std::map< std::string, boost::shared_ptr< VectorDouble > > DataMapVec
std::map< std::string, boost::shared_ptr< MatrixDouble > > DataMapMat

◆ postProcess() [1/3]

MoFEMErrorCode Example::postProcess ( )
private

[Solve]

[Integrate]

[Postprocess results]

[Print results]

Examples
contact.cpp.

Definition at line 655 of file contact.cpp.

655{ return 0; }

◆ postProcess() [2/3]

MoFEMErrorCode Example::postProcess ( )
private

◆ postProcess() [3/3]

MoFEMErrorCode Example::postProcess ( )
private

◆ pushOperators()

MoFEMErrorCode Example::pushOperators ( )
private

[Set density distribution]

[Push operators to pipeline]

Definition at line 188 of file integration.cpp.

188 {
191
192 // Push an operator which calculates values of density at integration points
193 pipeline_mng->getOpDomainRhsPipeline().push_back(
195 "rho", commonDataPtr->getRhoAtIntegrationPtsPtr()));
196
197 // Push an operator to pipeline to calculate zero moment of inertia (mass)
198 pipeline_mng->getOpDomainRhsPipeline().push_back(new OpZero(commonDataPtr));
199
200 // Push an operator to the pipeline to calculate first moment of inertaia
201 pipeline_mng->getOpDomainRhsPipeline().push_back(new OpFirst(commonDataPtr));
202
203 // Push an operator to the pipeline to calculate second moment of inertaia
204 pipeline_mng->getOpDomainRhsPipeline().push_back(new OpSecond(commonDataPtr));
205
206 // Set integration rule. Integration rule is equal to the polynomial order of
207 // the density field plus 2, since under the integral of the second moment of
208 // inertia term x*x is present
209 auto integration_rule = [](int, int, int p_data) { return p_data + 2; };
210
211 // Add integration rule to the element
214}
boost::ptr_vector< UserDataOperator > & getOpDomainRhsPipeline()
Get the Op Domain Rhs Pipeline object.
MoFEMErrorCode setDomainRhsIntegrationRule(RuleHookFun rule)

◆ readMesh() [1/10]

MoFEMErrorCode Example::readMesh ( )
private

[run problem]

[Run problem]

[Run programme]

[Read mesh]

Examples
eigen_elastic.cpp, heat_method.cpp, helmholtz.cpp, nonlinear_elastic.cpp, phase.cpp, plot_base.cpp, and shallow_wave.cpp.

Definition at line 73 of file helmholtz.cpp.

73 {
75
79
81}
MoFEMErrorCode getOptions()
get options
Definition: Simple.cpp:289
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name)
Load mesh file.
Definition: Simple.cpp:303

◆ readMesh() [2/10]

MoFEMErrorCode Example::readMesh ( )
private

◆ readMesh() [3/10]

MoFEMErrorCode Example::readMesh ( )
private

◆ readMesh() [4/10]

MoFEMErrorCode Example::readMesh ( )
private

◆ readMesh() [5/10]

MoFEMErrorCode Example::readMesh ( )
private

◆ readMesh() [6/10]

MoFEMErrorCode Example::readMesh ( )
private

◆ readMesh() [7/10]

MoFEMErrorCode Example::readMesh ( )
private

◆ readMesh() [8/10]

MoFEMErrorCode Example::readMesh ( )
private

◆ readMesh() [9/10]

MoFEMErrorCode Example::readMesh ( )
private

◆ readMesh() [10/10]

MoFEMErrorCode Example::readMesh ( )
private

◆ rhsSource()

double Example::rhsSource ( const double  x,
const double  y,
const double   
)
staticprivate
Examples
phase.cpp.

Definition at line 150 of file phase.cpp.

150 {
151 const auto idx = getCoordsInImage(x, y);
152
153 double v = 0;
154 for (auto w = 0; w != window_savitzky_golay; ++w) {
155 const auto i = focalIndex - (window_savitzky_golay - 1) / 2 + w;
156 const auto &intensity = iI[i];
157 v += intensity(idx.first, idx.second) * savitzkyGolayWeights[w];
158 }
159 v = static_cast<double>(v) / savitzkyGolayNormalisation;
160
161 const auto dz = rZ[focalIndex + 1] - rZ[focalIndex - 1];
162 return -k * v / dz;
163}
const double v
phase velocity of light in medium (cm/ns)
double w(const double g, const double t)
static int window_savitzky_golay
Definition: phase.cpp:77
static int savitzkyGolayNormalisation
Definition: phase.cpp:113
static std::vector< double > rZ
Definition: phase.cpp:108
static const int * savitzkyGolayWeights
Definition: phase.cpp:114

◆ runProblem() [1/14]

MoFEMErrorCode Example::runProblem ( )

[Run problem]

[Create common data]

[Run programme]

[Operator]

[run problem]

[Run all]

[Run problem]

Examples
contact.cpp, eigen_elastic.cpp, heat_method.cpp, helmholtz.cpp, nonlinear_elastic.cpp, phase.cpp, plastic.cpp, plot_base.cpp, and shallow_wave.cpp.

Definition at line 174 of file plastic.cpp.

174 {
178 CHKERR bC();
179 CHKERR OPs();
180 CHKERR tsSolve();
182}
MoFEMErrorCode tsSolve()
[Push operators to pipeline]
Definition: plastic.cpp:747
MoFEMErrorCode createCommonData()
[Set up problem]
Definition: plastic.cpp:259
MoFEMErrorCode OPs()
[Boundary condition]
Definition: plastic.cpp:455
MoFEMErrorCode setupProblem()
[Run problem]
Definition: plastic.cpp:186
MoFEMErrorCode bC()
[Create common data]
Definition: plastic.cpp:393

◆ runProblem() [2/14]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [3/14]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [4/14]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [5/14]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [6/14]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [7/14]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [8/14]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [9/14]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [10/14]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [11/14]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [12/14]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [13/14]

MoFEMErrorCode Example::runProblem ( )

◆ runProblem() [14/14]

MoFEMErrorCode Example::runProblem ( )

◆ setFieldValues()

MoFEMErrorCode Example::setFieldValues ( )
private

[Create common data]

[Set density distribution]

Definition at line 172 of file integration.cpp.

172 {
174 auto set_density = [&](VectorAdaptor &&field_data, double *xcoord,
175 double *ycoord, double *zcoord) {
177 field_data[0] = 1;
179 };
180 FieldBlas *field_blas;
181 CHKERR mField.getInterface(field_blas);
182 CHKERR field_blas->setVertexDofs(set_density, "rho");
184}
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
VectorShallowArrayAdaptor< double > VectorAdaptor
Definition: Types.hpp:115
Basic algebra on fields.
Definition: FieldBlas.hpp:21
MoFEMErrorCode setVertexDofs(VertexCoordsFunction lambda, const std::string field_name, Range *verts=nullptr)
Set DOFs on vertices using user function.
Definition: FieldBlas.cpp:320

◆ setIntegrationRules() [1/3]

MoFEMErrorCode Example::setIntegrationRules ( )
private

[Set up problem]

[Set integration rule]

Examples
heat_method.cpp, and plot_base.cpp.

Definition at line 203 of file plot_base.cpp.

203 {
206}

◆ setIntegrationRules() [2/3]

MoFEMErrorCode Example::setIntegrationRules ( )
private

◆ setIntegrationRules() [3/3]

MoFEMErrorCode Example::setIntegrationRules ( )
private

◆ setUp()

MoFEMErrorCode Example::setUp ( )
private

[Run all]

[Set up problem]

Definition at line 137 of file integration.cpp.

137 {
140 CHKERR simple->getOptions();
141 CHKERR simple->loadFile();
142 // Add field
143 CHKERR simple->addDomainField("rho", H1, AINSWORTH_LEGENDRE_BASE, 1);
144 constexpr int order = 1;
145 CHKERR simple->setFieldOrder("rho", order);
146 CHKERR simple->setUp();
148}
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60

◆ setupProblem() [1/13]

MoFEMErrorCode Example::setupProblem ( )
private

[Run problem]

[Read mesh]

[Set up problem]

Examples
contact.cpp, eigen_elastic.cpp, heat_method.cpp, helmholtz.cpp, nonlinear_elastic.cpp, phase.cpp, plastic.cpp, plot_base.cpp, and shallow_wave.cpp.

Definition at line 186 of file plastic.cpp.

186 {
189
190 Range domain_ents;
191 CHKERR mField.get_moab().get_entities_by_dimension(0, SPACE_DIM, domain_ents,
192 true);
193 auto get_ents_by_dim = [&](const auto dim) {
194 if (dim == SPACE_DIM) {
195 return domain_ents;
196 } else {
197 Range ents;
198 if (dim == 0)
199 CHKERR mField.get_moab().get_connectivity(domain_ents, ents, true);
200 else
201 CHKERR mField.get_moab().get_entities_by_dimension(0, dim, ents, true);
202 return ents;
203 }
204 };
205
206 auto get_base = [&]() {
207 auto domain_ents = get_ents_by_dim(SPACE_DIM);
208 if (domain_ents.empty())
209 CHK_THROW_MESSAGE(MOFEM_NOT_FOUND, "Empty mesh");
210 const auto type = type_from_handle(domain_ents[0]);
211 switch (type) {
212 case MBQUAD:
214 case MBHEX:
216 case MBTRI:
218 case MBTET:
220 default:
221 CHK_THROW_MESSAGE(MOFEM_NOT_FOUND, "Element type not handled");
222 }
223 return NOBASE;
224 };
225
226 const auto base = get_base();
227 MOFEM_LOG("WORLD", Sev::inform) << "Base " << ApproximationBaseNames[base];
228
229 CHKERR simple->addDomainField("U", H1, base, SPACE_DIM);
230 CHKERR simple->addDomainField("TAU", L2, base, 1);
231 CHKERR simple->addDomainField("EP", L2, base, size_symm);
232 CHKERR simple->addBoundaryField("U", H1, base, SPACE_DIM);
233
234 CHKERR simple->addDataField("GEOMETRY", H1, base, SPACE_DIM);
235
236 auto ents = get_ents_by_dim(0);
237 ents.merge(get_ents_by_dim(1));
238 // ents.merge(get_ents_by_dim(2));
239 CHKERR simple->setFieldOrder("U", order, &ents);
240 CHKERR simple->setFieldOrder("EP", order - 1);
241 CHKERR simple->setFieldOrder("TAU", order - 2);
242
243 CHKERR simple->setFieldOrder("GEOMETRY", geom_order);
244
245 CHKERR simple->setUp();
246 // CHKERR simple->addFieldToEmptyFieldBlocks("U", "TAU");
247
248 auto project_ho_geometry = [&]() {
249 Projection10NodeCoordsOnField ent_method(mField, "GEOMETRY");
250 return mField.loop_dofs("GEOMETRY", ent_method);
251 };
252 CHKERR project_ho_geometry();
253
255}
@ NOBASE
Definition: definitions.h:59
@ DEMKOWICZ_JACOBI_BASE
Definition: definitions.h:66
@ MOFEM_NOT_FOUND
Definition: definitions.h:33
static const char *const ApproximationBaseNames[]
Definition: definitions.h:72
const int dim
virtual MoFEMErrorCode loop_dofs(const Problem *problem_ptr, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)=0
Make a loop over dofs.
auto type_from_handle(const EntityHandle h)
get type from entity handle
Definition: Templates.hpp:1592
FieldApproximationBase base
Definition: plot_base.cpp:68
Projection of edge entities with one mid-node on hierarchical basis.

◆ setupProblem() [2/13]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [3/13]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [4/13]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [5/13]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [6/13]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [7/13]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [8/13]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [9/13]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [10/13]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [11/13]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [12/13]

MoFEMErrorCode Example::setupProblem ( )
private

◆ setupProblem() [13/13]

MoFEMErrorCode Example::setupProblem ( )
private

◆ solveSystem() [1/10]

MoFEMErrorCode Example::solveSystem ( )
private

[Push operators to pipeline]

[Solve]

Examples
eigen_elastic.cpp, heat_method.cpp, helmholtz.cpp, nonlinear_elastic.cpp, phase.cpp, plot_base.cpp, and shallow_wave.cpp.

Definition at line 235 of file helmholtz.cpp.

235 {
238 auto solver = pipeline_mng->createKSP();
239 CHKERR KSPSetFromOptions(solver);
240 CHKERR KSPSetUp(solver);
241
242 auto dm = simpleInterface->getDM();
243 auto D = smartCreateDMVector(dm);
244 auto F = smartVectorDuplicate(D);
245
246 CHKERR KSPSolve(solver, F, D);
247 CHKERR VecGhostUpdateBegin(D, INSERT_VALUES, SCATTER_FORWARD);
248 CHKERR VecGhostUpdateEnd(D, INSERT_VALUES, SCATTER_FORWARD);
249 CHKERR DMoFEMMeshToLocalVector(dm, D, INSERT_VALUES, SCATTER_REVERSE);
251}
SmartPetscObj< KSP > createKSP(SmartPetscObj< DM > dm=nullptr)
Create KSP (linear) solver.
double D
SmartPetscObj< Vec > smartVectorDuplicate(SmartPetscObj< Vec > &vec)
Create duplicate vector of smart vector.
MoFEMErrorCode getDM(DM *dm)
Get DM.
Definition: Simple.cpp:780

◆ solveSystem() [2/10]

MoFEMErrorCode Example::solveSystem ( )
private

◆ solveSystem() [3/10]

MoFEMErrorCode Example::solveSystem ( )
private

◆ solveSystem() [4/10]

MoFEMErrorCode Example::solveSystem ( )
private

◆ solveSystem() [5/10]

MoFEMErrorCode Example::solveSystem ( )
private

◆ solveSystem() [6/10]

MoFEMErrorCode Example::solveSystem ( )
private

◆ solveSystem() [7/10]

MoFEMErrorCode Example::solveSystem ( )
private

◆ solveSystem() [8/10]

MoFEMErrorCode Example::solveSystem ( )
private

◆ solveSystem() [9/10]

MoFEMErrorCode Example::solveSystem ( )
private

◆ solveSystem() [10/10]

MoFEMErrorCode Example::solveSystem ( )
private

◆ tsSolve() [1/2]

MoFEMErrorCode Example::tsSolve ( )
private

[Push operators to pipeline]

[Solve]

Examples
contact.cpp, and plastic.cpp.

Definition at line 747 of file plastic.cpp.

747 {
749
752 ISManager *is_manager = mField.getInterface<ISManager>();
753
754 auto snes_ctx_ptr = smartGetDMSnesCtx(simple->getDM());
755
756 auto set_section_monitor = [&](auto solver) {
758 SNES snes;
759 CHKERR TSGetSNES(solver, &snes);
760 CHKERR SNESMonitorSet(snes,
761 (MoFEMErrorCode(*)(SNES, PetscInt, PetscReal,
763 (void *)(snes_ctx_ptr.get()), nullptr);
765 };
766
767 auto create_post_process_element = [&]() {
768 auto pp_fe = boost::make_shared<PostProcEle>(mField);
770
772 pp_fe->getOpPtrVector(), {H1, L2}, "GEOMETRY");
773
774 auto x_ptr = boost::make_shared<MatrixDouble>();
775 pp_fe->getOpPtrVector().push_back(
776 new OpCalculateVectorFieldValues<SPACE_DIM>("GEOMETRY", x_ptr));
777 auto u_ptr = boost::make_shared<MatrixDouble>();
778 pp_fe->getOpPtrVector().push_back(
780
781 pp_fe->getOpPtrVector().push_back(
783 "U", commonPlasticDataPtr->mGradPtr));
784 pp_fe->getOpPtrVector().push_back(new OpCalculateScalarFieldValues(
785 "TAU", commonPlasticDataPtr->getPlasticTauPtr()));
786 pp_fe->getOpPtrVector().push_back(
788 "EP", commonPlasticDataPtr->getPlasticStrainPtr()));
789
790 if (is_large_strains) {
791
792 if (commonPlasticDataPtr->mGradPtr != commonHenckyDataPtr->matGradPtr)
793 CHK_THROW_MESSAGE(MOFEM_DATA_INCONSISTENCY, "Wrong pointer for grad");
794
795 pp_fe->getOpPtrVector().push_back(
797 pp_fe->getOpPtrVector().push_back(
799 pp_fe->getOpPtrVector().push_back(
801 pp_fe->getOpPtrVector().push_back(
804 1 /*scale*/));
805 pp_fe->getOpPtrVector().push_back(
807
808 pp_fe->getOpPtrVector().push_back(
809
810 new OpPPMap(
811
812 pp_fe->getPostProcMesh(), pp_fe->getMapGaussPts(),
813
814 {},
815
816 {{"U", u_ptr}, {"GEOMETRY", x_ptr}},
817
818 {{"GRAD", commonPlasticDataPtr->mGradPtr},
819 {"FIRST_PIOLA", commonHenckyDataPtr->getMatFirstPiolaStress()}},
820
821 {}
822
823 )
824
825 );
826
827 } else {
828 pp_fe->getOpPtrVector().push_back(
830 commonPlasticDataPtr->mStrainPtr));
831 pp_fe->getOpPtrVector().push_back(new OpPlasticStress(
832 "U", commonPlasticDataPtr, commonPlasticDataPtr->mDPtr, 1 /*scale*/));
833
834 pp_fe->getOpPtrVector().push_back(
835
836 new OpPPMap(
837
838 pp_fe->getPostProcMesh(), pp_fe->getMapGaussPts(),
839
840 {},
841
842 {{"U", u_ptr}, {"GEOMETRY", x_ptr}},
843
844 {},
845
846 {{"STRAIN", commonPlasticDataPtr->mStrainPtr},
847 {"STRESS", commonPlasticDataPtr->mStressPtr}}
848
849 )
850
851 );
852 }
853
854 pp_fe->getOpPtrVector().push_back(
856
857 pp_fe->getOpPtrVector().push_back(
858
859 new OpPPMap(
860
861 pp_fe->getPostProcMesh(), pp_fe->getMapGaussPts(),
862
863 {{"PLASTIC_SURFACE", commonPlasticDataPtr->getPlasticSurfacePtr()},
864 {"PLASTIC_MULTIPLIER", commonPlasticDataPtr->getPlasticTauPtr()}},
865
866 {},
867
868 {},
869
870 {{"PLASTIC_STRAIN", commonPlasticDataPtr->getPlasticStrainPtr()},
871 {"PLASTIC_FLOW", commonPlasticDataPtr->getPlasticFlowPtr()}}
872
873 )
874
875 );
876
877 return pp_fe;
878 };
879
880 auto scatter_create = [&](auto D, auto coeff) {
882 CHKERR is_manager->isCreateProblemFieldAndRank(simple->getProblemName(),
883 ROW, "U", coeff, coeff, is);
884 int loc_size;
885 CHKERR ISGetLocalSize(is, &loc_size);
886 Vec v;
887 CHKERR VecCreateMPI(mField.get_comm(), loc_size, PETSC_DETERMINE, &v);
888 VecScatter scatter;
889 CHKERR VecScatterCreate(D, is, v, PETSC_NULL, &scatter);
890 return std::make_tuple(SmartPetscObj<Vec>(v),
892 };
893
894 auto set_time_monitor = [&](auto dm, auto solver) {
896 boost::shared_ptr<Monitor> monitor_ptr(
897 new Monitor(dm, create_post_process_element(), reactionFe, uXScatter,
899 boost::shared_ptr<ForcesAndSourcesCore> null;
900 CHKERR DMMoFEMTSSetMonitor(dm, solver, simple->getDomainFEName(),
901 monitor_ptr, null, null);
903 };
904
905 auto set_fieldsplit_preconditioner = [&](auto solver) {
907
908 SNES snes;
909 CHKERR TSGetSNES(solver, &snes);
910 KSP ksp;
911 CHKERR SNESGetKSP(snes, &ksp);
912 PC pc;
913 CHKERR KSPGetPC(ksp, &pc);
914 PetscBool is_pcfs = PETSC_FALSE;
915 PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
916
917 // Setup fieldsplit (block) solver - optional: yes/no
918 if (is_pcfs == PETSC_TRUE) {
919
920 auto bc_mng = mField.getInterface<BcManager>();
921 auto name_prb = simple->getProblemName();
922 auto is_all_bc = bc_mng->getBlockIS(name_prb, "FIX_X", "U", 0, 0);
923 is_all_bc = bc_mng->getBlockIS(name_prb, "FIX_Y", "U", 1, 1, is_all_bc);
924 is_all_bc = bc_mng->getBlockIS(name_prb, "FIX_Z", "U", 2, 2, is_all_bc);
925 is_all_bc = bc_mng->getBlockIS(name_prb, "FIX_ALL", "U", 0, 2, is_all_bc);
926
927 int is_all_bc_size;
928 CHKERR ISGetSize(is_all_bc, &is_all_bc_size);
929 MOFEM_LOG("EXAMPLE", Sev::inform)
930 << "Field split block size " << is_all_bc_size;
931
932 CHKERR PCFieldSplitSetIS(pc, PETSC_NULL,
933 is_all_bc); // boundary block
934 }
935
937 };
938
939 auto dm = simple->getDM();
940 auto D = smartCreateDMVector(dm);
941 uXScatter = scatter_create(D, 0);
942 uYScatter = scatter_create(D, 1);
943 if constexpr (SPACE_DIM == 3)
944 uZScatter = scatter_create(D, 2);
945
946 auto solver = pipeline_mng->createTSIM();
947
948 auto post_rhs = [&]() {
950 auto get_iter = [&]() {
951 SNES snes;
952 CHKERR TSGetSNES(solver, &snes);
953 int iter;
954 CHKERR SNESGetIterationNumber(snes, &iter);
955 return iter;
956 };
957
959 };
960
961 mField.getInterface<PipelineManager>()->getDomainRhsFE()->postProcessHook =
962 post_rhs;
963
964 CHKERR TSSetSolution(solver, D);
965 CHKERR set_section_monitor(solver);
966 CHKERR set_time_monitor(dm, solver);
967 CHKERR TSSetSolution(solver, D);
968 CHKERR TSSetFromOptions(solver);
969 CHKERR set_fieldsplit_preconditioner(solver);
970 CHKERR TSSetUp(solver);
971 CHKERR TSSolve(solver, NULL);
972
973 CHKERR VecGhostUpdateBegin(D, INSERT_VALUES, SCATTER_FORWARD);
974 CHKERR VecGhostUpdateEnd(D, INSERT_VALUES, SCATTER_FORWARD);
975 CHKERR DMoFEMMeshToLocalVector(dm, D, INSERT_VALUES, SCATTER_REVERSE);
976
978}
const FTensor::Tensor2< T, Dim, Dim > Vec
PetscErrorCode DMMoFEMTSSetMonitor(DM dm, TS ts, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
Set Monitor To TS solver.
Definition: DMMMoFEM.cpp:1003
MoFEMErrorCode MoFEMSNESMonitorFields(SNES snes, PetscInt its, PetscReal fgnorm, SnesCtx *snes_ctx)
Sens monitor printing residual field by field.
Definition: SnesCtx.cpp:224
auto smartGetDMSnesCtx(DM dm)
Get SNES context data structure used by DM.
Definition: DMMoFEM.hpp:987
std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > uYScatter
Definition: plastic.cpp:159
std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > uZScatter
Definition: plastic.cpp:160
std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > uXScatter
Definition: plastic.cpp:158
Section manager is used to create indexes and sections.
Definition: ISManager.hpp:23
intrusive_ptr for managing petsc objects

◆ tsSolve() [2/2]

MoFEMErrorCode Example::tsSolve ( )
private

Member Data Documentation

◆ approxFunction

ApproxFieldFunction< FIELD_DIM > Example::approxFunction
staticprivate
Initial value:

Definition at line 61 of file approximaton.cpp.

◆ approxGradVals

boost::shared_ptr<MatrixDouble> Example::approxGradVals
private

Definition at line 63 of file radiation.cpp.

◆ approxVals

boost::shared_ptr<VectorDouble> Example::approxVals
private

Definition at line 62 of file radiation.cpp.

◆ aveMaxMin

std::array< double, Example::BoundingBox::LAST_BB > Example::aveMaxMin
staticprivate
Examples
phase.cpp.

Definition at line 110 of file phase.cpp.

◆ base

FieldApproximationBase Example::base
private
Examples
contact.cpp, plastic.cpp, and plot_base.cpp.

Definition at line 68 of file plot_base.cpp.

◆ boundaryMarker

boost::shared_ptr< std::vector< unsigned char > > Example::boundaryMarker
private
Examples
helmholtz.cpp, phase.cpp, and plastic.cpp.

Definition at line 162 of file plastic.cpp.

◆ commonDataPtr [1/2]

boost::shared_ptr< CommonData > Example::commonDataPtr
private
Examples
contact.cpp.

Definition at line 150 of file contact.cpp.

◆ commonDataPtr [2/2]

boost::shared_ptr<CommonData> Example::commonDataPtr
private

Definition at line 42 of file integration.cpp.

◆ commonHenckyDataPtr

boost::shared_ptr< HenckyOps::CommonData > Example::commonHenckyDataPtr
private
Examples
nonlinear_elastic.cpp, and plastic.cpp.

Definition at line 155 of file plastic.cpp.

◆ commonPlasticDataPtr

boost::shared_ptr<PlasticOps::CommonData> Example::commonPlasticDataPtr
private
Examples
plastic.cpp.

Definition at line 154 of file plastic.cpp.

◆ domianLhsFEPtr

boost::shared_ptr<FEMethod> Example::domianLhsFEPtr
private
Examples
shallow_wave.cpp.

Definition at line 355 of file shallow_wave.cpp.

◆ domianRhsFEPtr

boost::shared_ptr<FEMethod> Example::domianRhsFEPtr
private
Examples
shallow_wave.cpp.

Definition at line 356 of file shallow_wave.cpp.

◆ ePS

SmartPetscObj<EPS> Example::ePS
private
Examples
eigen_elastic.cpp.

Definition at line 69 of file eigen_elastic.cpp.

◆ focalIndex

int Example::focalIndex
staticprivate
Examples
phase.cpp.

Definition at line 112 of file phase.cpp.

◆ iI

std::vector< MatrixInt > Example::iI
staticprivate
Examples
phase.cpp.

Definition at line 109 of file phase.cpp.

◆ K

SmartPetscObj<Mat> Example::K
private
Examples
eigen_elastic.cpp.

Definition at line 68 of file eigen_elastic.cpp.

◆ M

SmartPetscObj<Mat> Example::M
private
Examples
eigen_elastic.cpp.

Definition at line 67 of file eigen_elastic.cpp.

◆ matAccelerationPtr

boost::shared_ptr<MatrixDouble> Example::matAccelerationPtr
private

Definition at line 77 of file nonlinear_dynamic_elastic.cpp.

◆ matDPtr

boost::shared_ptr< MatrixDouble > Example::matDPtr
private
Examples
eigen_elastic.cpp, and nonlinear_elastic.cpp.

Definition at line 65 of file eigen_elastic.cpp.

◆ matGradPtr

boost::shared_ptr< MatrixDouble > Example::matGradPtr
private
Examples
nonlinear_elastic.cpp.

Definition at line 76 of file nonlinear_elastic.cpp.

◆ matInertiaPtr

boost::shared_ptr<MatrixDouble> Example::matInertiaPtr
private

Definition at line 78 of file nonlinear_dynamic_elastic.cpp.

◆ matStrainPtr

boost::shared_ptr< MatrixDouble > Example::matStrainPtr
private
Examples
nonlinear_elastic.cpp.

Definition at line 77 of file nonlinear_elastic.cpp.

◆ matStressPtr

boost::shared_ptr< MatrixDouble > Example::matStressPtr
private
Examples
nonlinear_elastic.cpp.

Definition at line 78 of file nonlinear_elastic.cpp.

◆ matTangentPtr

boost::shared_ptr<MatrixDouble> Example::matTangentPtr
private

Definition at line 81 of file nonlinear_dynamic_elastic.cpp.

◆ mField

MoFEM::Interface & Example::mField
private

◆ pinchNodes

Range Example::pinchNodes
private
Examples
heat_method.cpp.

Definition at line 54 of file heat_method.cpp.

◆ postProcFe

boost::shared_ptr<PostProcEle> Example::postProcFe
private
Examples
contact.cpp.

Definition at line 151 of file contact.cpp.

◆ reactionFe

boost::shared_ptr<DomainEle> Example::reactionFe
private
Examples
plastic.cpp.

Definition at line 156 of file plastic.cpp.

◆ reactionMarker

boost::shared_ptr<std::vector<unsigned char> > Example::reactionMarker
private
Examples
plastic.cpp.

Definition at line 163 of file plastic.cpp.

◆ rigidBodyMotion

std::array<SmartPetscObj<Vec>, 6> Example::rigidBodyMotion
private
Examples
eigen_elastic.cpp.

Definition at line 71 of file eigen_elastic.cpp.

◆ rZ

std::vector< double > Example::rZ
staticprivate
Examples
phase.cpp.

Definition at line 108 of file phase.cpp.

◆ savitzkyGolayNormalisation

int Example::savitzkyGolayNormalisation
staticprivate
Examples
phase.cpp.

Definition at line 113 of file phase.cpp.

◆ savitzkyGolayWeights

const int * Example::savitzkyGolayWeights
staticprivate
Examples
phase.cpp.

Definition at line 114 of file phase.cpp.

◆ simpleInterface

Simple * Example::simpleInterface
private
Examples
heat_method.cpp, helmholtz.cpp, phase.cpp, and plot_base.cpp.

Definition at line 45 of file helmholtz.cpp.

◆ space

FieldSpace Example::space
private
Examples
plot_base.cpp.

Definition at line 69 of file plot_base.cpp.

◆ uXScatter

std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > Example::uXScatter
private
Examples
contact.cpp, and plastic.cpp.

Definition at line 158 of file plastic.cpp.

◆ uYScatter

std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > Example::uYScatter
private
Examples
contact.cpp, and plastic.cpp.

Definition at line 159 of file plastic.cpp.

◆ uZScatter

std::tuple< SmartPetscObj< Vec >, SmartPetscObj< VecScatter > > Example::uZScatter
private
Examples
contact.cpp, and plastic.cpp.

Definition at line 160 of file plastic.cpp.


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