57 Input::register_class< ConvectionTransport, Mesh &, const Input::Record >(
_equation_name) +
71 "Specification of output fields and output times.")
78 ADD_FIELD(
bc_conc,
"Boundary condition for concentration of substances.",
"0.0");
95 .
description(
"Subdomain ids of the domain decomposition.");
201 VecDestroy(&(
vconc[sbi]));
202 VecDestroy(&(
vpconc[sbi]));
255 unsigned int i, sbi, n_subst;
259 tm_diag =
new double*[n_subst];
261 for (sbi = 0; sbi < n_subst; sbi++) {
267 conc =
new double*[n_subst];
270 for (sbi = 0; sbi < n_subst; sbi++) {
287 int sbi, n_subst, rank, np;
294 vconc =
new Vec[n_subst];
295 vpconc =
new Vec[n_subst];
302 for (sbi = 0; sbi < n_subst; sbi++) {
309 VecZeroEntries(
vconc[sbi]);
310 VecZeroEntries(
vpconc[sbi]);
323 VecZeroEntries(
out_conc[sbi].get_data_petsc());
346 unsigned int sbi, loc_el, loc_b = 0;
353 for (loc_el = 0; loc_el <
el_ds->
lsize(); loc_el++) {
355 if (elm->boundary_idx_ != NULL) {
359 Boundary *b = elm->side(si)->cond();
363 double aij = -(flux / elm->measure() );
369 VecSetValue(
bcvcorr[sbi], new_i, value * aij, ADD_VALUES);
378 VecSetValue(
bcvcorr[sbi], new_i, 0, ADD_VALUES);
410 unsigned int loc_el, sbi;
411 double csection, source, diag;
428 for (loc_el = 0; loc_el <
el_ds->
lsize(); loc_el++)
445 diag = src_sigma * csection;
449 max_cfl = std::max(max_cfl, fabs(diag));
452 {- src_sigma * ele->
measure() * csection},
473 std::stringstream ss;
499 bool cfl_changed =
false;
507 DebugOut() <<
"CFL changed - flow.\n";
514 DebugOut() <<
"CFL changed - mass matrix.\n";
524 DebugOut() <<
"CFL changed - source.\n";
532 VecCreateMPI(PETSC_COMM_WORLD,
el_ds->
lsize(),PETSC_DETERMINE, &cfl);
585 DebugOut() <<
"SRC - rescale dt.\n";
619 for (
unsigned int sbi = 0; sbi <
n_substances(); sbi++) {
690 for (
unsigned int loc_el = 0; loc_el <
el_ds->
lsize(); loc_el++) {
723 int s, j, np, rank, new_j, new_i;
731 double flux, flux2, edg_flux;
735 for (
unsigned int loc_el = 0; loc_el <
el_ds->
lsize(); loc_el++) {
742 if (elm->side(si)->cond() == NULL) {
743 edg = elm->side(si)->edge();
745 for(
int s=0; s < edg->
n_sides; s++) {
747 if ( flux2 > 0) edg_flux+= flux2;
752 if (edg->
side(s) != elm->side(si)) {
757 if ( flux2 > 0.0 && flux <0.0)
758 aij = -(flux * flux2 / ( edg_flux * elm->measure() ) );
760 MatSetValue(
tm, new_i, new_j, aij, INSERT_VALUES);
764 aii -= (flux / elm->measure() );
775 if (flux > 0.0) aij = flux / elm->measure();
777 MatSetValue(
tm, new_i, new_j, aij, INSERT_VALUES);
782 aii -= (-flux) / elm->measure();
783 aij = (-flux) / el2->measure();
785 MatSetValue(
tm, new_j, new_i, aij, INSERT_VALUES);
788 MatSetValue(
tm, new_i, new_i, aii, INSERT_VALUES);
794 MatAssemblyBegin(
tm, MAT_FINAL_ASSEMBLY);
795 MatAssemblyEnd(
tm, MAT_FINAL_ASSEMBLY);
832 el_distribution_out = this->
el_ds;
void output_type(OutputTime::DiscreteSpace rt)
unsigned int size() const
get global size
void set_input_list(Input::Array input_list)
static auto subdomain(Mesh &mesh) -> IndexField
std::vector< VectorSeqDouble > out_conc
bool is_mass_diag_changed
Flag indicates that porosity or cross_section changed during last time.
double time_changed() const
void update_solution() override
double end_time() const
End time.
double transport_matrix_time
const std::vector< std::string > & names()
#define FOR_EDGE_SIDES(i, j)
#define FOR_ELEMENTS(_mesh_, __i)
void alloc_transport_vectors()
unsigned int n_substances() override
Returns number of transported substances.
void output(TimeStep step)
double fix_dt_until_mark()
Fixing time step until fixed time mark.
MultiField< 3, FieldValue< 3 >::Scalar > conc_mobile
Calculated concentrations in the mobile zone.
void create_mass_matrix()
void next_time()
Proceed to the next time according to current estimated time step.
void initialize() override
std::shared_ptr< OutputTime > output_stream_
TimeMark::Type target_mark_type
TimeMark type for time marks denoting end of every time interval where transport matrix remains const...
void set_initial_condition()
double transport_bc_time
Time of the last update of the boundary condition terms.
MultiField< 3, FieldValue< 3 >::Scalar > sources_density
Concentration sources - density of substance source, only positive part is used.
void set_boundary_conditions()
RegionSet get_region_set(const string &set_name) const
#define ELEMENT_FULL_ITER(_mesh_, i)
Fields computed from the mesh data.
EquationOutput output_fields
Fields indended for output, i.e. all input fields plus those representing solution.
void initialize(std::shared_ptr< OutputTime > stream, Input::Record in_rec, const TimeGovernor &tg)
#define FOR_ELEMENT_SIDES(i, j)
MultiField< 3, FieldValue< 3 >::Scalar > sources_conc
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_conc
int * get_el_4_loc() const
const RegionDB & region_db() const
void set_balance_object(std::shared_ptr< Balance > balance) override
ElementAccessor< 3 > element_accessor(unsigned int idx, bool boundary=false)
double ** conc
Concentrations for phase, substance, element.
const TimeStep & step(int index=-1) const
virtual ~ConvectionTransport()
static Input::Type::Abstract & get_input_type()
Common specification of the input record for secondary equations.
MultiField< 3, FieldValue< 3 >::Scalar > init_conc
Initial concentrations.
#define ADD_FIELD(name,...)
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
void zero_time_step() override
static TimeMarks & marks()
void output_vector_gather()
Basic time management class.
const Input::Record input_rec
Record with input specification.
static constexpr bool value
const string _equation_name
const MH_DofHandler * mh_dh
static const Input::Type::Record & get_input_type()
unsigned int n_elements() const
bool is_local(unsigned int idx) const
identify local index
static constexpr Mask equation_result
Match result fields. These are never given by input or copy of input.
TimeMark::Type equation_fixed_mark_type() const
MultiField< 3, FieldValue< 3 >::Scalar > sources_sigma
Concentration sources - Robin type, in_flux = sources_sigma * (sources_conc - mobile_conc) ...
static constexpr Mask equation_external_output
Match an output field, that can be also copy of other field.
unsigned int begin(int proc) const
get starting local index
static auto region_id(Mesh &mesh) -> IndexField
ConvectionTransport(Mesh &init_mesh, const Input::Record in_rec)
static const int registrar
Registrar of class to factory.
bool is_changed_dt() const
#define START_TIMER(tag)
Starts a timer with specified tag.
SubstanceList substances_
Transported substances.
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm) const
double ** get_concentration_matrix() override
Getter for array of concentrations per element.
Field< 3, FieldValue< 3 >::Scalar > porosity
Mobile porosity - usually saturated water content in the case of unsaturated flow model...
std::shared_ptr< Balance > balance_
object for calculation and writing the mass balance to file.
vector< unsigned int > subst_idx
List of indices used to call balance methods for a set of quantities.
Distribution * get_el_ds() const
Field< 3, FieldValue< 3 >::Scalar > water_content
Water content - result of unsaturated water flow model or porosity.
Vec * vconc
Concentration vectors for mobile phase.
void mark_input_times(const TimeGovernor &tg)
TimeMark add(const TimeMark &mark)
Field< 3, FieldValue< 3 >::Integer > region_id
void create_transport_matrix_mpi()
Support classes for parallel programing.
void alloc_transport_structs_mpi()
int set_upper_constraint(double upper, std::string message)
Sets upper constraint for the next time step estimating.
double side_flux(const Side &side) const
temporary replacement for DofHandler accessor, flux through given side
FieldCommon & description(const string &description)
bool is_convection_matrix_scaled
FLOW123D_FORCE_LINK_IN_CHILD(convectionTransport)
#define ELEMENT_FULL_ITER_NULL(_mesh_)
void set_components(const std::vector< string > &names)
ElementFullIter element() const
void compute_concentration_sources()
Assembles concentration sources for each substance. note: the source of concentration is multiplied b...
bool evaluate_time_constraint(double &time_constraint) override
VecScatter vconc_out_scatter
Vec vcfl_flow_
Parallel vector for flow contribution to CFL condition.
arma::vec3 centre() const
void set_target_time(double target_time) override
int * get_row_4_el() const
virtual void output_data() override
Write computed fields.
bool set_time(const TimeStep &time, LimitSide limit_side)
Distributed sparse graphs, partitioning.
Vec vcfl_source_
Parallel vector for source term contribution to CFL condition.
unsigned int bulk_idx() const
Returns index of the region in the bulk set.
int * get_row_4_el() override
Return global array of order of elements within parallel vector.
#define WarningOut()
Macro defining 'warning' record of log.
FieldCommon & name(const string &name)
#define END_TIMER(tag)
Ends a timer with specified tag.
arma::vec::fixed< spacedim > centre() const
#define OLD_ASSERT_EQUAL(a, b)
#define FOR_ELM_NEIGHS_VB(i, j)
ElementAccessor< 3 > element_accessor() const
Gets ElementAccessor of this element.
double ** cumulative_corr
void set_mesh(const Mesh &mesh)
Class used for marking specified times at which some events occur.
void get_par_info(int *&el_4_loc, Distribution *&el_ds) override
Return array of indices of local elements and parallel distribution of elements.
FieldCommon & flags(FieldFlag::Flags::Mask mask)
Field< 3, FieldValue< 3 >::Scalar > cross_section
Pointer to DarcyFlow field cross_section.
Class for representation SI units of Fields.
Field< 3, FieldValue< 3 >::Integer > subdomain
#define MPI_Barrier(comm)
static UnitSI & dimensionless()
Returns dimensionless unit.
#define DebugOut()
Macro defining 'debug' record of log.
static bool print_message_table(ostream &stream, std::string equation_name)
Other possible transformation of coordinates:
SideIter side(const unsigned int i) const
ElementAccessor< 3 > element_accessor()
void make_transport_partitioning()
double cfl_max_step
Time step constraint coming from CFL condition.
ElementVector element
Vector of elements of the mesh.
unsigned int lsize(int proc) const
get local size