Operator implementation of U-P (mixed) finite element.
#ifndef __ELASTICITYMIXEDFORMULATION_HPP__
#define __ELASTICITYMIXEDFORMULATION_HPP__
};
boost::shared_ptr<VectorDouble>
pPtr;
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:
};
sYmm = true;
}
PetscErrorCode
doWork(
int row_side,
int col_side, EntityType row_type,
EntityType col_type,
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);
}
}
};
sYmm = false;
}
PetscErrorCode
doWork(
int row_side,
int col_side, EntityType row_type,
EntityType col_type,
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);
}
};
bool symm = true)
symm),
PetscErrorCode
doWork(
int row_side,
int col_side, EntityType row_type,
EntityType col_type,
&
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,
}
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);
stress(1, 1) -= p;
stress(0, 0) -= p;
stress(2, 2) -= p;
&strain(0, 0));
&stress(0, 0));
++p;
++grad;
}
}
};
#endif //__ELASTICITYMIXEDFORMULATION_HPP__