v0.15.0
Loading...
Searching...
No Matches
BoneRemodeling::OpAssmbleStressLhs_dF< ADOLC > Struct Template Reference

Off diagonal block of tangent matrix \(K_{u u}\). 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::VolumeElementForcesAndSourcesCore::UserDataOperator
int getNumNodes ()
 get element number of nodes
 
const EntityHandlegetConn ()
 get element connectivity
 
double getVolume () const
 element volume (linear geometry)
 
doublegetVolume ()
 element volume (linear geometry)
 
FTensor::Tensor2< double *, 3, 3 > & getJac ()
 get element Jacobian
 
FTensor::Tensor2< double *, 3, 3 > & getInvJac ()
 get element inverse Jacobian
 
VectorDoublegetCoords ()
 nodal coordinates
 
VolumeElementForcesAndSourcesCoregetVolumeFE () const
 return pointer to Generic Volume Finite Element object
 
- Public Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
 UserDataOperator (const FieldSpace space, const char type=OPSPACE, 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.
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle.
 
int getFEDim () const
 Get dimension of finite element.
 
EntityType getFEType () const
 Get dimension of finite element.
 
boost::weak_ptr< SideNumbergetSideNumberPtr (const int side_number, const EntityType type)
 Get the side number pointer.
 
EntityHandle getSideEntity (const int side_number, const EntityType type)
 Get the side entity.
 
int getNumberOfNodesOnElement () const
 Get the number of nodes on finite element.
 
MoFEMErrorCode getProblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get row indices.
 
MoFEMErrorCode getProblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get col indices.
 
const FEMethodgetFEMethod () const
 Return raw pointer to Finite Element Method object.
 
int getOpType () const
 Get operator types.
 
void setOpType (const OpType type)
 Set operator type.
 
void addOpType (const OpType type)
 Add operator type.
 
int getNinTheLoop () const
 get number of finite element in the loop
 
int getLoopSize () const
 get size of elements in the loop
 
std::string getFEName () const
 Get name of the element.
 
ForcesAndSourcesCoregetPtrFE () const
 
ForcesAndSourcesCoregetSidePtrFE () const
 
ForcesAndSourcesCoregetRefinePtrFE () const
 
const PetscData::SwitchesgetDataCtx () const
 
const KspMethod::KSPContext getKSPCtx () const
 
const SnesMethod::SNESContext getSNESCtx () const
 
const TSMethod::TSContext getTSCtx () const
 
Vec getKSPf () const
 
Mat getKSPA () const
 
Mat getKSPB () const
 
Vec getSNESf () const
 
Vec getSNESx () const
 
Mat getSNESA () const
 
Mat getSNESB () const
 
Vec getTSu () const
 
Vec getTSu_t () const
 
Vec getTSu_tt () const
 
Vec getTSf () const
 
Mat getTSA () const
 
Mat getTSB () const
 
int getTSstep () const
 
double getTStime () const
 
double getTStimeStep () const
 
double getTSa () const
 
double getTSaa () const
 
MatrixDoublegetGaussPts ()
 matrix of integration (Gauss) points for Volume Element
 
auto getFTensor0IntegrationWeight ()
 Get integration weights.
 
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3)
 
auto getFTensor1CoordsAtGaussPts ()
 Get coordinates at integration points assuming linear geometry.
 
double getMeasure () const
 get measure of element
 
doublegetMeasure ()
 get measure of element
 
MoFEMErrorCode loopSide (const string &fe_name, ForcesAndSourcesCore *side_fe, const size_t dim, const EntityHandle ent_for_side=0, boost::shared_ptr< Range > fe_range=nullptr, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy, AdjCache *adj_cache=nullptr)
 User calls this function to loop over elements on the side of face. This function calls finite element with its operator to do calculations.
 
