Flow123d
master-ad1076ca0
|
Go to the documentation of this file.
35 inline double operator() (
double alpha,
double density,
double gravity,
double pressure)
37 return -alpha*density*gravity*pressure;
63 inline double operator() (
double alpha,
double beta,
double pressure,
double old_pressure,
double div_u,
double old_div_u)
65 return (beta*(pressure-old_pressure) + alpha*(old_div_u - div_u)) /
time_->
dt();
76 "Record with data for iterative coupling of flow and mechanics.\n")
82 "Flow equation, provides the velocity field as a result.")
84 "Mechanics, provides the displacement field.")
87 .make_field_descriptor_type(
"Coupling_Iterative")),
89 "Input fields of the HM coupling.")
91 "Tuning parameter for iterative splitting. Its default value "
92 "corresponds to a theoretically optimal value with fastest convergence." )
94 "Maximal count of HM iterations." )
96 "Minimal count of HM iterations." )
98 "Absolute tolerance for difference in HM iteration." )
100 "Relative tolerance for difference in HM iteration." )
105 const int HM_Iterative::registrar = Input::register_class< HM_Iterative, Mesh &, const Input::Record >(
"Coupling_Iterative")
118 .
description(
"Volumetric mass density of the fluid.")
124 .
description(
"Gravitational acceleration constant.")
129 *
this +=
beta.
name(
"relaxation_beta")
130 .
description(
"Parameter of numerical method for iterative solution of hydro-mechanical coupling.")
135 .
description(
"Coupling term entering the mechanics equation.")
145 .
description(
"Pressure from last computed iteration.")
150 .
description(
"Displacement divergence from last computed time.")
155 .
description(
"Pressure potential on boundary (taking into account the flow boundary condition.")
160 .
description(
"Coupling term entering the flow equation.")
176 eq_data.
flow_->eq_fields().field_edge_pressure
180 ref_pressure_potential.set(ref_potential_ptr_, 0.0);
189 auto old_pressure_ptr_ = create_field_fe<3, FieldValue<3>::Scalar>(eq_data.
flow_->eq_data().dh_cr_, &eq_data.
flow_->eq_data().p_edge_solution_previous_time);
190 old_pressure.set(old_pressure_ptr_, 0.0);
193 old_iter_pressure.set(old_iter_pressure_ptr_, 0.0);
195 old_div_u_ptr_ = create_field_fe<3, FieldValue<3>::Scalar>(eq_data.
mechanics_->eq_fields().output_div_ptr->get_dofhandler());
196 old_div_u.set(old_div_u_ptr_, 0.0);
202 eq_data.
flow_->eq_fields().field_edge_pressure,
204 eq_data.
mechanics_->eq_fields().output_divergence,
218 using namespace Input;
240 std::stringstream ss;
263 template<
int dim,
class Value>
267 auto vec = to_field.
vec();
271 for (
auto cell : dh->own_range() )
272 vec.set( cell.local_idx(), from_field.
value(cell.elm().centre(), cell.elm()) );
280 std::stringstream ss;
340 ref_potential_vec_.zero_entries();
343 ref_potential_vec_.local_to_ghost_begin();
344 ref_potential_vec_.local_to_ghost_end();
371 abs_error = sqrt(recv_data[0]);
372 rel_error = abs_error / (sqrt(recv_data[1]) + std::numeric_limits<double>::min());
374 MessageOut().fmt(
"HM Iteration {} abs. difference: {} rel. difference: {}\n"
375 "--------------------------------------------------------",
379 THROW(ExcSolverDiverge() << EI_Reason(
"Reached max_it."));
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
Field< 3, FieldValue< 3 >::Scalar > alpha
Biot coefficient.
static const Input::Type::Record & get_input_type()
Define input record.
static constexpr Mask in_rhs
A field is part of the right hand side of the equation.
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > old_div_u_ptr_
Field< 3, FieldValue< 3 >::Scalar > beta
double operator()(double alpha, double density, double gravity, double pressure)
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > ref_potential_ptr_
FieldFE for pressure_potential field.
Field< 3, FieldValue< 3 >::Scalar > pressure_potential
Potential -alpha*pressure whose gradient is passed to mechanics as additional load.
bool set_time(const TimeStep &time, LimitSide limit_side)
const double beta_factor
User-defined factor for iteration parameter.
Field< 3, FieldValue< 3 >::Scalar > density
Density of fluid.
Field< 3, FieldValue< 3 >::Scalar > flow_source
Field< 3, FieldValue< 3 >::Scalar > old_iter_pressure
void set_input_list(Input::Array input_list, const TimeGovernor &tg)
static const int registrar
#define FLOW123D_FORCE_LINK_IN_CHILD(x)
void zero_time_step() override
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
FieldCommon & flags(FieldFlag::Flags::Mask mask)
Field< 3, FieldValue< 3 >::Scalar > ref_pressure_potential
Potential of reference (prescribed) pressure from flow b.c. TODO: Swith to BCField when possible.
double operator()(double alpha, double beta, double pressure, double old_pressure, double div_u, double old_div_u)
static const Input::Type::Record & get_input_type()
Lumped mixed-hybrid model of linear Darcy flow, possibly unsteady.
void set_time_result_changed()
Manually mark flag that the field has been changed.
void copy_field(const FieldCommon &from_field_common, FieldFE< dim, Value > &to_field)
std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > old_iter_pressure_ptr_
void assemble(std::shared_ptr< DOFHandlerMultiDim > dh) override
General assemble methods.
static constexpr Mask equation_external_output
Match an output field, that can be also copy of other field.
Field< 3, FieldValue< 3 >::Scalar > gravity
Standard gravity.
void update_after_converged() override
Save data after iterations have finished.
FieldCommon & flags_add(FieldFlag::Flags::Mask mask)
void initialize(Mesh &mesh, HM_Iterative::EqData &eq_data, const TimeGovernor *time_, double beta_)
std::shared_ptr< DOFHandlerMultiDim > get_dofhandler() const
double a_tol_
Absolute tolerance for difference between two succeeding iterations.
const TimeGovernor * time_
double operator()(double alpha, double lame_mu, double lame_lambda)
HM_Iterative(Mesh &mesh, Input::Record in_record)
GenericAssembly< FlowPotentialAssemblyHM > * flow_potential_assembly_
static constexpr Mask equation_result
Match result fields. These are never given by input or copy of input.
static const Input::Type::Record & record_template()
Basic time management functionality for unsteady (and steady) solvers (class Equation).
const TimeStep & step(int index=-1) const
fn_fluid_source(const TimeGovernor *time)
void compute_iteration_error(double &abs_error, double &rel_error) override
Compute absolute and relative error in the solution.
Common abstract parent of all Field<...> classes.
static bool print_message_table(ostream &stream, std::string equation_name)
Class for representation SI units of Fields.
Input::Record input_record_
Field< 3, FieldValue< 3 >::Scalar > old_pressure
void update_flow_fields()
static Input::Type::Abstract & get_input_type()
void update_solution() override
void view(const char *name="") const
GenericAssembly< ResidualAssemblyHM > * residual_assembly_
double p_norm2
Squared pressure norm in the last iteration.
virtual const Value::return_type & value(const Point &p, const ElementAccessor< spacedim > &elm) const
void initialize() override
FieldCommon & input_default(const string &input_default)
std::shared_ptr< DarcyLMH > flow_
steady or unsteady water flow simulator based on MH scheme
double r_tol_
Relative tolerance for difference between two succeeding iterations.
double p_dif2
Squared norm of pressure difference in two subsequent iterations.
#define MPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm)
#define WarningOut()
Macro defining 'warning' record of log.
double lame_mu(double young, double poisson)
static Input::Type::Record & record_template()
Template Record with common keys for derived equations.
std::shared_ptr< Elasticity > mechanics_
solute transport with chemistry through operator splitting
void update_after_iteration() override
Save data (e.g. solution fields) for the next iteration.
static const Input::Type::Record & get_input_type()
Declare input record type for the equation TransportDG.
void solve_iteration() override
Solve equations and update data (fields).
double lame_lambda(double young, double poisson)
FieldCommon & description(const string &description)
Class template representing a field with values dependent on: point, element, and region.
fn_hm_coupling_beta(double beta_f)
Field< 3, FieldValue< 3 >::Scalar > old_div_u
void next_time()
Proceed to the next time according to current estimated time step.
unsigned int max_it_
Maximal number of iterations.
void copy_from(const FieldCommon &other) override
#define START_TIMER(tag)
Starts a timer with specified tag.
FieldCommon & name(const string &name)
#define MessageOut()
Macro defining 'message' record of log.