9template <
int DIM, IntegrationType I,
typename AssemblyDomainEleOp>
11template <
int DIM, IntegrationType I>
19template <AssemblyType A, IntegrationType I>
23 const std::string
field_name, boost::shared_ptr<VectorDouble> old_sol_ptr,
24 boost::shared_ptr<VectorDouble> dot_new_sol_ptr,
25 boost::shared_ptr<VectorDouble> new_sol_ptr,
26 boost::shared_ptr<MatrixDouble> grad_new_sol_ptr,
27 ScalarFun scalar_function = [](
double,
double,
28 double)
constexpr {
return 1; })
34 MoFEMErrorCode
doWork(EntitiesFieldData::EntData &data) {
37 const double vol = getMeasure();
38 auto t_w = getFTensor0IntegrationWeight();
39 auto t_coords = getFTensor1CoordsAtGaussPts();
40 auto t_base = data.getFTensor0N();
41 auto t_diff_base = data.getFTensor1DiffN<
SPACE_DIM>();
44 if (data.getDiffN().size1() != data.getN().size1())
46 if (data.getDiffN().size2() != data.getN().size2() *
SPACE_DIM) {
48 <<
"Side " << rowSide <<
" " << CN::EntityTypeName(rowType);
49 MOFEM_LOG(
"SELF", Sev::error) << data.getN();
50 MOFEM_LOG(
"SELF", Sev::error) << data.getDiffN();
55 auto t_old_sol = getFTensor0FromVec(*
oldSolPtr);
56 auto t_new_sol = getFTensor0FromVec(*
newSolPtr);
58 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
64 for (; bb != nbRows; ++bb) {
65 t_old_sol += alpha * t_old_sol;
69 if (t_w > 0.0 && t_old_sol < fabs(1e-12))
71 if (t_w < fabs(1e-12))
77 for (; bb < nbRowBaseFunctions; ++bb) {
104template <AssemblyType A, IntegrationType I,
int DIM>
108 const std::string
field_name, boost::shared_ptr<VectorDouble> old_sol_ptr,
109 boost::shared_ptr<VectorDouble> dot_new_sol_ptr,
110 boost::shared_ptr<VectorDouble> new_sol_ptr,
111 boost::shared_ptr<MatrixDouble> grad_new_sol_ptr,
113 ScalarFun scalar_function = [](
double,
double,
114 double)
constexpr {
return 1; })
120 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &data) {
123 const double vol = getMeasure();
124 auto t_w = getFTensor0IntegrationWeight();
125 auto t_coords = getFTensor1CoordsAtGaussPts();
126 auto t_base = data.getFTensor0N();
127 auto t_diff_base = data.getFTensor1DiffN<
SPACE_DIM>();
130 if (data.getDiffN().size1() != data.getN().size1())
132 if (data.getDiffN().size2() != data.getN().size2() *
SPACE_DIM) {
134 <<
"Side " << rowSide <<
" " << CN::EntityTypeName(rowType);
135 MOFEM_LOG(
"SELF", Sev::error) << data.getN();
136 MOFEM_LOG(
"SELF", Sev::error) << data.getDiffN();
141 auto t_old_sol = getFTensor0FromVec(*
oldSolPtr);
142 auto t_new_sol = getFTensor0FromVec(*
newSolPtr);
144 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
147 t_w * vol *
scalarFunction(t_coords(0), t_coords(1), t_coords(2));
150 for (; bb != nbRows; ++bb) {
151 locF[bb] += (t_base * alpha) * (t_old_sol);
156 for (; bb < nbRowBaseFunctions; ++bb) {
184template <AssemblyType A, IntegrationType I,
int DIM>
188 const std::string
field_name, boost::shared_ptr<MatrixDouble> old_sol_ptr,
189 boost::shared_ptr<MatrixDouble> dot_new_sol_ptr,
190 boost::shared_ptr<MatrixDouble> new_sol_ptr,
191 boost::shared_ptr<MatrixDouble> grad_new_sol_ptr,
193 ScalarFun scalar_function = [](
double,
double,
194 double)
constexpr {
return 1; })
200 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &data) {
205 const double vol = getMeasure();
206 auto t_w = getFTensor0IntegrationWeight();
207 auto t_coords = getFTensor1CoordsAtGaussPts();
208 auto t_base = data.getFTensor0N();
209 auto t_diff_base = data.getFTensor1DiffN<
SPACE_DIM>();
212 if (data.getDiffN().size1() != data.getN().size1())
214 if (data.getDiffN().size2() != data.getN().size2() *
SPACE_DIM) {
216 <<
"Side " << rowSide <<
" " << CN::EntityTypeName(rowType);
217 MOFEM_LOG(
"SELF", Sev::error) << data.getN();
218 MOFEM_LOG(
"SELF", Sev::error) << data.getDiffN();
223 auto t_old_sol = getFTensor1FromMat<SPACE_DIM>(*
oldSolPtr);
224 auto t_new_sol = getFTensor1FromMat<SPACE_DIM>(*
newSolPtr);
226 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
229 t_w * vol *
scalarFunction(t_coords(0), t_coords(1), t_coords(2));
231 auto t_nf = getFTensor1FromArray<SPACE_DIM, SPACE_DIM>(locF);
235 t_nf(
i) += (t_base * alpha) * (t_old_sol(
i));
241 for (; bb < nbRowBaseFunctions; ++bb) {
269template <AssemblyType A, IntegrationType I,
int DIM>
273 const std::string
field_name, boost::shared_ptr<MatrixDouble> old_sol_ptr,
274 boost::shared_ptr<MatrixDouble> dot_new_sol_ptr,
275 boost::shared_ptr<MatrixDouble> new_sol_ptr,
276 boost::shared_ptr<MatrixDouble> grad_new_sol_ptr,
278 ScalarFun scalar_function = [](
double,
double,
279 double)
constexpr {
return 1; })
285 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &data) {
290 constexpr auto size_symm = (DIM * (DIM + 1)) / 2;
293 const double vol = getMeasure();
294 auto t_w = getFTensor0IntegrationWeight();
295 auto t_coords = getFTensor1CoordsAtGaussPts();
296 auto t_base = data.getFTensor0N();
297 auto t_diff_base = data.getFTensor1DiffN<DIM>();
300 if (data.getDiffN().size1() != data.getN().size1())
302 if (data.getDiffN().size2() != data.getN().size2() *
SPACE_DIM) {
304 <<
"Side " << rowSide <<
" " << CN::EntityTypeName(rowType);
305 MOFEM_LOG(
"SELF", Sev::error) << data.getN();
306 MOFEM_LOG(
"SELF", Sev::error) << data.getDiffN();
312 auto &nf = AssemblyDomainEleOp::locF;
314 auto t_old_sol = getFTensor2SymmetricFromMat<DIM>(*
oldSolPtr);
315 auto t_new_sol = getFTensor2SymmetricFromMat<DIM>(*
newSolPtr);
317 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
320 t_w * vol *
scalarFunction(t_coords(0), t_coords(1), t_coords(2));
323 t_old_sol_L(L) = alpha * t_old_sol(
i,
j) * t_L(
i,
j, L);
325 auto t_nf = getFTensor1FromArray<size_symm, size_symm>(nf);
327 for (; bb != AssemblyDomainEleOp::nbRows /
size_symm; ++bb) {
328 t_nf(L) += t_base * (t_old_sol_L(L));
334 for (; bb < nbRowBaseFunctions; ++bb) {
358template <
int DIM,
typename AssemblyDomainEleOp>
362 const std::string col_field_name);
363 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data,
364 EntitiesFieldData::EntData &col_data);
369template <
int DIM,
typename AssemblyDomainEleOp>
372 const std::string col_field_name)
375 AssemblyDomainEleOp::sYmm =
false;
378template <
int DIM,
typename AssemblyDomainEleOp>
381 EntitiesFieldData::EntData &row_data,
382 EntitiesFieldData::EntData &col_data) {
389 constexpr auto size_symm = (DIM * (DIM + 1)) / 2;
393 auto &locMat = AssemblyDomainEleOp::locMat;
395 const auto nb_integration_pts = AssemblyDomainEleOp::getGaussPts().size2();
396 const auto nb_row_base_functions = row_data.getN().size2();
400 auto t_w = AssemblyDomainEleOp::getFTensor0IntegrationWeight();
401 auto t_row_base = row_data.getFTensor0N();
402 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
403 double alpha = AssemblyDomainEleOp::getMeasure() * t_w;
407 t_res_mat(O, L) = alpha * (t_L(
i,
j, O) * t_L(
i,
j, L));
410 for (; rr != AssemblyDomainEleOp::nbRows /
size_symm; ++rr) {
413 auto t_col_base = col_data.getFTensor0N(gg, 0);
414 for (
size_t cc = 0; cc != AssemblyDomainEleOp::nbCols /
size_symm; ++cc) {
415 t_mat(O, L) += ((t_row_base * t_col_base) * t_res_mat(O, L));
423 for (; rr < nb_row_base_functions; ++rr)
434template <AssemblyType A, IntegrationType I,
int DIM>
438 const std::string
field_name, boost::shared_ptr<MatrixDouble> old_sol_ptr,
439 boost::shared_ptr<MatrixDouble> dot_new_sol_ptr,
440 boost::shared_ptr<MatrixDouble> new_sol_ptr,
441 boost::shared_ptr<MatrixDouble> grad_new_sol_ptr,
443 ScalarFun scalar_function = [](
double,
double,
444 double)
constexpr {
return 1; })
451 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &data) {
456 const double vol = getMeasure();
457 auto t_w = getFTensor0IntegrationWeight();
458 auto t_coords = getFTensor1CoordsAtGaussPts();
459 auto t_base = data.getFTensor1N<3>();
460 auto t_diff_base = data.getFTensor1DiffN<
SPACE_DIM>();
463 if (data.getDiffN().size1() != data.getN().size1())
465 if (data.getDiffN().size2() != data.getN().size2() *
SPACE_DIM) {
467 <<
"Side " << rowSide <<
" " << CN::EntityTypeName(rowType);
468 MOFEM_LOG(
"SELF", Sev::error) << data.getN();
469 MOFEM_LOG(
"SELF", Sev::error) << data.getDiffN();
474 auto t_old_sol = getFTensor1FromMat<SPACE_DIM>(*
oldSolPtr);
475 auto t_new_sol = getFTensor1FromMat<SPACE_DIM>(*
newSolPtr);
477 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
480 t_w * vol *
scalarFunction(t_coords(0), t_coords(1), t_coords(2));
483 for (; bb != nbRows; ++bb) {
484 locF[bb] += (t_base(
i) * alpha) *
491 for (; bb < nbRowBaseFunctions; ++bb) {
520template <AssemblyType A, IntegrationType I,
int DIM>
524 boost::shared_ptr<MatrixDouble> dot_EP_ptr,
525 boost::shared_ptr<MatrixDouble> EP_ptr,
526 boost::shared_ptr<MatrixDouble> grad_EP_ptr,
527 boost::shared_ptr<double> initial_EP_ptr,
528 boost::shared_ptr<double> peak_EP_ptr)
533 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &data) {
538 constexpr auto size_symm = (DIM * (DIM + 1)) / 2;
541 const double vol = getMeasure();
542 auto t_w = getFTensor0IntegrationWeight();
543 auto t_coords = getFTensor1CoordsAtGaussPts();
544 auto t_base = data.getFTensor0N();
545 auto t_diff_base = data.getFTensor1DiffN<
SPACE_DIM>();
548 if (data.getDiffN().size1() != data.getN().size1())
550 if (data.getDiffN().size2() != data.getN().size2() *
SPACE_DIM) {
552 <<
"Side " << rowSide <<
" " << CN::EntityTypeName(rowType);
553 MOFEM_LOG(
"SELF", Sev::error) << data.getN();
554 MOFEM_LOG(
"SELF", Sev::error) << data.getDiffN();
559 auto t_EP = getFTensor2SymmetricFromMat<SPACE_DIM>(*
EPPtr);
562 const double alpha = t_w * vol;
567 auto &nf = AssemblyDomainEleOp::locF;
569 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
572 t_coords(1), t_coords(2));
573 t_set_EP(1, 1) = t_set_EP(0, 0) - 0.01;
574 t_set_EP(0, 1) = t_set_EP(0, 0) - 0.02;
582 const double alpha = t_w * vol;
585 t_set_EP_L(L) = alpha * t_set_EP(
i,
j) * t_L(
i,
j, L);
587 auto t_nf = getFTensor1FromArray<size_symm, size_symm>(nf);
589 for (; bb != AssemblyDomainEleOp::nbRows /
size_symm; ++bb) {
590 t_nf(L) -= t_base * (t_set_EP_L(L));
596 for (; bb < nbRowBaseFunctions; ++bb) {
613 boost::shared_ptr<MatrixDouble>
EPPtr;
#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
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
Rhs for mapping vector fields with a scalar basis with least squares.
boost::shared_ptr< MatrixDouble > gradNewSolPtr
boost::shared_ptr< MatrixDouble > oldSolPtr
MoFEM::Interface & mField
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &data)
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, MoFEM::Interface &m_field, ScalarFun scalar_function=[](double, double, double) constexpr { return 1;})
boost::shared_ptr< MatrixDouble > newSolPtr
boost::shared_ptr< MatrixDouble > dotNewSolPtr
Rhs for mapping vector fields with an Hdiv basis with least squares.
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 resistance_function, MoFEM::Interface &m_field, ScalarFun scalar_function=[](double, double, double) constexpr { return 1;})
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
Rhs for mapping scalar fields with least squares.
boost::shared_ptr< MatrixDouble > gradNewSolPtr
boost::shared_ptr< VectorDouble > newSolPtr
boost::shared_ptr< VectorDouble > oldSolPtr
boost::shared_ptr< VectorDouble > dotNewSolPtr
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, MoFEM::Interface &m_field, ScalarFun scalar_function=[](double, double, double) constexpr { return 1;})
MoFEM::Interface & mField
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &data)
Rhs for testing EP mapping with initial conditions.
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
OpRhsSetInitEP(const std::string field_name, 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)
Rhs for mapping symmetric tensor fields with least squares.
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
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, MoFEM::Interface &m_field, ScalarFun scalar_function=[](double, double, double) constexpr { return 1;})
Filter for scalar fields.
boost::shared_ptr< VectorDouble > dotNewSolPtr
MoFEMErrorCode doWork(EntitiesFieldData::EntData &data)
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;})
boost::shared_ptr< VectorDouble > newSolPtr
boost::shared_ptr< MatrixDouble > gradNewSolPtr
boost::shared_ptr< VectorDouble > oldSolPtr
Deprecated interface functions.
auto init_T
Initialisation function for temperature field.