MoFEMErrorCode loopThis (const string &fe_name, ForcesAndSourcesCore *this_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over the same element using a different set of integration points. This function calls finite element with its operator to do calculations.
 
MoFEMErrorCode loopParent (const string &fe_name, ForcesAndSourcesCore *parent_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations.
 
MoFEMErrorCode loopChildren (const string &fe_name, ForcesAndSourcesCore *child_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations.
 
MoFEMErrorCode loopRange (const string &fe_name, ForcesAndSourcesCore *range_fe, boost::shared_ptr< Range > fe_range, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 Iterate over range of elements.
 
- Public Member Functions inherited from MoFEM::DataOperator
 DataOperator (const bool symm=true)
 
virtual ~DataOperator ()=default
 
virtual MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on left hand side.
 
virtual MoFEMErrorCode opLhs (EntitiesFieldData &row_data, EntitiesFieldData &col_data)
 
virtual MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 Operator for linear form, usually to calculate values on right hand side.
 
virtual MoFEMErrorCode opRhs (EntitiesFieldData &data, const bool error_if_no_base=false)
 
bool getSymm () const
 Get if operator uses symmetry of DOFs or not.
 
void setSymm ()
 set if operator is executed taking in account symmetry
 
void unSetSymm ()
 unset if operator is executed for non symmetric problem
 

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
DoWorkLhsHookFunType doWorkLhsHook
 
DoWorkRhsHookFunType doWorkRhsHook
 
bool sYmm
 If true assume that matrix is symmetric structure.
 
std::array< bool, MBMAXTYPE > doEntities
 If true operator is executed for entity.
 
booldoVertices
 \deprectaed If false skip vertices
 
booldoEdges
 \deprectaed If false skip edges
 
booldoQuads
 \deprectaed
 
booldoTris
 \deprectaed
 
booldoTets
 \deprectaed
 
booldoPrisms
 \deprectaed
 

Additional Inherited Members

- Public Types inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
enum  OpType {
  OPROW = 1 << 0 , OPCOL = 1 << 1 , OPROWCOL = 1 << 2 , OPSPACE = 1 << 3 ,
  OPLAST = 1 << 3
}
 Controls loop over entities on element. More...
 
using AdjCache
 
- Public Types inherited from MoFEM::DataOperator
using DoWorkLhsHookFunType
 
using DoWorkRhsHookFunType
 
- Static Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
static const char *const OpTypeNames []
 
- Protected Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator
MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 
- Protected Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
- 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.cpp, and Remodeling.hpp.

Definition at line 1144 of file Remodeling.cpp.

1146 : VolumeElementForcesAndSourcesCore::UserDataOperator(
1147 "DISPLACEMENTS", "DISPLACEMENTS", UserDataOperator::OPROWCOL),
1148 commonData(common_data) {
1149 sYmm = true;
1150}
Remodeling::CommonData & commonData
bool sYmm
If true assume that matrix is symmetric structure.

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.cpp, and Remodeling.hpp.

Definition at line 1152 of file Remodeling.cpp.

1155 {
1156
1158
1159 const int row_nb_dofs = row_data.getIndices().size();
1160 if (!row_nb_dofs)
1162 const int col_nb_dofs = col_data.getIndices().size();
1163 if (!col_nb_dofs)
1165
1166 const bool diagonal_block = (row_type == col_type) && (row_side == col_side);
1167
1168 // Set size can clear local tangent matrix
1169 locK_P_F.resize(row_nb_dofs, col_nb_dofs, false);
1170 locK_P_F.clear();
1171
1172 const int row_nb_gauss_pts = row_data.getN().size1();
1173 const int row_nb_base_functions = row_data.getN().size2();
1174
1177 // MatrixDouble &dS_dC = commonData.data.matMaterialTangent;
1178 // MatrixDouble &matF = commonData.data.matGradientOfDeformation;
1179
1180 double t0;
1181
1182 const double n = commonData.n;
1183 const double rho_ref = commonData.rHo_ref;
1184
1185 FTensor::Index<'i', 3> i;
1186 FTensor::Index<'j', 3> j;
1187 FTensor::Index<'k', 3> k;
1188 FTensor::Index<'I', 3> I;
1189 FTensor::Index<'J', 3> J;
1190 FTensor::Index<'K', 3> K;
1191 FTensor::Index<'L', 3> L;
1192
1193 auto row_diff_base_functions = row_data.getFTensor1DiffN<3>();
1197
1198 // FTensor::Tensor4_ddg<double*,3,3> D1(SYMMETRIC_TENSOR4_MAT_PTR(dS_dC),6);
1199 // FTensor::Tensor2<double*,3,3> F(TENSOR2_MAT_PTR(matF));
1200
1201 for (int gg = 0; gg != row_nb_gauss_pts; gg++) {
1202
1203 // Get volume and integration weight
1204 double w = getVolume() * getGaussPts()(3, gg);
1205 const double a = w * pow(rho / rho_ref, n);
1206
1207 int row_bb = 0;
1208 for (; row_bb != row_nb_dofs / 3; row_bb++) {
1209
1210 auto col_diff_base_functions = col_data.getFTensor1DiffN<3>(gg, 0);
1211
1212 const int final_bb = diagonal_block ? row_bb + 1 : col_nb_dofs / 3;
1213 int col_bb = 0;
1214 for (; col_bb != final_bb; col_bb++) {
1215
1217 &locK_P_F(3 * row_bb + 0, 3 * col_bb + 0),
1218 &locK_P_F(3 * row_bb + 0, 3 * col_bb + 1),
1219 &locK_P_F(3 * row_bb + 0, 3 * col_bb + 2),
1220 &locK_P_F(3 * row_bb + 1, 3 * col_bb + 0),
1221 &locK_P_F(3 * row_bb + 1, 3 * col_bb + 1),
1222 &locK_P_F(3 * row_bb + 1, 3 * col_bb + 2),
1223 &locK_P_F(3 * row_bb + 2, 3 * col_bb + 0),
1224 &locK_P_F(3 * row_bb + 2, 3 * col_bb + 1),
1225 &locK_P_F(3 * row_bb + 2, 3 * col_bb + 2));
1226
1227 diffDiff(J, L) =
1228 a * row_diff_base_functions(J) * col_diff_base_functions(L);
1229
1230 // TODO: FIXME: Tensor D2 has major symmetry, we do not have such tensor
1231 // implemented at the moment. Using tensor with major symmetry will
1232 // improve code efficiency.
1233 t_assemble(i, k) += diffDiff(J, L) * D2(i, J, k, L);
1234
1235 if (ADOLC) {
1236 // Stress stiffening part (only with adolc since it is using dS / dC
1237 // derrivative. Check OpCalculateStressTangentWithAdolc operator)
1238 t0 = diffDiff(J, L) * S(J, L);
1239 t_assemble(0, 0) += t0;
1240 t_assemble(1, 1) += t0;
1241 t_assemble(2, 2) += t0;
1242 }
1243
1244 // Next base function for column
1245 ++col_diff_base_functions;
1246 }
1247
1248 ++row_diff_base_functions;
1249 }
1250 for (; row_bb != row_nb_base_functions; row_bb++) {
1251 ++row_diff_base_functions;
1252 }
1253
1254 // ++D1;
1255 ++D2;
1256 ++S;
1257 // ++F;
1258 ++rho;
1259 }
1260
1261 // Copy of symmetric part for assemble
1262 if (diagonal_block) {
1263 for (int row_bb = 0; row_bb != row_nb_dofs / 3; row_bb++) {
1264 int col_bb = 0;
1265 for (; col_bb != row_bb + 1; col_bb++) {
1267 &locK_P_F(3 * row_bb + 0, 3 * col_bb + 0),
1268 &locK_P_F(3 * row_bb + 0, 3 * col_bb + 1),
1269 &locK_P_F(3 * row_bb + 0, 3 * col_bb + 2),
1270 &locK_P_F(3 * row_bb + 1, 3 * col_bb + 0),
1271 &locK_P_F(3 * row_bb + 1, 3 * col_bb + 1),
1272 &locK_P_F(3 * row_bb + 1, 3 * col_bb + 2),
1273 &locK_P_F(3 * row_bb + 2, 3 * col_bb + 0),
1274 &locK_P_F(3 * row_bb + 2, 3 * col_bb + 1),
1275 &locK_P_F(3 * row_bb + 2, 3 * col_bb + 2));
1277 &locK_P_F(3 * col_bb + 0, 3 * row_bb + 0),
1278 &locK_P_F(3 * col_bb + 0, 3 * row_bb + 1),
1279 &locK_P_F(3 * col_bb + 0, 3 * row_bb + 2),
1280 &locK_P_F(3 * col_bb + 1, 3 * row_bb + 0),
1281 &locK_P_F(3 * col_bb + 1, 3 * row_bb + 1),
1282 &locK_P_F(3 * col_bb + 1, 3 * row_bb + 2),
1283 &locK_P_F(3 * col_bb + 2, 3 * row_bb + 0),
1284 &locK_P_F(3 * col_bb + 2, 3 * row_bb + 1),
1285 &locK_P_F(3 * col_bb + 2, 3 * row_bb + 2));
1286 t_off_side(i, k) = t_assemble(k, i);
1287 }
1288 }
1289 }
1290
1291 const int *row_ind = &*row_data.getIndices().begin();
1292 const int *col_ind = &*col_data.getIndices().begin();
1293 CHKERR MatSetValues(getFEMethod()->ts_B, row_nb_dofs, row_ind, col_nb_dofs,
1294 col_ind, &locK_P_F(0, 0), ADD_VALUES);
1295
1296 if (row_type != col_type || row_side != col_side) {
1297 transLocK_P_F.resize(col_nb_dofs, row_nb_dofs, false);
1298 noalias(transLocK_P_F) = trans(locK_P_F);
1299 CHKERR MatSetValues(getFEMethod()->ts_B, col_nb_dofs, col_ind, row_nb_dofs,
1300 row_ind, &transLocK_P_F(0, 0), ADD_VALUES);
1301 }
1302
1304}
constexpr double a
#define SYMMETRIC_TENSOR2_MAT_PTR(MAT)
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define TENSOR4_MAT_PTR(MAT)
FTensor::Index< 'i', SPACE_DIM > i
const double n
refractive index of diffusive medium
FTensor::Index< 'J', DIM1 > J
Definition level_set.cpp:30
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
MoFEMErrorCode MatSetValues(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
constexpr IntegrationType I
double rho
Definition plastic.cpp:144
FTensor::Tensor2< double, 3, 3 > diffDiff
boost::shared_ptr< VectorDouble > rhoPtr
Ptr to density matrix container.
double n
porosity exponent [-]
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element

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: