template <int DIM, IntegrationType I, typename AssemblyDomainEleOp>
struct OpLhsSymTensorLeastSquaresProjImpl;
template <int DIM, IntegrationType I>
OpLhsSymTensorLeastSquaresProjImpl<DIM, I, AssemblyDomainEleOp>;
template <AssemblyType A, IntegrationType I>
filterScalarSolution(
const std::string
field_name, boost::shared_ptr<VectorDouble> old_sol_ptr,
boost::shared_ptr<VectorDouble> dot_new_sol_ptr,
boost::shared_ptr<VectorDouble> new_sol_ptr,
boost::shared_ptr<MatrixDouble> grad_new_sol_ptr,
ScalarFun scalar_function = [](double, double,
double) constexpr { return 1; })
MoFEMErrorCode
doWork(EntitiesFieldData::EntData &data) {
const double vol = getMeasure();
auto t_w = getFTensor0IntegrationWeight();
auto t_coords = getFTensor1CoordsAtGaussPts();
auto t_base = data.getFTensor0N();
auto t_diff_base = data.getFTensor1DiffN<
SPACE_DIM>();
#ifndef NDEBUG
if (data.getDiffN().size1() != data.getN().size1())
if (data.getDiffN().size2() != data.getN().size2() *
SPACE_DIM) {
<< "Side " << rowSide << " " << CN::EntityTypeName(rowType);
MOFEM_LOG(
"SELF", Sev::error) << data.getN();
MOFEM_LOG(
"SELF", Sev::error) << data.getDiffN();
}
#endif
auto t_old_sol = getFTensor0FromVec(*
oldSolPtr);
auto t_new_sol = getFTensor0FromVec(*
newSolPtr);
for (int gg = 0; gg != nbIntegrationPts; ++gg) {
const double alpha =
int bb = 0;
for (; bb != nbRows; ++bb) {
t_old_sol += alpha * t_old_sol;
if (t_w > 0.0)
continue;
if (t_w > 0.0 && t_old_sol < fabs(1e-12))
continue;
if (t_w < fabs(1e-12))
continue;
++t_base;
++t_diff_base;
}
for (; bb < nbRowBaseFunctions; ++bb) {
++t_base;
++t_diff_base;
}
++t_old_sol;
++t_new_sol;
++t_coords;
++t_w;
}
}
private:
};
template <AssemblyType A, IntegrationType I, int DIM>
OpRhsScalarLeastSquaresProj(
const std::string
field_name, boost::shared_ptr<VectorDouble> old_sol_ptr,
boost::shared_ptr<VectorDouble> dot_new_sol_ptr,
boost::shared_ptr<VectorDouble> new_sol_ptr,
boost::shared_ptr<MatrixDouble> grad_new_sol_ptr,
ScalarFun scalar_function = [](double, double,
double) constexpr { return 1; })
MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &data) {
const double vol = getMeasure();
auto t_w = getFTensor0IntegrationWeight();
auto t_coords = getFTensor1CoordsAtGaussPts();
auto t_base = data.getFTensor0N();
auto t_diff_base = data.getFTensor1DiffN<
SPACE_DIM>();
#ifndef NDEBUG
if (data.getDiffN().size1() != data.getN().size1())
if (data.getDiffN().size2() != data.getN().size2() *
SPACE_DIM) {
<< "Side " << rowSide << " " << CN::EntityTypeName(rowType);
MOFEM_LOG(
"SELF", Sev::error) << data.getN();
MOFEM_LOG(
"SELF", Sev::error) << data.getDiffN();
}
#endif
auto t_old_sol = getFTensor0FromVec(*
oldSolPtr);
auto t_new_sol = getFTensor0FromVec(*
newSolPtr);
for (int gg = 0; gg != nbIntegrationPts; ++gg) {
const double alpha =
int bb = 0;
for (; bb != nbRows; ++bb) {
locF[bb] += (t_base * alpha) * (t_old_sol);
++t_base;
++t_diff_base;
}
for (; bb < nbRowBaseFunctions; ++bb) {
++t_base;
++t_diff_base;
}
++t_old_sol;
++t_new_sol;
++t_coords;
++t_w;
}
}
private:
};
template <AssemblyType A, IntegrationType I, int DIM>
OpRhsH1VectorLeastSquaresProj(
const std::string
field_name, boost::shared_ptr<MatrixDouble> old_sol_ptr,
boost::shared_ptr<MatrixDouble> dot_new_sol_ptr,
boost::shared_ptr<MatrixDouble> new_sol_ptr,
boost::shared_ptr<MatrixDouble> grad_new_sol_ptr,
ScalarFun scalar_function = [](double, double,
double) constexpr { return 1; })
MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &data) {
const double vol = getMeasure();
auto t_w = getFTensor0IntegrationWeight();
auto t_coords = getFTensor1CoordsAtGaussPts();
auto t_base = data.getFTensor0N();
auto t_diff_base = data.getFTensor1DiffN<
SPACE_DIM>();
#ifndef NDEBUG
if (data.getDiffN().size1() != data.getN().size1())
if (data.getDiffN().size2() != data.getN().size2() *
SPACE_DIM) {
<< "Side " << rowSide << " " << CN::EntityTypeName(rowType);
MOFEM_LOG(
"SELF", Sev::error) << data.getN();
MOFEM_LOG(
"SELF", Sev::error) << data.getDiffN();
}
#endif
auto t_old_sol = getFTensor1FromMat<SPACE_DIM>(*
oldSolPtr);
auto t_new_sol = getFTensor1FromMat<SPACE_DIM>(*
newSolPtr);
for (int gg = 0; gg != nbIntegrationPts; ++gg) {
const double alpha =
auto t_nf = getFTensor1FromArray<SPACE_DIM, SPACE_DIM>(locF);
int bb = 0;
t_nf(
i) += (t_base * alpha) * (t_old_sol(
i));
++t_base;
++t_diff_base;
++t_nf;
}
for (; bb < nbRowBaseFunctions; ++bb) {
++t_base;
++t_diff_base;
}
++t_old_sol;
++t_new_sol;
++t_coords;
++t_w;
}
}
private:
};
template <AssemblyType A, IntegrationType I, int DIM>
OpRhsSymTensorLeastSquaresProj(
const std::string
field_name, boost::shared_ptr<MatrixDouble> old_sol_ptr,
boost::shared_ptr<MatrixDouble> dot_new_sol_ptr,
boost::shared_ptr<MatrixDouble> new_sol_ptr,
boost::shared_ptr<MatrixDouble> grad_new_sol_ptr,
ScalarFun scalar_function = [](double, double,
double) constexpr { return 1; })
MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &data) {
constexpr auto size_symm = (DIM * (DIM + 1)) / 2;
const double vol = getMeasure();
auto t_w = getFTensor0IntegrationWeight();
auto t_coords = getFTensor1CoordsAtGaussPts();
auto t_base = data.getFTensor0N();
auto t_diff_base = data.getFTensor1DiffN<DIM>();
#ifndef NDEBUG
if (data.getDiffN().size1() != data.getN().size1())
if (data.getDiffN().size2() != data.getN().size2() *
SPACE_DIM) {
<< "Side " << rowSide << " " << CN::EntityTypeName(rowType);
MOFEM_LOG(
"SELF", Sev::error) << data.getN();
MOFEM_LOG(
"SELF", Sev::error) << data.getDiffN();
}
#endif
auto &nf = AssemblyDomainEleOp::locF;
auto t_old_sol = getFTensor2SymmetricFromMat<DIM>(*
oldSolPtr);
auto t_new_sol = getFTensor2SymmetricFromMat<DIM>(*
newSolPtr);
for (int gg = 0; gg != nbIntegrationPts; ++gg) {
const double alpha =
t_old_sol_L(L) = alpha * t_old_sol(
i,
j) * t_L(
i,
j, L);
auto t_nf = getFTensor1FromArray<size_symm, size_symm>(nf);
int bb = 0;
for (; bb != AssemblyDomainEleOp::nbRows /
size_symm; ++bb) {
t_nf(L) += t_base * (t_old_sol_L(L));
++t_base;
++t_diff_base;
++t_nf;
}
for (; bb < nbRowBaseFunctions; ++bb) {
++t_base;
++t_diff_base;
}
++t_old_sol;
++t_new_sol;
++t_coords;
++t_w;
}
}
private:
};
template <int DIM, typename AssemblyDomainEleOp>
OpLhsSymTensorLeastSquaresProjImpl(const std::string row_field_name,
const std::string col_field_name);
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data,
EntitiesFieldData::EntData &col_data);
private:
};
template <int DIM, typename AssemblyDomainEleOp>
OpLhsSymTensorLeastSquaresProjImpl<DIM, GAUSS, AssemblyDomainEleOp>::
OpLhsSymTensorLeastSquaresProjImpl(const std::string row_field_name,
const std::string col_field_name)
AssemblyDomainEleOp::OPROWCOL) {
AssemblyDomainEleOp::sYmm = false;
}
template <int DIM, typename AssemblyDomainEleOp>
MoFEMErrorCode
OpLhsSymTensorLeastSquaresProjImpl<DIM, GAUSS, AssemblyDomainEleOp>::iNtegrate(
EntitiesFieldData::EntData &row_data,
EntitiesFieldData::EntData &col_data) {
constexpr auto size_symm = (DIM * (DIM + 1)) / 2;
auto &locMat = AssemblyDomainEleOp::locMat;
const auto nb_integration_pts = AssemblyDomainEleOp::getGaussPts().size2();
const auto nb_row_base_functions = row_data.getN().size2();
auto t_w = AssemblyDomainEleOp::getFTensor0IntegrationWeight();
auto t_row_base = row_data.getFTensor0N();
for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
double alpha = AssemblyDomainEleOp::getMeasure() * t_w;
++t_w;
t_res_mat(O, L) = alpha * (t_L(
i,
j, O) * t_L(
i,
j, L));
size_t rr = 0;
for (; rr != AssemblyDomainEleOp::nbRows /
size_symm; ++rr) {
auto t_col_base = col_data.getFTensor0N(gg, 0);
for (
size_t cc = 0; cc != AssemblyDomainEleOp::nbCols /
size_symm; ++cc) {
t_mat(O, L) += ((t_row_base * t_col_base) * t_res_mat(O, L));
++t_mat;
++t_col_base;
}
++t_row_base;
}
for (; rr < nb_row_base_functions; ++rr)
++t_row_base;
}
}
template <AssemblyType A, IntegrationType I, int DIM>
OpRhsHdivLeastSquaresProj(
const std::string
field_name, boost::shared_ptr<MatrixDouble> old_sol_ptr,
boost::shared_ptr<MatrixDouble> dot_new_sol_ptr,
boost::shared_ptr<MatrixDouble> new_sol_ptr,
boost::shared_ptr<MatrixDouble> grad_new_sol_ptr,
ScalarFun scalar_function = [](double, double,
double) constexpr { return 1; })
MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &data) {
const double vol = getMeasure();
auto t_w = getFTensor0IntegrationWeight();
auto t_coords = getFTensor1CoordsAtGaussPts();
auto t_base = data.getFTensor1N<3>();
auto t_diff_base = data.getFTensor1DiffN<
SPACE_DIM>();
#ifndef NDEBUG
if (data.getDiffN().size1() != data.getN().size1())
if (data.getDiffN().size2() != data.getN().size2() *
SPACE_DIM) {
<< "Side " << rowSide << " " << CN::EntityTypeName(rowType);
MOFEM_LOG(
"SELF", Sev::error) << data.getN();
MOFEM_LOG(
"SELF", Sev::error) << data.getDiffN();
}
#endif
auto t_old_sol = getFTensor1FromMat<SPACE_DIM>(*
oldSolPtr);
auto t_new_sol = getFTensor1FromMat<SPACE_DIM>(*
newSolPtr);
for (int gg = 0; gg != nbIntegrationPts; ++gg) {
const double alpha =
int bb = 0;
for (; bb != nbRows; ++bb) {
locF[bb] += (t_base(
i) * alpha) *
++t_base;
++t_diff_base;
}
for (; bb < nbRowBaseFunctions; ++bb) {
++t_base;
++t_diff_base;
}
++t_old_sol;
++t_new_sol;
++t_coords;
++t_w;
}
}
private:
};
template <AssemblyType A, IntegrationType I, int DIM>
boost::shared_ptr<MatrixDouble> dot_EP_ptr,
boost::shared_ptr<MatrixDouble> EP_ptr,
boost::shared_ptr<MatrixDouble> grad_EP_ptr,
boost::shared_ptr<double> initial_EP_ptr,
boost::shared_ptr<double> peak_EP_ptr)
MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &data) {
constexpr auto size_symm = (DIM * (DIM + 1)) / 2;
const double vol = getMeasure();
auto t_w = getFTensor0IntegrationWeight();
auto t_coords = getFTensor1CoordsAtGaussPts();
auto t_base = data.getFTensor0N();
auto t_diff_base = data.getFTensor1DiffN<
SPACE_DIM>();
#ifndef NDEBUG
if (data.getDiffN().size1() != data.getN().size1())
if (data.getDiffN().size2() != data.getN().size2() *
SPACE_DIM) {
<< "Side " << rowSide << " " << CN::EntityTypeName(rowType);
MOFEM_LOG(
"SELF", Sev::error) << data.getN();
MOFEM_LOG(
"SELF", Sev::error) << data.getDiffN();
}
#endif
auto t_EP = getFTensor2SymmetricFromMat<SPACE_DIM>(*
EPPtr);
const double alpha = t_w * vol;
auto &nf = AssemblyDomainEleOp::locF;
for (int gg = 0; gg != nbIntegrationPts; ++gg) {
t_coords(1), t_coords(2));
t_set_EP(1, 1) = t_set_EP(0, 0) - 0.01;
t_set_EP(0, 1) = t_set_EP(0, 0) - 0.02;
const double alpha = t_w * vol;
t_set_EP_L(L) = alpha * t_set_EP(
i,
j) * t_L(
i,
j, L);
auto t_nf = getFTensor1FromArray<size_symm, size_symm>(nf);
int bb = 0;
for (; bb != AssemblyDomainEleOp::nbRows /
size_symm; ++bb) {
t_nf(L) -= t_base * (t_set_EP_L(L));
++t_base;
++t_diff_base;
++t_nf;
}
for (; bb < nbRowBaseFunctions; ++bb) {
++t_base;
++t_diff_base;
}
++t_EP;
++t_coords;
++t_w;
}
}
private:
boost::shared_ptr<MatrixDouble>
dotEPPtr;
boost::shared_ptr<MatrixDouble>
EPPtr;
boost::shared_ptr<MatrixDouble>
gradQPtr;
};
}
#define FTENSOR_INDEX(DIM, I)
constexpr int SPACE_DIM
[Define dimension]
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MOFEM_LOG(channel, severity)
Log.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
OpLhsSymTensorLeastSquaresProjImpl< DIM, I, AssemblyDomainEleOp > OpLhsSymTensorLeastSquaresProj
static auto get_mat_tensor_sym_dtensor_sym(size_t rr, MatrixDouble &mat, FTensor::Number< 2 >)
auto symm_L_tensor(FTensor::Number< DIM >)
constexpr auto field_name
boost::shared_ptr< MatrixDouble > gradNewSolPtr
boost::shared_ptr< MatrixDouble > oldSolPtr
MoFEM::Interface & mField
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &data)
boost::shared_ptr< MatrixDouble > newSolPtr
boost::shared_ptr< MatrixDouble > dotNewSolPtr
boost::shared_ptr< MatrixDouble > dotNewSolPtr
boost::shared_ptr< MatrixDouble > newSolPtr
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &data)
boost::shared_ptr< MatrixDouble > gradNewSolPtr
MoFEM::Interface & mField
boost::shared_ptr< MatrixDouble > oldSolPtr
ScalarFun resistanceFunction
boost::shared_ptr< MatrixDouble > gradNewSolPtr
boost::shared_ptr< VectorDouble > newSolPtr
boost::shared_ptr< VectorDouble > oldSolPtr
boost::shared_ptr< VectorDouble > dotNewSolPtr
MoFEM::Interface & mField
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &data)
boost::shared_ptr< double > peakEPPtr
boost::shared_ptr< double > initialEPPtr
boost::shared_ptr< MatrixDouble > EPPtr
boost::shared_ptr< MatrixDouble > gradEPPtr
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &data)
boost::shared_ptr< MatrixDouble > gradQPtr
boost::shared_ptr< MatrixDouble > dotEPPtr
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &data)
boost::shared_ptr< MatrixDouble > oldSolPtr
MoFEM::Interface & mField
boost::shared_ptr< MatrixDouble > newSolPtr
boost::shared_ptr< MatrixDouble > gradNewSolPtr
boost::shared_ptr< MatrixDouble > dotNewSolPtr
boost::shared_ptr< VectorDouble > dotNewSolPtr
MoFEMErrorCode doWork(EntitiesFieldData::EntData &data)
boost::shared_ptr< VectorDouble > newSolPtr
boost::shared_ptr< MatrixDouble > gradNewSolPtr
boost::shared_ptr< VectorDouble > oldSolPtr
Deprecated interface functions.
FormsIntegrators< DomainEleOp >::Assembly< A >::OpBase AssemblyDomainEleOp
auto init_T
Initialisation function for temperature field.