Flow123d  release_2.2.0-36-g163dc99
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
ConvectionTransport Class Reference

#include <transport.h>

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

Classes

class  EqData
 

Public Types

typedef ConcentrationTransportBase FactoryBaseType
 

Public Member Functions

 ConvectionTransport (Mesh &init_mesh, const Input::Record in_rec)
 
virtual ~ConvectionTransport ()
 
void initialize () override
 
void zero_time_step () override
 
bool evaluate_time_constraint (double &time_constraint) override
 
void update_solution () override
 
void calculate_concentration_matrix () override
 Calculate the array of concentrations per element (for reactions). More...
 
void update_after_reactions (bool solution_changed) override
 Perform changes to transport solution after reaction step. More...
 
void set_target_time (double target_time) override
 
void set_balance_object (std::shared_ptr< Balance > balance) override
 
const vector< unsigned int > & get_subst_idx () override
 Return substance indices used in balance. More...
 
virtual void output_data () override
 Write computed fields. More...
 
void set_velocity_field (const MH_DofHandler &dh) override
 Pass velocity from flow to transport. More...
 
void set_output_stream (std::shared_ptr< OutputTime > stream) override
 Setter for output stream. More...
 
std::shared_ptr< OutputTimeoutput_stream () override
 
double ** get_concentration_matrix () override
 Getter for array of concentrations per element. More...
 
const Vec & get_solution (unsigned int sbi) override
 Return PETSc vector with solution for sbi-th substance. More...
 
void get_par_info (int *&el_4_loc, Distribution *&el_ds) override
 Return array of indices of local elements and parallel distribution of elements. More...
 
int * get_row_4_el () override
 Return global array of order of elements within parallel vector. More...
 
unsigned int n_substances () override
 Returns number of transported substances. More...
 
SubstanceListsubstances () override
 Returns reference to the vector of substance names. More...
 
- Public Member Functions inherited from ConcentrationTransportBase
 ConcentrationTransportBase (Mesh &init_mesh, const Input::Record in_rec)
 
- 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 ()
 
double solved_time ()
 
Meshmesh ()
 
TimeMark::Type mark_type ()
 
FieldSetdata ()
 
virtual void get_solution_vector (double *&vector, unsigned int &size)
 
virtual void get_parallel_solution_vector (Vec &vector)
 

Static Public Member Functions

static const Input::Type::Recordget_input_type ()
 
static const IT::Selectionget_output_selection ()
 
- Static Public Member Functions inherited from ConcentrationTransportBase
static Input::Type::Abstractget_input_type ()
 Common specification of the input record for secondary equations. More...
 

Private Member Functions

void create_transport_matrix_mpi ()
 
void create_mass_matrix ()
 
void make_transport_partitioning ()
 
void set_initial_condition ()
 
void read_concentration_sources ()
 
void set_boundary_conditions ()
 
void compute_concentration_sources ()
 Assembles concentration sources for each substance. note: the source of concentration is multiplied by time interval (gives the mass, not the flow like before) More...
 
void transport_matrix_step_mpi (double time_step)
 
void alloc_transport_vectors ()
 
void alloc_transport_structs_mpi ()
 
void output_vector_gather ()
 

Private Attributes

EqData data_
 
double ** sources_corr
 
Vec * v_sources_corr
 
TimeMark::Type target_mark_type
 TimeMark type for time marks denoting end of every time interval where transport matrix remains constant. More...
 
double cfl_max_step
 Time step constraint coming from CFL condition. More...
 
Vec vcfl_flow_
 Parallel vector for flow contribution to CFL condition. More...
 
Vec vcfl_source_
 Parallel vector for source term contribution to CFL condition. More...
 
double * cfl_flow_
 
double * cfl_source_
 
VecScatter vconc_out_scatter
 
Mat tm
 
Vec mass_diag
 
Vec vpmass_diag
 
Vec * v_tm_diag
 
double ** tm_diag
 
double transport_matrix_time
 
double transport_bc_time
 Time of the last update of the boundary condition terms. More...
 
Vec * vconc
 Concentration vectors for mobile phase. More...
 
double ** conc
 Concentrations for phase, substance, element. More...
 
Vec * vpconc
 
Vec * bcvcorr
 
Vec * vcumulative_corr
 
double ** cumulative_corr
 
std::vector< VectorSeqDoubleout_conc
 
const Input::Record input_rec
 Record with input specification. More...
 
