v0.9.0
Public Member Functions | Public Attributes | List of all members
BoneRemodeling::OpAssmbleStressLhs_dF< ADOLC > Struct Template Reference

Off diagonal block of tangent matrix \(K_{u u}\)

\[ K_{u u}=\left[\frac{\rho_{0}}{\rho_{0}^{\ast}}\right]^{n} \nabla N_j D_{ijkl}\nabla N_l S_{jl} \]

. More...

#include <users_modules/bone_remodelling/src/Remodeling.hpp>

Inheritance diagram for BoneRemodeling::OpAssmbleStressLhs_dF< ADOLC >:
[legend]
Collaboration diagram for BoneRemodeling::OpAssmbleStressLhs_dF< ADOLC >:
[legend]

Public Member Functions

 OpAssmbleStressLhs_dF (Remodeling::CommonData &common_data)
 
MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 
- Public Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCoreBase::UserDataOperator
int getNumNodes ()
 get element number of nodes More...
 
const EntityHandlegetConn ()
 get element connectivity More...
 
double getVolume () const
 element volume (linear geometry) More...
 
doublegetVolume ()
 element volume (linear geometry) More...
 
FTensor::Tensor2< double *, 3, 3 > & getJac ()
 get element Jacobian More...
 
FTensor::Tensor2< double *, 3, 3 > & getInvJac ()
 get element inverse Jacobian More...
 
double getMeasure () const
 get measure of element More...
 
doublegetMeasure ()
 get measure of element More...
 
VectorDoublegetCoords ()
 nodal coordinates More...
 
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3) More...
 
MatrixDoublegetHoCoordsAtGaussPts ()
 coordinate at Gauss points (if hierarchical approximation of element geometry) More...
 
MatrixDoublegetHoGaussPtsJac ()
 
MatrixDoublegetHoGaussPtsInvJac ()
 
VectorDoublegetHoGaussPtsDetJac ()
 
auto getFTenosr0HoMeasure ()
 
auto getFTensor1CoordsAtGaussPts ()
 Get coordinates at integration points assuming linear geometry. More...
 
auto getFTensor1HoCoordsAtGaussPts ()
 Get coordinates at integration points taking geometry from field. More...
 
auto getFTensor2HoGaussPtsJac ()
 
auto getFTensor2HoGaussPtsInvJac ()
 
VolumeElementForcesAndSourcesCoreBasegetVolumeFE () const
 return pointer to Generic Volume Finite Element object More...
 
MoFEMErrorCode getDivergenceOfHDivBaseFunctions (int side, EntityType type, DataForcesAndSourcesCore::EntData &data, int gg, VectorDouble &div)
 Get divergence of base functions at integration point. More...
 
MoFEMErrorCode getCurlOfHCurlBaseFunctions (int side, EntityType type, DataForcesAndSourcesCore::EntData &data, int gg, MatrixDouble &curl)
 Get curl of base functions at integration point. More...
 
- Public Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
 UserDataOperator (const FieldSpace space, const char type=OPLAST, const bool symm=true)
 
 UserDataOperator (const std::string &field_name, const char type, const bool symm=true)
 
 UserDataOperator (const std::string &row_field_name, const std::string &col_field_name, const char type, const bool symm=true)
 
boost::shared_ptr< const NumeredEntFiniteElementgetNumeredEntFiniteElementPtr () const
 Return raw pointer to NumeredEntFiniteElement. More...
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle. More...
 
boost::weak_ptr< SideNumber > getSideNumberPtr (const int side_number, const EntityType type)
 Get the side number pointer. More...
 
EntityHandle getSideEntity (const int side_number, const EntityType type)
 Get the side entity. More...
 
int getNumberOfNodesOnElement ()
 Get the number of nodes on finite element. More...
 
MoFEMErrorCode getProblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get row indices. More...
 
MoFEMErrorCode getProblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get col indices. More...
 
const FEMethodgetFEMethod () const
 Return raw pointer to Finite Element Method object. More...
 
int getOpType () const
 Get operator types. More...
 
void setOpType (const OpType type)
 Set operator type. More...
 
void addOpType (const OpType type)
 Add operator type. More...
 
int getNinTheLoop () const
 get number of finite element in the loop More...
 
int getLoopSize () const
 get size of elements in the loop More...
 
const std::string & getFEName () const
 Get name of the element. More...
 
Vec getSnesF () const
 
Vec getSnesX () const
 
Mat getSnesA () const
 
Mat getSnesB () const
 
Vec getTSu () const
 
Vec getTSu_t () const
 
Vec getTSf () const
 
Mat getTSA () const
 
