Operator implementation of U-P (mixed) finite element.
Operator implementation of U-P (mixed) finite element.
#ifndef __ELASTICITYMIXEDFORMULATION_HPP__
#define __ELASTICITYMIXEDFORMULATION_HPP__
};
boost::shared_ptr<VectorDouble>
pPtr;
gradDispPtr = boost::shared_ptr<MatrixDouble>(
new MatrixDouble());
pPtr = boost::shared_ptr<VectorDouble>(
new VectorDouble());
CHKERRABORT(PETSC_COMM_WORLD,
ierr);
}
CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"Problem",
"none");
ierr = PetscOptionsEnd();
}
}
Mat_Elastic mydata;
CHKERR it->getAttributeDataStructure(mydata);
int id = it->getMeshsetId();
}
}
private:
};
: public VolumeElementForcesAndSourcesCore::UserDataOperator {
sYmm = true;
}
EntitiesFieldData::EntData &row_data,
EntitiesFieldData::EntData &col_data) {
const int row_nb_dofs = row_data.getIndices().size();
if (!row_nb_dofs)
const int col_nb_dofs = col_data.getIndices().size();
if (!col_nb_dofs)
if (
dAta.
tEts.find(getNumeredEntFiniteElementPtr()->getEnt()) ==
}
locP.resize(row_nb_dofs, col_nb_dofs,
false);
const int row_nb_gauss_pts = row_data.getN().size1();
if (!row_nb_gauss_pts)
const int row_nb_base_functions = row_data.getN().size2();
auto row_base_functions = row_data.getFTensor0N();
if (coefficient != 0.) {
for (int gg = 0; gg != row_nb_gauss_pts; gg++) {
double w = getVolume() * getGaussPts()(3, gg);
int row_bb = 0;
for (; row_bb != row_nb_dofs; row_bb++) {
auto col_base_functions = col_data.getFTensor0N(gg, 0);
for (int col_bb = 0; col_bb != col_nb_dofs; col_bb++) {
w * row_base_functions * col_base_functions * coefficient;
++col_base_functions;
}
++row_base_functions;
}
for (; row_bb != row_nb_base_functions; row_bb++) {
++row_base_functions;
}
}
}
getFEMethod()->ksp_B, row_nb_dofs, &*row_data.getIndices().begin(),
col_nb_dofs, &*col_data.getIndices().begin(), &
locP(0, 0), ADD_VALUES);
if (row_side != col_side || row_type != col_type) {
translocP.resize(col_nb_dofs, row_nb_dofs,
false);
&*col_data.getIndices().begin(), row_nb_dofs,
&*row_data.getIndices().begin(), &
translocP(0, 0),
ADD_VALUES);
}
}
};
: public VolumeElementForcesAndSourcesCore::UserDataOperator {
sYmm = false;
}
EntitiesFieldData::EntData &row_data,
EntitiesFieldData::EntData &col_data) {
const int row_nb_dofs = row_data.getIndices().size();
if (!row_nb_dofs)
const int col_nb_dofs = col_data.getIndices().size();
if (!col_nb_dofs)
if (
dAta.
tEts.find(getNumeredEntFiniteElementPtr()->getEnt()) ==
}
locG.resize(row_nb_dofs, col_nb_dofs,
false);
const int row_nb_gauss_pts = row_data.getN().size1();
if (!row_nb_gauss_pts)
const int row_nb_base_functions = row_data.getN().size2();
auto row_diff_base_functions = row_data.getFTensor1DiffN<3>();
for (int gg = 0; gg != row_nb_gauss_pts; gg++) {
double w = getVolume() * getGaussPts()(3, gg);
int row_bb = 0;
for (; row_bb != row_nb_dofs / 3; row_bb++) {
t1(
i) =
w * row_diff_base_functions(
i);
auto base_functions = col_data.getFTensor0N(gg, 0);
for (int col_bb = 0; col_bb != col_nb_dofs; col_bb++) {
&
locG(3 * row_bb + 1, col_bb),
&
locG(3 * row_bb + 2, col_bb));
k(
i) += t1(
i) * base_functions;
++base_functions;
}
++row_diff_base_functions;
}
for (; row_bb != row_nb_base_functions; row_bb++) {
++row_diff_base_functions;
}
}
&*row_data.getIndices().begin(), col_nb_dofs,
&*col_data.getIndices().begin(), &*
locG.data().begin(),
ADD_VALUES);
&*col_data.getIndices().begin(), row_nb_dofs,
&*row_data.getIndices().begin(), &*
locG.data().begin(),
ADD_VALUES);
}
};
: public VolumeElementForcesAndSourcesCore::UserDataOperator {
bool symm = true)
symm),
EntitiesFieldData::EntData &row_data,
EntitiesFieldData::EntData &col_data) {
&
m(r + 0,
c + 0), &
m(r + 0,
c + 1), &
m(r + 0,
c + 2),
&
m(r + 1,
c + 0), &
m(r + 1,
c + 1), &
m(r + 1,
c + 2),
&
m(r + 2,
c + 0), &
m(r + 2,
c + 1), &
m(r + 2,
c + 2));
};
const int row_nb_dofs = row_data.getIndices().size();
if (!row_nb_dofs)
const int col_nb_dofs = col_data.getIndices().size();
if (!col_nb_dofs)
if (
dAta.
tEts.find(getNumeredEntFiniteElementPtr()->getEnt()) ==
}
const bool diagonal_block =
(row_type == col_type) && (row_side == col_side);
locK.resize(row_nb_dofs, col_nb_dofs,
false);
const int row_nb_gauss_pts = row_data.getN().size1();
const int row_nb_base_functions = row_data.getN().size2();
auto row_diff_base_functions = row_data.getFTensor1DiffN<3>();
for (int gg = 0; gg != row_nb_gauss_pts; gg++) {
double w = getVolume() * getGaussPts()(3, gg);
int row_bb = 0;
for (; row_bb != row_nb_dofs / 3; row_bb++) {
auto col_diff_base_functions = col_data.getFTensor1DiffN<3>(gg, 0);
const int final_bb = diagonal_block ? row_bb + 1 : col_nb_dofs / 3;
int col_bb = 0;
for (; col_bb != final_bb; col_bb++) {
auto t_assemble = get_tensor2(
locK, 3 * row_bb, 3 * col_bb);
w * row_diff_base_functions(
j) * col_diff_base_functions(
l);
++col_diff_base_functions;
}
++row_diff_base_functions;
}
for (; row_bb != row_nb_base_functions; row_bb++) {
++row_diff_base_functions;
}
}
if (diagonal_block) {
for (int row_bb = 0; row_bb != row_nb_dofs / 3; row_bb++) {
int col_bb = 0;
for (; col_bb != row_bb + 1; col_bb++) {
auto t_assemble = get_tensor2(
locK, 3 * row_bb, 3 * col_bb);
auto t_off_side = get_tensor2(
locK, 3 * col_bb, 3 * row_bb);
t_off_side(
i,
k) = t_assemble(
k,
i);
}
}
}
const int *row_ind = &*row_data.getIndices().begin();
const int *col_ind = &*col_data.getIndices().begin();
Mat
B = getFEMethod()->ksp_B != PETSC_NULL ? getFEMethod()->ksp_B
: getFEMethod()->ksp_B;
&
locK(0, 0), ADD_VALUES);
if (row_type != col_type || row_side != col_side) {
translocK.resize(col_nb_dofs, row_nb_dofs,
false);
}
}
};
std::vector<EntityHandle> &map_gauss_pts,
}
EntitiesFieldData::EntData &data) {
if (type != MBVERTEX)
PetscFunctionReturn(9);
double def_VAL[9];
bzero(def_VAL, 9 * sizeof(double));
}
Tag th_stress;
MB_TAG_CREAT | MB_TAG_SPARSE, def_VAL);
Tag th_strain;
MB_TAG_CREAT | MB_TAG_SPARSE, def_VAL);
Tag th_psi;
MB_TAG_CREAT | MB_TAG_SPARSE, def_VAL);
for (int gg = 0; gg != nb_gauss_pts; gg++) {
strain(
i,
j) = 0.5 * (grad(
i,
j) + grad(
j,
i));
double psi = 0.5 *
p *
p +
mu * strain(
i,
j) * strain(
i,
j);
stress(
i,
j) = 2 *
mu * strain(
i,
j);
&strain(0, 0));
&stress(0, 0));
++grad;
}
}
};
#endif
ForcesAndSourcesCore::UserDataOperator UserDataOperator
static PetscErrorCode ierr
#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 ...
@ MAT_ELASTICSET
block name is "MAT_ELASTIC"
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
FTensor::Index< 'm', SPACE_DIM > m
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.
FTensor::Index< 'i', SPACE_DIM > i
const double c
speed of light (cm/ns)
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
UBlasMatrix< double > MatrixDouble
MoFEMErrorCode MatSetValues(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.
MoFEMErrorCode getBlockData(BlockData &data)
boost::shared_ptr< MatrixDouble > gradDispPtr
FTensor::Ddg< double, 3, 3 > tD
MoFEM::Interface & mField
std::map< int, BlockData > setOfBlocksData
MoFEMErrorCode setBlocks()
boost::shared_ptr< VectorDouble > pPtr
MoFEMErrorCode getParameters()
virtual moab::Interface & get_moab()=0
bool & doPrisms
\deprectaed
bool & doVertices
\deprectaed If false skip vertices
bool & doEdges
\deprectaed If false skip edges
bool & doQuads
\deprectaed
Deprecated interface functions.
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.
@ OPROW
operator doWork function is executed on FE rows
PetscErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
DataAtIntegrationPts & commonData
FTensor::Tensor2< double, 3, 3 > diffDiff
MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
Do calculations for give operator.
DataAtIntegrationPts & commonData
PetscErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
std::vector< EntityHandle > & mapGaussPts
DataAtIntegrationPts & commonData
moab::Interface & postProcMesh
PetscErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)