Flow123d  master-f44eb46
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Private Member Functions | Static Private Attributes | Friends | List of all members
DarcyMH Class Reference

Mixed-hybrid model of linear Darcy flow, possibly unsteady. More...

#include <darcy_flow_mh.hh>

Inheritance diagram for DarcyMH:
Inheritance graph
[legend]
Collaboration diagram for DarcyMH:
Collaboration graph
[legend]

Classes

class  EqData
 
class  EqFields
 

Public Member Functions

 TYPEDEF_ERR_INFO (EI_Reason, string)
 
 DECLARE_EXCEPTION (ExcSolverDiverge,<< "Diverged nonlinear solver. Reason: "<< EI_Reason::val)
 
 DECLARE_INPUT_EXCEPTION (ExcMissingTimeGovernor,<< "Missing the key 'time', obligatory for the transient problems.")
 
 DarcyMH (Mesh &mesh, const Input::Record in_rec, TimeGovernor *tm=nullptr)
 CREATE AND FILL GLOBAL MH MATRIX OF THE WATER MODEL. More...
 
void init_eq_data ()
 
void initialize () override
 
virtual void initialize_specific ()
 
void zero_time_step () override
 
void update_solution () override
 
void solve_time_step (bool output=true)
 Solve the problem without moving to next time and without output. More...
 
virtual void postprocess ()
 postprocess velocity field (add sources) More...
 
virtual void output_data () override
 Write computed fields. More...
 
virtual double solved_time () override
 
EqFieldseq_fields ()
 
EqDataeq_data ()
 
void set_extra_storativity (const Field< 3, FieldValue< 3 >::Scalar > &extra_stor)
 
void set_extra_source (const Field< 3, FieldValue< 3 >::Scalar > &extra_src)
 
virtual ~DarcyMH () override
 
- Public Member Functions inherited from DarcyFlowInterface
 DECLARE_EXCEPTION (ExcBddcmlNotSupported,<< "Flow123d was not build with BDDCML support.\n")
 
 DECLARE_EXCEPTION (ExcUnknownSolver,<< "Unknown solver type. Internal error.\n")
 
 DarcyFlowInterface (Mesh &mesh, const Input::Record in_rec)
 
virtual ~DarcyFlowInterface ()
 
- Public Member Functions inherited from EquationBase
 EquationBase ()
 
 EquationBase (Mesh &mesh, const Input::Record in_rec)
 
virtual ~EquationBase ()
 
virtual void choose_next_time ()
 
virtual void set_time_upper_constraint (double dt, std::string message)
 
virtual void set_time_lower_constraint (double dt, std::string message)
 
TimeGovernortime ()
 
virtual void set_time_governor (TimeGovernor &time)
 
double planned_time ()
 
Meshmesh ()
 
std::shared_ptr< Balancebalance () const
 
TimeMark::Type mark_type ()
 
FieldSeteq_fieldset ()
 
std::shared_ptr< FieldSeteq_fieldset_ptr ()
 
void init_user_fields (Input::Array user_fields, FieldSet &output_fields)
 

Static Public Member Functions

static const Input::Type::Selectionget_mh_mortar_selection ()
 Selection for enum MortarMethod. More...
 
static const Input::Type::Recordtype_field_descriptor ()
 
static const Input::Type::Recordget_input_type ()
 
- Static Public Member Functions inherited from DarcyFlowInterface
static Input::Type::Abstractget_input_type ()
 
- Static Public Member Functions inherited from EquationBase
static Input::Type::Recordrecord_template ()
 Template Record with common keys for derived equations. More...
 
static Input::Type::Recorduser_fields_template (std::string equation_name)
 Template Record with common key user_fields for derived equations. More...
 

Protected Member Functions

virtual bool zero_time_term (bool time_global=false)
 
void solve_nonlinear ()
 Solve method common to zero_time_step and update solution. More...
 
void modify_system ()
 
virtual void setup_time_term ()
 
void prepare_new_time_step ()
 
void create_linear_system (Input::AbstractRecord rec)
 
virtual void read_initial_condition ()
 
void reconstruct_solution_from_schur (MultidimAssembly &assembler)
 
void allocate_mh_matrix ()
 
void assembly_mh_matrix (MultidimAssembly &assembler)
 
virtual void assembly_source_term ()
 Source term is implemented differently in LMH version. More...
 
virtual void assembly_linear_system ()
 
void set_mesh_data_for_bddc (LinSys_BDDC *bddc_ls)
 
virtual double solution_precision () const
 
void print_matlab_matrix (string matlab_file)
 Print darcy flow matrix in matlab format into a file. More...
 
std::vector< int > get_component_indices_vec (unsigned int component) const
 Get vector of all DOF indices of given component (0..side, 1..element, 2..edge) More...
 