Mat getTSB () const
 
int getTSstep () const
 
double getTStime () const
 
double getTSa () const
 
MatrixDoublegetGaussPts ()
 matrix of integration (Gauss) points for Volume Element More...
 
auto getFTensor0IntegrationWeight ()
 Get integration weights. More...
 
DEPRECATED MoFEMErrorCode getPorblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 
- Public Member Functions inherited from MoFEM::DataOperator
 DataOperator (const bool symm=true, const bool do_vertices=true, const bool do_edges=true, const bool do_quads=true, const bool do_tris=true, const bool do_tets=true, const bool do_prisms=true)
 
virtual ~DataOperator ()
 
virtual MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on left hand side. More...
 
virtual MoFEMErrorCode opLhs (DataForcesAndSourcesCore &row_data, DataForcesAndSourcesCore &col_data, bool symm=true)
 
virtual MoFEMErrorCode opLhs (DataForcesAndSourcesCore &row_data, DataForcesAndSourcesCore &col_data)
 
virtual MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 Operator for linear form, usually to calculate values on right hand side. More...
 
virtual MoFEMErrorCode opRhs (DataForcesAndSourcesCore &data, const bool do_vertices, const bool do_edges, const bool do_quads, const bool do_tris, const bool do_tets, const bool do_prisms, const bool error_if_no_base=true)
 
virtual MoFEMErrorCode opRhs (DataForcesAndSourcesCore &data, const bool error_if_no_base=true)
 
bool getSymm () const
 Get if operator uses symmetry of DOFs or not. More...
 
void setSymm ()
 set if operator is executed taking in account symmetry More...
 
void unSetSymm ()
 unset if operator is executed for non symmetric problem More...
 

Public Attributes

Remodeling::CommonDatacommonData
 
MatrixDouble locK_P_F
 
MatrixDouble transLocK_P_F
 
FTensor::Tensor2< double, 3, 3 > diffDiff
 
- Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
char opType
 
std::string rowFieldName
 
std::string colFieldName
 
FieldSpace sPace
 
- Public Attributes inherited from MoFEM::DataOperator
bool sYmm
 If true assume that matrix is symmetric structure. More...
 
bool doVertices
 If false skip vertices. More...
 
bool doEdges
 If false skip edges. More...
 
bool doQuads
 
bool doTris
 
bool doTets
 
bool doPrisms
 

Additional Inherited Members

- Public Types inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
enum  OpType { OPROW = 1 << 0, OPCOL = 1 << 1, OPROWCOL = 1 << 2, OPLAST = 1 << 3 }
 Controls loop over entities on element. More...
 
- Protected Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 
ForcesAndSourcesCoregetPtrFE () const
 
ForcesAndSourcesCoregetSidePtrFE () const
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

template<bool ADOLC>
struct BoneRemodeling::OpAssmbleStressLhs_dF< ADOLC >

Off diagonal block of tangent matrix \(K_{u u}\)

\[ K_{u u}=\left[\frac{\rho_{0}}{\rho_{0}^{\ast}}\right]^{n} \nabla N_j D_{ijkl}\nabla N_l S_{jl} \]

.

Definition at line 513 of file Remodeling.hpp.

Constructor & Destructor Documentation

◆ OpAssmbleStressLhs_dF()

template<bool ADOLC>
BoneRemodeling::OpAssmbleStressLhs_dF< ADOLC >::OpAssmbleStressLhs_dF ( Remodeling::CommonData common_data)
Examples
Remodeling.hpp.

Definition at line 1160 of file Remodeling.cpp.

1163  "DISPLACEMENTS", "DISPLACEMENTS", UserDataOperator::OPROWCOL),
1164  commonData(common_data) {
1165  sYmm = true;
1166 }
Remodeling::CommonData & commonData
Definition: Remodeling.hpp:516
bool sYmm
If true assume that matrix is symmetric structure.
ForcesAndSourcesCore::UserDataOperator UserDataOperator

Member Function Documentation

◆ doWork()

template<bool ADOLC>
MoFEMErrorCode BoneRemodeling::OpAssmbleStressLhs_dF< ADOLC >::doWork ( int  row_side,
int  col_side,
EntityType  row_type,
EntityType  col_type,
DataForcesAndSourcesCore::EntData row_data,
DataForcesAndSourcesCore::EntData col_data 
)
Examples
Remodeling.hpp.

Definition at line 1168 of file Remodeling.cpp.

1171  {
1172 
1174 
1175  const int row_nb_dofs = row_data.getIndices().size();
1176  if (!row_nb_dofs)
1178  const int col_nb_dofs = col_data.getIndices().size();
1179  if (!col_nb_dofs)
1181 
1182  const bool diagonal_block = (row_type == col_type) && (row_side == col_side);
1183 
1184  // Set size can clear local tangent matrix
1185  locK_P_F.resize(row_nb_dofs, col_nb_dofs, false);
1186  locK_P_F.clear();
1187 
1188  const int row_nb_gauss_pts = row_data.getN().size1();
1189  const int row_nb_base_functions = row_data.getN().size2();
1190 
1191  MatrixDouble &matS = commonData.data.matS;
1193  // MatrixDouble &dS_dC = commonData.data.matMaterialTangent;
1194  // MatrixDouble &matF = commonData.data.matGradientOfDeformation;
1195 
1196  double t0;
1197 
1198  const double n = commonData.n;
1199  const double rho_ref = commonData.rHo_ref;
1200 
1208 
1209  auto row_diff_base_functions = row_data.getFTensor1DiffN<3>();
1213 
1214  // FTensor::Tensor4_ddg<double*,3,3> D1(SYMMETRIC_TENSOR4_MAT_PTR(dS_dC),6);
1215  // FTensor::Tensor2<double*,3,3> F(TENSOR2_MAT_PTR(matF));
1216 
1217  for (int gg = 0; gg != row_nb_gauss_pts; gg++) {
1218 
1219  // Get volume and integration weight
1220  double w = getVolume() * getGaussPts()(3, gg);
1221  if (getHoGaussPtsDetJac().size() > 0) {
1222  w *= getHoGaussPtsDetJac()[gg]; ///< higher order geometry
1223  }
1224  const double a = w * pow(rho / rho_ref, n);
1225 
1226  int row_bb = 0;
1227  for (; row_bb != row_nb_dofs / 3; row_bb++) {
1228 
1229  auto col_diff_base_functions = col_data.getFTensor1DiffN<3>(gg, 0);
1230 
1231  const int final_bb = diagonal_block ? row_bb + 1 : col_nb_dofs / 3;
1232  int col_bb = 0;
1233  for (; col_bb != final_bb; col_bb++) {
1234 
1236  &locK_P_F(3 * row_bb + 0, 3 * col_bb + 0),
1237  &locK_P_F(3 * row_bb + 0, 3 * col_bb + 1),
1238  &locK_P_F(3 * row_bb + 0, 3 * col_bb + 2),
1239  &locK_P_F(3 * row_bb + 1, 3 * col_bb + 0),
1240  &locK_P_F(3 * row_bb + 1, 3 * col_bb + 1),
1241  &locK_P_F(3 * row_bb + 1, 3 * col_bb + 2),
1242  &locK_P_F(3 * row_bb + 2, 3 * col_bb + 0),
1243  &locK_P_F(3 * row_bb + 2, 3 * col_bb + 1),
1244  &locK_P_F(3 * row_bb + 2, 3 * col_bb + 2));
1245 
1246  diffDiff(J, L) =
1247  a * row_diff_base_functions(J) * col_diff_base_functions(L);
1248 
1249  // TODO: FIXME: Tensor D2 has major symmetry, we do not have such tensor
1250  // implemented at the moment. Using tensor with major symmetry will
1251  // improve code efficiency.
1252  t_assemble(i, k) += diffDiff(J, L) * D2(i, J, k, L);
1253 
1254  if (ADOLC) {
1255  // Stress stiffening part (only with adolc since it is using dS / dC
1256  // derrivative. Check OpCalculateStressTangentWithAdolc operator)
1257  t0 = diffDiff(J, L) * S(J, L);
1258  t_assemble(0, 0) += t0;
1259  t_assemble(1, 1) += t0;
1260  t_assemble(2, 2) += t0;
1261  }
1262 
1263  // Next base function for column
1264  ++col_diff_base_functions;
1265  }
1266 
1267  ++row_diff_base_functions;
1268  }
1269  for (; row_bb != row_nb_base_functions; row_bb++) {
1270  ++row_diff_base_functions;
1271  }
1272 
1273  // ++D1;
1274  ++D2;
1275  ++S;
1276  // ++F;
1277  ++rho;
1278  }
1279 
1280  // Copy of symmetric part for assemble
1281  if (diagonal_block) {
1282  for (int row_bb = 0; row_bb != row_nb_dofs / 3; row_bb++) {
1283  int col_bb = 0;
1284  for (; col_bb != row_bb + 1; col_bb++) {
1286  &locK_P_F(3 * row_bb + 0, 3 * col_bb + 0),
1287  &locK_P_F(3 * row_bb + 0, 3 * col_bb + 1),
1288  &locK_P_F(3 * row_bb + 0, 3 * col_bb + 2),
1289  &locK_P_F(3 * row_bb + 1, 3 * col_bb + 0),
1290  &locK_P_F(3 * row_bb + 1, 3 * col_bb + 1),
1291  &locK_P_F(3 * row_bb + 1, 3 * col_bb + 2),
1292  &locK_P_F(3 * row_bb + 2, 3 * col_bb + 0),
1293  &locK_P_F(3 * row_bb + 2, 3 * col_bb + 1),
1294  &locK_P_F(3 * row_bb + 2, 3 * col_bb + 2));
1296  &locK_P_F(3 * col_bb + 0, 3 * row_bb + 0),
1297  &locK_P_F(3 * col_bb + 0, 3 * row_bb + 1),
1298  &locK_P_F(3 * col_bb + 0, 3 * row_bb + 2),
1299  &locK_P_F(3 * col_bb + 1, 3 * row_bb + 0),
1300  &locK_P_F(3 * col_bb + 1, 3 * row_bb + 1),
1301  &locK_P_F(3 * col_bb + 1, 3 * row_bb + 2),
1302  &locK_P_F(3 * col_bb + 2, 3 * row_bb + 0),
1303  &locK_P_F(3 * col_bb + 2, 3 * row_bb + 1),
1304  &locK_P_F(3 * col_bb + 2, 3 * row_bb + 2));
1305  t_off_side(i, k) = t_assemble(k, i);
1306  }
1307  }
1308  }
1309 
1310  const int *row_ind = &*row_data.getIndices().begin();
1311  const int *col_ind = &*col_data.getIndices().begin();
1312  CHKERR MatSetValues(getFEMethod()->ts_B, row_nb_dofs, row_ind, col_nb_dofs,
1313  col_ind, &locK_P_F(0, 0), ADD_VALUES);
1314 
1315  if (row_type != col_type || row_side != col_side) {
1316  transLocK_P_F.resize(col_nb_dofs, row_nb_dofs, false);
1317  noalias(transLocK_P_F) = trans(locK_P_F);
1318  CHKERR MatSetValues(getFEMethod()->ts_B, col_nb_dofs, col_ind, row_nb_dofs,
1319  row_ind, &transLocK_P_F(0, 0), ADD_VALUES);
1320  }
1321 
1323 }
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
static FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:142
boost::shared_ptr< VectorDouble > rhoPtr
Ptr to density matrix container.
Definition: Remodeling.hpp:187
#define TENSOR4_MAT_PTR(MAT)
Definition: Remodeling.cpp:48
ublas::matrix< double, ublas::row_major, DoubleAllocator > MatrixDouble
Definition: Types.hpp:74
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
FTensor::Tensor1< double *, Tensor_Dim > getFTensor1DiffN(const FieldApproximationBase base)
Get derivatives of base functions.
Remodeling::CommonData & commonData
Definition: Remodeling.hpp:516
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
#define SYMMETRIC_TENSOR2_MAT_PTR(MAT)
Definition: Remodeling.cpp:54
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
const VectorInt & getIndices() const
Get global indices of dofs on entity.
FTensor::Tensor2< double, 3, 3 > diffDiff
Definition: Remodeling.hpp:519
MoFEMErrorCode MatSetValues(Mat M, const DataForcesAndSourcesCore::EntData &row_data, const DataForcesAndSourcesCore::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.
#define CHKERR
Inline error check.
Definition: definitions.h:596
double n
porosity exponent [-]
Definition: Remodeling.hpp:148
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....

Member Data Documentation

◆ commonData

template<bool ADOLC>
Remodeling::CommonData& BoneRemodeling::OpAssmbleStressLhs_dF< ADOLC >::commonData
Examples
Remodeling.hpp.

Definition at line 516 of file Remodeling.hpp.

◆ diffDiff

template<bool ADOLC>
FTensor::Tensor2<double, 3, 3> BoneRemodeling::OpAssmbleStressLhs_dF< ADOLC >::diffDiff
Examples
Remodeling.hpp.

Definition at line 519 of file Remodeling.hpp.

◆ locK_P_F

template<bool ADOLC>
MatrixDouble BoneRemodeling::OpAssmbleStressLhs_dF< ADOLC >::locK_P_F
Examples
Remodeling.hpp.

Definition at line 517 of file Remodeling.hpp.

◆ transLocK_P_F

template<bool ADOLC>
MatrixDouble BoneRemodeling::OpAssmbleStressLhs_dF< ADOLC >::transLocK_P_F
Examples
Remodeling.hpp.

Definition at line 518 of file Remodeling.hpp.


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