1#ifndef __UFOPERATORS_HPP__
2#define __UFOPERATORS_HPP__
16using EntData = DataForcesAndSourcesCore::EntData;
53 double m = 1 - 1.0 /
nn;
77 return pow(S_e,
ll) * pow(( (1 - F_e) / (1 - F_1) ), 2);
80 double m = 1 - 1.0 /
nn;
82 return pow(1 - pow(S_eStar, 1.0 /
m),
m);
96 double m = 1 - 1.0 /
nn;
100 pow(1 + pow(-
alpha * head,
nn),
m+1);
108 double m = 1.0 - 1.0 /
nn;
111 double denom = 1 + pow(-
alpha * head,
nn);
113 ( (
m + 1) *
nn * pow(-
alpha * head,
nn) / denom + (
nn-1) );
125 ret_val =
K_s * DK_r;
138 return pow(S_e,
ll-1) * DS_e * ( (1 - F_e) / (1 - F_1) ) *
139 (
ll * ( (1 - F_e) / (1 - F_1) ) - 2.0 * S_e * DF_e / (1 - F_1));
142 double m = 1 - 1.0 /
nn;
145 return -DS_estar * pow(1-pow(S_estar, 1.0/
m),
m-1) * pow(S_estar, 1.0/
m - 1);
175 boost::shared_ptr<PreviousData> &data,
176 std::map<int, BlockData> &block_map)
182 const int nb_dofs = data.getIndices().size();
184 auto find_block_data = [&]() {
188 if (
m.second.block_ents.find(fe_ent) !=
m.second.block_ents.end()) {
189 block_raw_ptr = &
m.second;
193 return block_raw_ptr;
196 auto block_data_ptr = find_block_data();
200 auto &block_data = *block_data_ptr;
202 vecF.resize(nb_dofs,
false);
204 const int nb_integration_pts =
getGaussPts().size2();
208 auto t_grad = getFTensor1FromMat<DIM>(
commonData->grads);
210 auto t_base = data.getFTensor0N();
211 auto t_diff_base = data.getFTensor1DiffN<DIM>();
219 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
220 const double a = vol * t_w;
222 const double K_h = block_data.get_conductivity(t_val);
223 const double C_h = block_data.get_capacity(t_val);
228 for (
int rr = 0; rr != nb_dofs; ++rr) {
229 vecF[rr] +=
a * (t_base * C_h * t_dot_val + K_h *
230 (t_diff_base(
i) * t_grad(
i) - 0.*t_diff_base(2)));
258 boost::shared_ptr<PreviousData> &data,
259 std::map<int, BlockData> &block_map)
268 const int nb_row_dofs = row_data.getIndices().size();
269 const int nb_col_dofs = col_data.getIndices().size();
272 if (nb_row_dofs && nb_col_dofs) {
273 auto find_block_data = [&]() {
277 if (
m.second.block_ents.find(fe_ent) !=
m.second.block_ents.end()) {
278 block_raw_ptr = &
m.second;
282 return block_raw_ptr;
285 auto block_data_ptr = find_block_data();
289 auto &block_data = *block_data_ptr;
291 mat.resize(nb_row_dofs, nb_col_dofs,
false);
293 const int nb_integration_pts =
getGaussPts().size2();
294 auto t_row_base = row_data.getFTensor0N();
299 auto t_grad = getFTensor1FromMat<DIM>(
commonData->grads);
301 auto t_row_diff_base = row_data.getFTensor1DiffN<DIM>();
310 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
311 const double a = vol * t_w;
312 const double K_h = block_data.get_conductivity(t_val);
313 const double C_h = block_data.get_capacity(t_val);
314 const double DK_h = block_data.get_diffConductivity(t_val);
315 const double DC_h = block_data.get_diffCapacity(t_val);
319 for (
int rr = 0; rr != nb_row_dofs; ++rr) {
320 auto t_col_base = col_data.getFTensor0N(gg, 0);
321 auto t_col_diff_base = col_data.getFTensor1DiffN<DIM>(gg, 0);
322 for (
int cc = 0; cc != nb_col_dofs; ++cc) {
325 a * (t_row_base * (DC_h * t_dot_val + C_h * ts_a) * t_col_base +
326 DK_h * t_grad(
i) * t_row_diff_base(
i) * t_col_base + K_h * t_row_diff_base(
i) * t_col_diff_base(
i));
342 if (row_side != col_side || row_type != col_type) {
343 transMat.resize(nb_col_dofs, nb_row_dofs,
false);
367 const int nb_dofs = data.getIndices().size();
375 vecF.resize(nb_dofs,
false);
377 const int nb_integration_pts =
getGaussPts().size2();
378 auto t_row_base = data.getFTensor0N();
384 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
385 const double a = vol * t_w;
388 for (
int rr = 0; rr != nb_dofs; ++rr) {
389 vecF[rr] += t_row_base *
h *
a;
414 boost::shared_ptr<PostProcVolumeOnRefinedMesh> &post_proc,
double &err)
427 "out_level_" + boost::lexical_cast<std::string>(
ts_step) +
".h5m");
435 boost::shared_ptr<PostProcVolumeOnRefinedMesh>
postProc;
#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 CHKERR
Inline error check.
FTensor::Index< 'm', SPACE_DIM > m
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
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.
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
DataForcesAndSourcesCore::EntData EntData
const double essential_bc_values
const double natural_bc_values
const int save_every_nth_step
FTensor::Index< 'i', 3 > i
bool sYmm
If true assume that matrix is symmetric structure.
structure for User Loop Methods on finite elements
default operator for TRI element
EntityHandle getFEEntityHandle() const
Return finite element entity handle.
auto getFTensor0IntegrationWeight()
Get integration weights.
double getMeasure() const
get measure of element
@ OPROW
operator doWork function is executed on FE rows
@ OPROWCOL
operator doWork is executed on FE rows &columns
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
intrusive_ptr for managing petsc objects
PetscReal ts_a
shift for U_t (see PETSc Time Solver)
PetscInt ts_step
time step number
Volume finite element base.
double get_diffCapacity(double head)
double get_conductivity(double head)
double get_diffEffSatuStar(double s_e)
double get_waterContent(double head)
double get_relativeConductivity(double head)
double get_Fe(double eff_satu)
double get_diffFe(double s_e)
double get_diffRelativeConductivity(double head)
double get_eff_satuStar(double eff_satu)
double get_capacity(double head)
double get_diffEffSaturation(double head)
double get_effSaturation(double head)
double get_diffConductivity(double head)
MoFEMErrorCode operator()()
function is run for every finite element
Monitor(MPI_Comm &comm, const int &rank, SmartPetscObj< DM > &dm, boost::shared_ptr< PostProcVolumeOnRefinedMesh > &post_proc, double &err)
boost::shared_ptr< PostProcVolumeOnRefinedMesh > postProc
MoFEMErrorCode postProcess()
function is run at the end of loop
MoFEMErrorCode preProcess()
function is run at the beginning of loop
OpAssembleNaturalBCRhs(std::string mass_field, Range &natural_bd_ents)
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
std::map< int, BlockData > setOfBlock
OpAssembleStiffLhs(std::string fieldu, boost::shared_ptr< PreviousData > &data, std::map< int, BlockData > &block_map)
MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, EntData &row_data, EntData &col_data)
boost::shared_ptr< PreviousData > commonData
boost::shared_ptr< PreviousData > commonData
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
OpAssembleStiffRhs(std::string field, boost::shared_ptr< PreviousData > &data, std::map< int, BlockData > &block_map)
std::map< int, BlockData > setOfBlock
MatrixDouble invJac
Inverse of element jacobian.
VectorDouble dot_values
Rate of values of field "u" at integration points.
VectorDouble values
Values of field "u" at integration points.
MatrixDouble grads
Gradients of field "u" at integration points.