Protected Attributes

std::shared_ptr< Balancebalance_
 
DarcyFlowMHOutputoutput_object
 
int size
 
int n_schur_compls
 
bool use_steady_assembly_
 
bool data_changed_
 
double tolerance_
 
unsigned int min_n_it_
 
unsigned int max_n_it_
 
unsigned int nonlinear_iteration_
 
LinSysschur0
 
Vec steady_diagonal
 
Vec steady_rhs
 
Vec new_diagonal
 
Vec previous_solution
 
std::shared_ptr< EqFieldseq_fields_
 
std::shared_ptr< EqDataeq_data_
 
- Protected Attributes inherited from EquationBase
bool equation_empty_
 flag is true if only default constructor was called More...
 
Meshmesh_
 
TimeGovernortime_
 
Input::Record input_record_
 
std::shared_ptr< FieldSeteq_fieldset_
 
std::shared_ptr< Balancebalance_
 object for calculation and writing the mass balance to file. More...
 

Static Private Member Functions

static std::string equation_name ()
 

Static Private Attributes

static const int registrar
 Registrar of class to factory. More...
 

Friends

class DarcyFlowMHOutput
 

Additional Inherited Members

- Public Types inherited from DarcyFlowInterface
enum  MortarMethod { NoMortar = 0 , MortarP0 = 1 , MortarP1 = 2 }
 Type of experimental Mortar-like method for non-compatible 1d-2d interaction. More...
 
typedef DarcyFlowInterface FactoryBaseType
 Typedef for usage of Input::Factory in child classes. More...
 

Detailed Description

Mixed-hybrid model of linear Darcy flow, possibly unsteady.

Abstract class for various implementations of Darcy flow. In future there should be one further level of abstraction for general time dependent problem.

maybe TODO: split compute_one_step to : 1) prepare_next_timestep 2) actualize_solution - this is for iterative nonlinear solvers

Mixed-hybrid of steady Darcy flow with sources and variable density.

solve equations:

\[ q= -{\mathbf{K}} \nabla h -{\mathbf{K}} R \nabla z \]

\[ \mathrm{div} q = f \]

where

The time key is optional, when not specified the equation is forced to steady regime. Using Steady TimeGovernor which have no dt constraints. Model for transition coefficients due to Martin, Jaffre, Roberts (see manual for full reference)

TODO:

TODO: Remove in future. It is supposed not to be improved anymore, however it is kept functioning aside of the LMH lumped version until the LMH version is stable and optimized.

Definition at line 125 of file darcy_flow_mh.hh.

Constructor & Destructor Documentation

◆ DarcyMH()

DarcyMH::DarcyMH ( Mesh mesh_in,
const Input::Record  in_rec,
TimeGovernor tm = nullptr 
)

CREATE AND FILL GLOBAL MH MATRIX OF THE WATER MODEL.

Parameters {Solver,NSchurs} number of performed Schur complements (0,1,2) for water flow MH-system

Definition at line 353 of file darcy_flow_mh.cc.

◆ ~DarcyMH()

DarcyMH::~DarcyMH ( )
overridevirtual

Definition at line 1455 of file darcy_flow_mh.cc.

Member Function Documentation

◆ allocate_mh_matrix()

void DarcyMH::allocate_mh_matrix ( )
protected

Part of per element assembly that is specific for MH and LMH respectively.

This implemnets MH case:

  • compute conductivity scaling
  • assembly source term
  • no time term, managed by diagonal extraction etc. Allocates linear system matrix for MH. TODO:
  • use general preallocation methods in DofHandler

Definition at line 886 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ assembly_linear_system()

void DarcyMH::assembly_linear_system ( )
protectedvirtual

Assembly or update whole linear system.

Definition at line 1149 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ assembly_mh_matrix()

void DarcyMH::assembly_mh_matrix ( MultidimAssembly assembler)
protected

Assembles linear system matrix for MH. Element by element assembly is done using dim-template assembly class. Assembles only steady part of the equation. TODO:

  • include time term
  • add support for Robin type sources
  • support for nonlinear solvers - assembly either residual vector, matrix, or both (using FADBAD++)

Definition at line 862 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ assembly_source_term()

void DarcyMH::assembly_source_term ( )
protectedvirtual

Source term is implemented differently in LMH version.

Definition at line 999 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ create_linear_system()

void DarcyMH::create_linear_system ( Input::AbstractRecord  rec)
protected

Create and preallocate MH linear system (including matrix, rhs and solution vectors)

Definition at line 1036 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ DECLARE_EXCEPTION()

DarcyMH::DECLARE_EXCEPTION ( ExcSolverDiverge  ,
<< "Diverged nonlinear solver. Reason: "<< EI_Reason::val   
)