std::shared_ptr< OutputTimeoutput_stream_
 
int * row_4_el
 
int * el_4_loc
 
Distributionel_ds
 
SubstanceList substances_
 Transported substances. More...
 
const MH_DofHandlermh_dh
 
vector< unsigned int > subst_idx
 List of indices used to call balance methods for a set of quantities. More...
 
bool is_convection_matrix_scaled
 
bool is_src_term_scaled
 
bool is_bc_term_scaled
 
bool is_mass_diag_changed
 Flag indicates that porosity or cross_section changed during last time. More...
 

Static Private Attributes

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

Friends

class TransportOperatorSplitting
 

Additional Inherited Members

- Protected Attributes inherited from EquationBase
bool equation_empty_
 flag is true if only default constructor was called More...
 
Meshmesh_
 
TimeGovernortime_
 
Input::Record input_record_
 
FieldSeteq_data_
 
std::shared_ptr< Balancebalance_
 object for calculation and writing the mass balance to file. More...
 

Detailed Description

TODO:

Definition at line 67 of file transport.h.

Member Typedef Documentation

Definition at line 98 of file transport.h.

Constructor & Destructor Documentation

ConvectionTransport::ConvectionTransport ( Mesh init_mesh,
const Input::Record  in_rec 
)

Constructor.

Definition at line 96 of file transport.cc.

ConvectionTransport::~ConvectionTransport ( )
virtual

TODO: destructor

Definition at line 182 of file transport.cc.

Member Function Documentation

void ConvectionTransport::alloc_transport_structs_mpi ( )
private

Definition at line 282 of file transport.cc.

Here is the caller graph for this function:

void ConvectionTransport::alloc_transport_vectors ( )
private

Definition at line 250 of file transport.cc.

Here is the caller graph for this function:

void ConvectionTransport::calculate_concentration_matrix ( )
inlineoverridevirtual

Calculate the array of concentrations per element (for reactions).

Implements ConcentrationTransportBase.

Definition at line 131 of file transport.h.

void ConvectionTransport::compute_concentration_sources ( )
private

Assembles concentration sources for each substance. note: the source of concentration is multiplied by time interval (gives the mass, not the flow like before)

Definition at line 404 of file transport.cc.

Here is the caller graph for this function:

void ConvectionTransport::create_mass_matrix ( )
private

Definition at line 680 of file transport.cc.

Here is the caller graph for this function:

void ConvectionTransport::create_transport_matrix_mpi ( )
private

Assembly convection term part of the matrix and boundary matrix for application of boundary conditions.

Discretization of the convection term use explicit time scheme and finite volumes with full upwinding. We count on with exchange between dimensions and mixing on edges where more then two elements connect (can happen for 2D and 1D elements in 3D embedding space)

In order to get multiplication matrix for explicit transport one have to scale the convection part by the acctual time step and add time term, i. e. unit matrix (see. transport_matrix_step_mpi)

Updates CFL time step constrain.

Definition at line 713 of file transport.cc.

Here is the caller graph for this function:

bool ConvectionTransport::evaluate_time_constraint ( double &  time_constraint)
overridevirtual

Evaluates CFL condition. Assembles the transport matrix and vector (including sources, bc terms).

Parameters
time_constraintis the value CFL constraint (return parameter)
Returns
true if CFL is changed since previous step, false otherwise

Implements ConcentrationTransportBase.

Definition at line 490 of file transport.cc.

double ** ConvectionTransport::get_concentration_matrix ( )
overridevirtual

Getter for array of concentrations per element.

Implements ConcentrationTransportBase.

Definition at line 824 of file transport.cc.

Here is the caller graph for this function:

const IT::Record & ConvectionTransport::get_input_type ( )
static

Definition at line 60 of file transport.cc.

static const IT::Selection& ConvectionTransport::get_output_selection ( )
static
void ConvectionTransport::get_par_info ( int *&  el_4_loc,
Distribution *&  el_ds 
)
overridevirtual

Return array of indices of local elements and parallel distribution of elements.

Implements ConcentrationTransportBase.

Definition at line 828 of file transport.cc.

Here is the caller graph for this function:

int * ConvectionTransport::get_row_4_el ( )
overridevirtual

Return global array of order of elements within parallel vector.

Implements ConcentrationTransportBase.

Definition at line 838 of file transport.cc.

Here is the caller graph for this function:

const Vec& ConvectionTransport::get_solution ( unsigned int  sbi)
inlineoverridevirtual

Return PETSc vector with solution for sbi-th substance.

Implements ConcentrationTransportBase.

Definition at line 181 of file transport.h.

const vector<unsigned int>& ConvectionTransport::get_subst_idx ( )
inlineoverridevirtual

Return substance indices used in balance.

Implements ConcentrationTransportBase.

Definition at line 158 of file transport.h.

void ConvectionTransport::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 113 of file transport.cc.

void ConvectionTransport::make_transport_partitioning ( )
private

Definition at line 155 of file transport.cc.

Here is the caller graph for this function:

unsigned int ConvectionTransport::n_substances ( )
inlineoverridevirtual

Returns number of transported substances.

Implements ConcentrationTransportBase.

Definition at line 189 of file transport.h.

Here is the caller graph for this function:

void ConvectionTransport::output_data ( void  )
overridevirtual

Write computed fields.

Reimplemented from EquationBase.

Definition at line 844 of file transport.cc.

Here is the caller graph for this function:

std::shared_ptr<OutputTime> ConvectionTransport::output_stream ( )
inlineoverridevirtual

Getters.

Implements ConcentrationTransportBase.

Definition at line 176 of file transport.h.

void ConvectionTransport::output_vector_gather ( void  )
private

Communicate parallel concentration vectors into sequential output vector.

Definition at line 808 of file transport.cc.

Here is the caller graph for this function:

void ConvectionTransport::read_concentration_sources ( )
private

Here is the caller graph for this function:

void ConvectionTransport::set_balance_object ( std::shared_ptr< Balance balance)
overridevirtual

Use Balance object from upstream equation (e.g. in various couplings) instead of own instance.

Implements ConcentrationTransportBase.

Definition at line 860 of file transport.cc.

Here is the caller graph for this function:

void ConvectionTransport::set_boundary_conditions ( )
private

Definition at line 337 of file transport.cc.

Here is the caller graph for this function:

void ConvectionTransport::set_initial_condition ( )
private

Definition at line 232 of file transport.cc.

Here is the caller graph for this function:

void ConvectionTransport::set_output_stream ( std::shared_ptr< OutputTime stream)
inlineoverridevirtual

Setter for output stream.

Implements ConcentrationTransportBase.

Definition at line 169 of file transport.h.

void ConvectionTransport::set_target_time ( double  target_time)
overridevirtual

Set time interval which is considered as one time step by TransportOperatorSplitting. In particular the velocity field doesn't change over this interval.

Dependencies:

velocity, porosity -> matrix, source_vector matrix -> time_step

data_read_times -> time_step (not necessary if we won't stick to jump times) data -> source_vector time_step -> scaling

Implements ConcentrationTransportBase.

Definition at line 657 of file transport.cc.

Here is the caller graph for this function:

void ConvectionTransport::set_velocity_field ( const MH_DofHandler dh)
inlineoverridevirtual

Pass velocity from flow to transport.

Implements ConcentrationTransportBase.

Definition at line 166 of file transport.h.

SubstanceList& ConvectionTransport::substances ( )
inlineoverridevirtual

Returns reference to the vector of substance names.

Implements ConcentrationTransportBase.

Definition at line 193 of file transport.h.

void ConvectionTransport::transport_matrix_step_mpi ( double  time_step)
private

Finish explicit transport matrix (time step scaling)

Here is the caller graph for this function:

void ConvectionTransport::update_after_reactions ( bool  solution_changed)
inlineoverridevirtual

Perform changes to transport solution after reaction step.

Implements ConcentrationTransportBase.

Definition at line 133 of file transport.h.

void ConvectionTransport::update_solution ( void  )
overridevirtual

Calculates one time step of explicit transport.

Reimplemented from EquationBase.

Definition at line 555 of file transport.cc.

void ConvectionTransport::zero_time_step ( )
overridevirtual

Initialize solution at zero time.

Reimplemented from EquationBase.

Definition at line 465 of file transport.cc.

Friends And Related Function Documentation

friend class TransportOperatorSplitting
friend

Definition at line 319 of file transport.h.

Member Data Documentation

Vec* ConvectionTransport::bcvcorr
private

Definition at line 290 of file transport.h.

double* ConvectionTransport::cfl_flow_
private

Definition at line 267 of file transport.h.

double ConvectionTransport::cfl_max_step
private

Time step constraint coming from CFL condition.

Definition at line 263 of file transport.h.

double * ConvectionTransport::cfl_source_
private

Definition at line 267 of file transport.h.

double** ConvectionTransport::conc
private

Concentrations for phase, substance, element.

Definition at line 286 of file transport.h.

double** ConvectionTransport::cumulative_corr
private

Definition at line 292 of file transport.h.

EqData ConvectionTransport::data_
private

Parameters of the equation, some are shared with other implementations since EqData is derived from TransportBase::TransportEqData

Definition at line 244 of file transport.h.

int* ConvectionTransport::el_4_loc
private

Definition at line 303 of file transport.h.

Distribution* ConvectionTransport::el_ds
private

Definition at line 304 of file transport.h.

const Input::Record ConvectionTransport::input_rec
private

Record with input specification.

Definition at line 297 of file transport.h.

bool ConvectionTransport::is_bc_term_scaled
private

Definition at line 252 of file transport.h.

bool ConvectionTransport::is_convection_matrix_scaled
private

Flag indicates the state of object (transport matrix or source or boundary term). If false, the object is freshly assembled and not rescaled. If true, the object is scaled (not necessarily with the current time step).

Definition at line 252 of file transport.h.

bool ConvectionTransport::is_mass_diag_changed
private

Flag indicates that porosity or cross_section changed during last time.

Definition at line 255 of file transport.h.

bool ConvectionTransport::is_src_term_scaled
private

Definition at line 252 of file transport.h.

Vec ConvectionTransport::mass_diag
private

Definition at line 272 of file transport.h.

const MH_DofHandler* ConvectionTransport::mh_dh
private

Temporary solution how to pass velocity field form the flow model. TODO: introduce FieldDiscrete -containing true DOFHandler and data vector and pass such object together with other data. Possibly make more general set_data method, allowing setting data given by name. needs support from EqDataBase.

Definition at line 314 of file transport.h.

std::vector<VectorSeqDouble> ConvectionTransport::out_conc
private

Definition at line 294 of file transport.h.

std::shared_ptr<OutputTime> ConvectionTransport::output_stream_
private

Definition at line 299 of file transport.h.

const int ConvectionTransport::registrar
staticprivate
Initial value:
=
Input::register_class< ConvectionTransport, Mesh &, const Input::Record >(_equation_name) +

Registrar of class to factory.

Definition at line 239 of file transport.h.

int* ConvectionTransport::row_4_el
private

Definition at line 302 of file transport.h.

double** ConvectionTransport::sources_corr
private

Definition at line 258 of file transport.h.

vector<unsigned int> ConvectionTransport::subst_idx
private

List of indices used to call balance methods for a set of quantities.

Definition at line 317 of file transport.h.

SubstanceList ConvectionTransport::substances_
private

Transported substances.

Definition at line 307 of file transport.h.

TimeMark::Type ConvectionTransport::target_mark_type
private

TimeMark type for time marks denoting end of every time interval where transport matrix remains constant.

Definition at line 262 of file transport.h.

Mat ConvectionTransport::tm
private

Definition at line 271 of file transport.h.

double** ConvectionTransport::tm_diag
private

Definition at line 275 of file transport.h.

double ConvectionTransport::transport_bc_time
private

Time of the last update of the boundary condition terms.

Definition at line 281 of file transport.h.

double ConvectionTransport::transport_matrix_time
private

Time when the transport matrix was created. TODO: when we have our own classes for LA objects, we can use lazy dependence to check necessity for matrix update

Definition at line 280 of file transport.h.

Vec* ConvectionTransport::v_sources_corr
private

Definition at line 259 of file transport.h.

Vec* ConvectionTransport::v_tm_diag
private

Definition at line 274 of file transport.h.

Vec ConvectionTransport::vcfl_flow_
private

Parallel vector for flow contribution to CFL condition.

Definition at line 265 of file transport.h.

Vec ConvectionTransport::vcfl_source_
private

Parallel vector for source term contribution to CFL condition.

Definition at line 265 of file transport.h.

Vec* ConvectionTransport::vconc
private

Concentration vectors for mobile phase.

Definition at line 284 of file transport.h.

VecScatter ConvectionTransport::vconc_out_scatter
private

Definition at line 270 of file transport.h.

Vec* ConvectionTransport::vcumulative_corr
private

Definition at line 291 of file transport.h.

Vec* ConvectionTransport::vpconc
private

Definition at line 289 of file transport.h.

Vec ConvectionTransport::vpmass_diag
private

Definition at line 273 of file transport.h.


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