3#ifndef __SMOOTHER_HPP__
4#define __SMOOTHER_HPP__
7#error "MoFEM need to be compiled with ADOL-C"
23 CHKERRABORT(PETSC_COMM_SELF,
ierr);
28 ierr = PetscOptionsBegin(PETSC_COMM_WORLD,
"",
29 "Get stabilisation element options",
"none");
31 PetscBool smoothing_on =
sTabilised ? PETSC_TRUE : PETSC_FALSE;
32 CHKERR PetscOptionsBool(
"-smoothing_stabilise",
33 "all nodes controlled by smoothing element",
"",
34 smoothing_on, &smoothing_on, PETSC_NULL);
35 sTabilised = (smoothing_on == PETSC_TRUE) ?
true :
false;
36 ierr = PetscOptionsEnd();
44 CHKERRABORT(PETSC_COMM_WORLD,
ierr);
46 CHKERRABORT(PETSC_COMM_WORLD,
ierr);
52 std::map<int, NonlinearElasticElement::BlockData>
setOfBlocks;
66 CHKERR VolumeElementForcesAndSourcesCore::preProcess();
113 CHKERR VolumeElementForcesAndSourcesCore::postProcess();
137 int tag,
bool jacobian)
139 field_name, data, common_data, tag, jacobian, false, false) {}
148 for (
int dd1 = 0; dd1 < 3; dd1++) {
149 for (
int dd2 = 0; dd2 < 3; dd2++) {
174 EntitiesFieldData::EntData &row_data) {
177 int nb_dofs = row_data.getIndices().size();
178 int *indices_ptr = &row_data.getIndices()[0];
181 iNdices.resize(nb_dofs,
false);
182 noalias(
iNdices) = row_data.getIndices();
188 VectorDofs &dofs = row_data.getFieldDofs();
189 VectorDofs::iterator dit = dofs.begin();
190 for (
int ii = 0; dit != dofs.end(); dit++, ii++) {
220 const std::string vel_field,
const std::string
field_name,
225 crack_area_tangent_constrains
236 EntitiesFieldData::EntData &row_data,
237 EntitiesFieldData::EntData &col_data) {
240 int nb_row = row_data.getIndices().size();
241 int nb_col = col_data.getIndices().size();
242 int *row_indices_ptr = &row_data.getIndices()[0];
243 int *col_indices_ptr = &col_data.getIndices()[0];
253 VectorDofs &dofs = row_data.getFieldDofs();
254 VectorDofs::iterator dit = dofs.begin();
255 for (
int ii = 0; dit != dofs.end(); dit++, ii++) {
266 nb_col, col_indices_ptr, &
k(0, 0), ADD_VALUES);
270 const auto bit_number_for_crack_area_tangent_constrain =
272 const auto bit_number_for_mesh_position =
276 double *f_tangent_front_mesh_array;
278 &f_tangent_front_mesh_array);
283 for (
int nn = 0; nn < 4; nn++) {
286 auto dit = row_dofs->get<Unique_mi_tag>().lower_bound(
287 DofEntity::getLoFieldEntityUId(
288 bit_number_for_crack_area_tangent_constrain,
getConn()[nn]));
289 auto hi_dit = row_dofs->get<Unique_mi_tag>().upper_bound(
290 DofEntity::getHiFieldEntityUId(
291 bit_number_for_crack_area_tangent_constrain,
getConn()[nn]));
294 if (std::distance(dit, hi_dit) > 0) {
297 auto diit = row_dofs->get<Unique_mi_tag>().lower_bound(
298 DofEntity::getLoFieldEntityUId(bit_number_for_mesh_position,
301 auto hi_diit = row_dofs->get<Unique_mi_tag>().upper_bound(
302 DofEntity::getHiFieldEntityUId(bit_number_for_mesh_position,
306 for (; diit != hi_diit; diit++) {
308 for (
int ddd = 0; ddd < nb_col; ddd++) {
311 diit->get()->getPetscGlobalDofIdx()) {
314 "data inconsistency %d != %d",
316 diit->get()->getPetscGlobalDofIdx());
319 if (diit->get()->getPetscLocalDofIdx() == -1) {
321 "data inconsistency");
324 f_tangent_front_mesh_array[diit->get()
325 ->getPetscLocalDofIdx()] *
326 k(3 * nn + diit->get()->getDofCoeffIdx(), ddd);
327 int lambda_idx = dit->get()->getPetscGlobalDofIdx();
329 &col_indices_ptr[ddd], &
g, ADD_VALUES);
335 &f_tangent_front_mesh_array);
static PetscErrorCode ierr
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
constexpr auto field_name
unsigned int getFieldBitNumber(std::string field_name) const
Deprecated interface functions.
auto getRowDofsPtr() const
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
Mat & snes_B
preconditioner of jacobian matrix
const EntityHandle * getConn()
get element connectivity
data for calculation heat conductivity and heat capacity elements
Range forcesOnlyOnEntitiesRow
boost::shared_ptr< FunctionsToCalculatePiolaKirchhoffI< adouble > > materialAdoublePtr
common data used by volume elements
std::vector< MatrixDouble3by3 > sTress
definition of volume element
Operator performs automatic differentiation.
OpJacobianPiolaKirchhoffStress(const std::string field_name, BlockData &data, CommonData &common_data, int tag, bool jacobian, bool ale, bool field_disp)
Construct operator to calculate Piola-Kirchhoff stress or its derivatives over gradient deformation.
ublas::vector< int > rowIndices
OpLhsPiolaKirchhoff_dx(const std::string vel_field, const std::string field_name, BlockData &data, CommonData &common_data)
ublas::vector< int > iNdices
OpRhsPiolaKirchhoff(const std::string field_name, BlockData &data, CommonData &common_data)
structure grouping operators and data used for calculation of nonlinear elastic element
SmootherBlockData & smootherData
MoFEMErrorCode preProcess()
function is run at the beginning of loop
MyVolumeFE(MoFEM::Interface &m_field, SmootherBlockData &smoother_data)
MoFEMErrorCode postProcess()
function is run at the end of loop
OpJacobianSmoother(const std::string field_name, NonlinearElasticElement::BlockData &data, NonlinearElasticElement::CommonData &common_data, int tag, bool jacobian)
MoFEMErrorCode calculateStress(const int gg)
Calculate Paola-Kirchhoff I stress.
SmootherBlockData & smootherData
OpLhsSmoother(const std::string vel_field, const std::string field_name, NonlinearElasticElement::BlockData &data, NonlinearElasticElement::CommonData &common_data, SmootherBlockData &smoother_data, const std::string crack_area_tangent_constrains)
ublas::vector< int > rowFrontIndices
const std::string fieldCrackAreaTangentConstrains
MoFEMErrorCode aSemble(int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
SmootherBlockData & smootherData
ublas::vector< int > frontIndices
OpRhsSmoother(const std::string field_name, NonlinearElasticElement::BlockData &data, NonlinearElasticElement::CommonData &common_data, SmootherBlockData &smoother_data)
MoFEMErrorCode aSemble(int row_side, EntityType row_type, EntitiesFieldData::EntData &row_data)
virtual ~SmootherBlockData()
MoFEMErrorCode getOptions()
SmootherBlockData smootherData
MyVolumeFE & getLoopFeLhs()
get lhs volume element
Smoother(MoFEM::Interface &m_field)
NonlinearElasticElement::CommonData commonData
boost::shared_ptr< MyVolumeFE > feRhsPtr
std::map< int, NonlinearElasticElement::BlockData > setOfBlocks
MyVolumeFE & feRhs
calculate right hand side for tetrahedral elements
boost::shared_ptr< MyVolumeFE > feLhsPtr
MyVolumeFE & getLoopFeRhs()
get rhs volume element