◆ DECLARE_INPUT_EXCEPTION()

DarcyMH::DECLARE_INPUT_EXCEPTION ( ExcMissingTimeGovernor  ,
<< "Missing the key 'time ,
obligatory for the transient problems."   
)

◆ eq_data()

EqData& DarcyMH::eq_data ( )
inline

Definition at line 269 of file darcy_flow_mh.hh.

◆ eq_fields()

EqFields& DarcyMH::eq_fields ( )
inline

Definition at line 268 of file darcy_flow_mh.hh.

Here is the caller graph for this function:

◆ equation_name()

static std::string DarcyMH::equation_name ( )
inlinestaticprivate

Definition at line 402 of file darcy_flow_mh.hh.

Here is the caller graph for this function:

◆ get_component_indices_vec()

std::vector< int > DarcyMH::get_component_indices_vec ( unsigned int  component) const
protected

Get vector of all DOF indices of given component (0..side, 1..element, 2..edge)

Definition at line 1630 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ get_input_type()

const it::Record & DarcyMH::get_input_type ( )
static

Definition at line 134 of file darcy_flow_mh.cc.

◆ get_mh_mortar_selection()

const it::Selection & DarcyMH::get_mh_mortar_selection ( )
static

Selection for enum MortarMethod.

Definition at line 81 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ init_eq_data()

void DarcyMH::init_eq_data ( )

Definition at line 428 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ initialize()

void DarcyMH::initialize ( )
overridevirtual

This method should initialize fields of the equation. All members (e.g. number of components) that are necessary for the field initialization must be set between construction and call of initialize. After this method the upper level coupling may set sharing of some fields between equations.

Reimplemented from EquationBase.

Definition at line 480 of file darcy_flow_mh.cc.

◆ initialize_specific()

void DarcyMH::initialize_specific ( )
virtual

Definition at line 586 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ modify_system()

void DarcyMH::modify_system ( )
protected

Definition at line 1591 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ output_data()

void DarcyMH::output_data ( void  )
overridevirtual

Write computed fields.

Reimplemented from EquationBase.

Definition at line 834 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ postprocess()

void DarcyMH::postprocess ( )
virtual

postprocess velocity field (add sources)

Definition at line 800 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ prepare_new_time_step()

void DarcyMH::prepare_new_time_step ( )
protected

Definition at line 795 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ print_matlab_matrix()

void DarcyMH::print_matlab_matrix ( string  matlab_file)
protected

Print darcy flow matrix in matlab format into a file.

Definition at line 1205 of file darcy_flow_mh.cc.

◆ read_initial_condition()

void DarcyMH::read_initial_condition ( )
protectedvirtual

Read initial condition into solution vector. Must be called after create_linear_system.

For the LMH scheme we have to be able to save edge pressures in order to restart simulation or use results of one simulation as initial condition for other one.

Definition at line 1510 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ reconstruct_solution_from_schur()

void DarcyMH::reconstruct_solution_from_schur ( MultidimAssembly assembler)
protected

Definition at line 1534 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ set_extra_source()

void DarcyMH::set_extra_source ( const Field< 3, FieldValue< 3 >::Scalar > &  extra_src)
inline

Definition at line 274 of file darcy_flow_mh.hh.

◆ set_extra_storativity()

void DarcyMH::set_extra_storativity ( const Field< 3, FieldValue< 3 >::Scalar > &  extra_stor)
inline

Definition at line 271 of file darcy_flow_mh.hh.

◆ set_mesh_data_for_bddc()

void DarcyMH::set_mesh_data_for_bddc ( LinSys_BDDC bddc_ls)
protected

type for storage of global to local map

We need:

  • local to global element map (possibly mesh->el_4_loc
  • inet, nnet - local dof numbers per element, local numbering of only those dofs that are on owned elements
    1. collect DH local dof indices on elements, manage map from DH local indices to BDDC local dof indices
    2. map collected DH indices to BDDC indices using the map
  • local BDDC dofs to global dofs, use DH to BDDC map with DH local to global map
  • XYZ - permuted, collect in main loop into array of size of all DH local dofs, compress and rearrange latter
  • element_permeability - in main loop

Definition at line 1278 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ setup_time_term()

void DarcyMH::setup_time_term ( )
protectedvirtual

Definition at line 1548 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ solution_precision()

double DarcyMH::solution_precision ( ) const
protectedvirtual

Return a norm of residual vector. TODO: Introduce Equation::compute_residual() updating residual field, standard part of EqData.

Definition at line 850 of file darcy_flow_mh.cc.

◆ solve_nonlinear()

void DarcyMH::solve_nonlinear ( )
protected

Solve method common to zero_time_step and update solution.

Definition at line 711 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ solve_time_step()

void DarcyMH::solve_time_step ( bool  output = true)

Solve the problem without moving to next time and without output.

Definition at line 650 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ solved_time()

double DarcyMH::solved_time ( )
overridevirtual

Time until which the actual solution is valid. By default, it returns the actual time of the time governor. However, it can be overriden by a specific equation. E.g. it differs in Darcy flow in the steady case.

Reimplemented from EquationBase.

Definition at line 405 of file darcy_flow_mh.cc.

◆ type_field_descriptor()

const it::Record & DarcyMH::type_field_descriptor ( )
static

Definition at line 119 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

◆ TYPEDEF_ERR_INFO()

DarcyMH::TYPEDEF_ERR_INFO ( EI_Reason  ,
string   
)

◆ update_solution()

void DarcyMH::update_solution ( void  )
overridevirtual

Calculation of the next time step and its output.

Reimplemented from EquationBase.

Definition at line 635 of file darcy_flow_mh.cc.

◆ zero_time_step()

void DarcyMH::zero_time_step ( )
overridevirtual

Initialization of the solution in the zero time.

There may be fields that can not be initialized in the initialize method as they are provided by the coupling. Fields coming from coupling has to be set after the initialize method and before zero_time_step.

Reimplemented from EquationBase.

Definition at line 589 of file darcy_flow_mh.cc.

◆ zero_time_term()

bool DarcyMH::zero_time_term ( bool  time_global = false)
protectedvirtual

Returns true is the fields involved in the time term have values that makes the time term zero. For time_global==true, it returns true if there are no field descriptors in the input list, so the fields )of the time ter) have their default values for whole simulation. If time_global==false (default), only the actual values are considered.

Definition at line 702 of file darcy_flow_mh.cc.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ DarcyFlowMHOutput

friend class DarcyFlowMHOutput
friend

Definition at line 394 of file darcy_flow_mh.hh.

Member Data Documentation

◆ balance_

std::shared_ptr<Balance> DarcyMH::balance_
protected

Definition at line 365 of file darcy_flow_mh.hh.

◆ data_changed_

bool DarcyMH::data_changed_
protected

Definition at line 375 of file darcy_flow_mh.hh.

◆ eq_data_

std::shared_ptr<EqData> DarcyMH::eq_data_
protected

Definition at line 392 of file darcy_flow_mh.hh.

◆ eq_fields_

std::shared_ptr<EqFields> DarcyMH::eq_fields_
protected

Definition at line 391 of file darcy_flow_mh.hh.

◆ max_n_it_

unsigned int DarcyMH::max_n_it_
protected

Definition at line 380 of file darcy_flow_mh.hh.

◆ min_n_it_

unsigned int DarcyMH::min_n_it_
protected

Definition at line 379 of file darcy_flow_mh.hh.

◆ n_schur_compls

int DarcyMH::n_schur_compls
protected

Definition at line 370 of file darcy_flow_mh.hh.

◆ new_diagonal

Vec DarcyMH::new_diagonal
protected

Definition at line 388 of file darcy_flow_mh.hh.

◆ nonlinear_iteration_

unsigned int DarcyMH::nonlinear_iteration_
protected

Definition at line 381 of file darcy_flow_mh.hh.

◆ output_object

DarcyFlowMHOutput* DarcyMH::output_object
protected

Definition at line 367 of file darcy_flow_mh.hh.

◆ previous_solution

Vec DarcyMH::previous_solution
protected

Definition at line 389 of file darcy_flow_mh.hh.

◆ registrar

const int DarcyMH::registrar
staticprivate
Initial value:
=
Input::register_class< DarcyMH, Mesh &, const Input::Record >(equation_name()) +
static std::string equation_name()
static const Input::Type::Record & get_input_type()
unsigned int size() const
Returns number of keys in the Record.
Definition: type_record.hh:602

Registrar of class to factory.

Definition at line 400 of file darcy_flow_mh.hh.

◆ schur0

LinSys* DarcyMH::schur0
protected

Definition at line 384 of file darcy_flow_mh.hh.

◆ size

int DarcyMH::size
protected

Definition at line 369 of file darcy_flow_mh.hh.

◆ steady_diagonal

Vec DarcyMH::steady_diagonal
protected

Definition at line 386 of file darcy_flow_mh.hh.

◆ steady_rhs

Vec DarcyMH::steady_rhs
protected

Definition at line 387 of file darcy_flow_mh.hh.

◆ tolerance_

double DarcyMH::tolerance_
protected

Definition at line 378 of file darcy_flow_mh.hh.

◆ use_steady_assembly_

bool DarcyMH::use_steady_assembly_
protected

Definition at line 374 of file darcy_flow_mh.hh.


The documentation for this class was generated from the following files: