Flow123d
release_3.0.0-968-gc87a28e79
|
Go to the documentation of this file.
64 Input::register_class< ConvectionTransport, Mesh &, const Input::Record >(
_equation_name) +
78 "Specification of output fields and output times.")
86 .
description(
"Boundary condition for concentration of substances.")
91 .
description(
"Initial values for concentration of substances.")
107 .
description(
"Subdomain ids of the domain decomposition.");
266 unsigned int i, sbi, n_subst;
270 tm_diag =
new double*[n_subst];
272 for (sbi = 0; sbi < n_subst; sbi++) {
278 conc =
new double*[n_subst];
283 for (sbi = 0; sbi < n_subst; sbi++) {
300 int sbi, n_subst, rank, np;
307 vconc =
new Vec[n_subst];
308 vpconc =
new Vec[n_subst];
315 for (sbi = 0; sbi < n_subst; sbi++) {
322 VecZeroEntries(
vconc[sbi]);
323 VecZeroEntries(
vpconc[sbi]);
336 VecZeroEntries(
out_conc[sbi].petsc_vec());
359 unsigned int sbi, loc_el;
366 for (loc_el = 0; loc_el <
el_ds->
lsize(); loc_el++) {
371 for (
unsigned int si=0; si<elm->
n_sides(); si++) {
376 double aij = -(flux / elm.
measure() );
382 VecSetValue(
bcvcorr[sbi], new_i,
value * aij, ADD_VALUES);
391 VecSetValue(
bcvcorr[sbi], new_i, 0, ADD_VALUES);
422 unsigned int loc_el, sbi;
423 double csection, source, diag;
439 for (loc_el = 0; loc_el <
el_ds->
lsize(); loc_el++)
455 diag = src_sigma * csection;
459 max_cfl = std::max(max_cfl, fabs(diag));
462 {- src_sigma * ele_acc.measure() * csection});
464 {source * ele_acc.measure()});
484 std::stringstream ss;
510 bool cfl_changed =
false;
518 DebugOut() <<
"CFL changed - flow.\n";
525 DebugOut() <<
"CFL changed - mass matrix.\n";
535 DebugOut() <<
"CFL changed - source.\n";
543 VecCreateMPI(PETSC_COMM_WORLD,
el_ds->
lsize(),PETSC_DETERMINE, &cfl);
596 DebugOut() <<
"SRC - rescale dt.\n";
630 for (
unsigned int sbi = 0; sbi <
n_substances(); sbi++) {
701 for (
unsigned int loc_el = 0; loc_el <
el_ds->
lsize(); loc_el++) {
742 double flux, flux2, edg_flux;
746 for (
unsigned int loc_el = 0; loc_el <
el_ds->
lsize(); loc_el++) {
750 for (
unsigned int si=0; si<elm->
n_sides(); si++) {
756 for(
int s=0; s < edg->
n_sides; s++) {
758 if ( flux2 > 0) edg_flux+= flux2;
760 for(
unsigned int s=0; s<edg->
n_sides; s++)
768 if ( flux2 > 0.0 && flux <0.0)
769 aij = -(flux * flux2 / ( edg_flux * elm.
measure() ) );
771 MatSetValue(
tm, new_i, new_j, aij, INSERT_VALUES);
775 aii -= (flux / elm.
measure() );
786 if (flux > 0.0) aij = flux / elm.
measure();
788 MatSetValue(
tm, new_i, new_j, aij, INSERT_VALUES);
793 aii -= (-flux) / elm.
measure();
796 MatSetValue(
tm, new_j, new_i, aij, INSERT_VALUES);
799 MatSetValue(
tm, new_i, new_i, aii, INSERT_VALUES);
805 MatAssemblyBegin(
tm, MAT_FINAL_ASSEMBLY);
806 MatAssemblyEnd(
tm, MAT_FINAL_ASSEMBLY);
843 el_distribution_out = this->
el_ds;
864 for (
unsigned int sbi = 0; sbi <
n_substances(); sbi++) {
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
#define OLD_ASSERT_EQUAL(a, b)
unsigned int n_neighs_vb() const
Return number of neighbours.
MultiField< 3, FieldValue< 3 >::Scalar > sources_sigma
Concentration sources - Robin type, in_flux = sources_sigma * (sources_conc - mobile_conc)
const string _equation_name
Distribution * get_el_ds() const
void set_balance_object(std::shared_ptr< Balance > balance) override
std::vector< VectorMPI > out_conc
MultiField< 3, FieldValue< 3 >::Scalar > conc_mobile
Calculated concentrations in the mobile zone.
Vec vcfl_flow_
Parallel vector for flow contribution to CFL condition.
void create_mass_matrix()
static UnitSI & dimensionless()
Returns dimensionless unit.
MultiField< 3, FieldValue< 3 >::Scalar > init_conc
Initial concentrations.
Distributed sparse graphs, partitioning.
bool set_time(const TimeStep &time, LimitSide limit_side)
unsigned int lsize(int proc) const
get local size
MultiField< 3, FieldValue< 3 >::Scalar > sources_density
Concentration sources - density of substance source, only positive part is used.
Basic time management class.
double end_time() const
End time.
static const Input::Type::Record & get_input_type()
void initialize(std::shared_ptr< OutputTime > stream, Mesh *mesh, Input::Record in_rec, const TimeGovernor &tg)
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
double transport_matrix_time
int LongIdx
Define type that represents indices of large arrays (elements, nodes, dofs etc.)
virtual Range< ElementAccessor< 3 > > elements_range() const
Returns range of bulk elements.
TimeMark::Type equation_fixed_mark_type() const
Support classes for parallel programing.
std::vector< std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > > output_field_ptr
Fields correspond with out_conc.
MultiField< 3, FieldValue< 3 >::Scalar > sources_conc
int set_upper_constraint(double upper, std::string message)
Sets upper constraint for the next time step estimating.
void mark_input_times(const TimeGovernor &tg)
void set_input_list(Input::Array input_list, const TimeGovernor &tg)
static constexpr bool value
void output_type(OutputTime::DiscreteSpace rt)
void chkerr(unsigned int ierr)
Replacement of new/delete operator in the spirit of xmalloc.
double side_flux(const Side &side) const
temporary replacement for DofHandler accessor, flux through given side
virtual ~ConvectionTransport()
const Edge * edge() const
unsigned int size() const
get global size
LongIdx * get_row_4_el() override
Return global array of order of elements within parallel vector.
FieldCommon & flags(FieldFlag::Flags::Mask mask)
unsigned int n_substances() override
Returns number of transported substances.
LongIdx * get_row_4_el() const
void output_vector_gather()
std::shared_ptr< OutputTime > output_stream_
double transport_bc_time
Time of the last update of the boundary condition terms.
Field< 3, FieldValue< 3 >::Scalar > porosity
Mobile porosity - usually saturated water content in the case of unsaturated flow model.
static constexpr Mask equation_external_output
Match an output field, that can be also copy of other field.
bool is_mass_diag_changed
Flag indicates that porosity or cross_section changed during last time.
double ** cumulative_corr
Vec * vconc
Concentration vectors for mobile phase.
const std::vector< std::string > & names()
Class used for marking specified times at which some events occur.
void alloc_transport_structs_mpi()
void set_components(const std::vector< string > &names)
std::shared_ptr< Balance > balance_
object for calculation and writing the mass balance to file.
bool is_convection_matrix_scaled
static constexpr Mask equation_result
Match result fields. These are never given by input or copy of input.
const Input::Record input_rec
Record with input specification.
bool evaluate_time_constraint(double &time_constraint) override
static const int registrar
Registrar of class to factory.
SideIter side(const unsigned int i) const
void zero_time_step() override
void set_initial_condition()
const MH_DofHandler * mh_dh
const TimeStep & step(int index=-1) const
Vec vcfl_source_
Parallel vector for source term contribution to CFL condition.
virtual void output_data() override
Write computed fields.
EquationOutput output_fields
Fields indended for output, i.e. all input fields plus those representing solution.
static auto subdomain(Mesh &mesh) -> IndexField
vector< unsigned int > subst_idx
List of indices used to call balance methods for a set of quantities.
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_conc
static bool print_message_table(ostream &stream, std::string equation_name)
Class for representation SI units of Fields.
const RegionDB & region_db() const
RegionSet get_region_set(const std::string &set_name) const
FLOW123D_FORCE_LINK_IN_CHILD(convectionTransport)
ElementAccessor< 3 > element() const
double ** conc
Concentrations for phase, substance, element.
Field< 3, FieldValue< 3 >::Scalar > cross_section
Pointer to DarcyFlow field cross_section.
ElementAccessor< 3 > element_accessor()
TimeMark add(const TimeMark &mark)
SubstanceList substances_
Transported substances.
virtual const Value::return_type & value(const Point &p, const ElementAccessor< spacedim > &elm) const
static auto region_id(Mesh &mesh) -> IndexField
Field< 3, FieldValue< 3 >::Scalar > subdomain
FieldCommon & input_default(const string &input_default)
void output(TimeStep step)
void make_transport_partitioning()
unsigned int n_sides() const
double ** get_concentration_matrix() override
Getter for array of concentrations per element.
static TimeMarks & marks()
Field< 3, FieldValue< 3 >::Scalar > water_content
Water content - result of unsaturated water flow model or porosity.
TimeMark::Type target_mark_type
TimeMark type for time marks denoting end of every time interval where transport matrix remains const...
void set_mesh(const Mesh &mesh)
#define WarningOut()
Macro defining 'warning' record of log.
void update_solution() override
static Input::Type::Abstract & get_input_type()
Common specification of the input record for secondary equations.
unsigned int idx() const
Return local idx of element in boundary / bulk part of element vector.
void compute_concentration_sources()
Assembles concentration sources for each substance. note: the source of concentration is multiplied b...
void fill_output_data(VectorMPI &vec_seq, std::shared_ptr< FieldFE< spacedim, Value > > field_ptr)
bool is_changed_dt() const
ConvectionTransport(Mesh &init_mesh, const Input::Record in_rec)
void get_par_info(LongIdx *&el_4_loc, Distribution *&el_ds) override
Return array of indices of local elements and parallel distribution of elements.
void set_target_time(double target_time) override
void alloc_transport_vectors()
FieldCommon & description(const string &description)
double time_changed() const
VecScatter vconc_out_scatter
virtual unsigned int n_elements(bool boundary=false) const
Returns count of boundary or bulk elements.
#define DebugOut()
Macro defining 'debug' record of log.
SideIter side(const unsigned int loc_index)
void next_time()
Proceed to the next time according to current estimated time step.
virtual ElementAccessor< 3 > element_accessor(unsigned int idx) const
Create and return ElementAccessor to element of given idx.
double cfl_max_step
Time step constraint coming from CFL condition.
void initialize() override
double fix_dt_until_mark()
Fixing time step until fixed time mark.
unsigned int bulk_idx() const
Returns index of the region in the bulk set.
#define START_TIMER(tag)
Starts a timer with specified tag.
void set_boundary_conditions()
bool is_local(unsigned int idx) const
identify local index
#define MPI_Barrier(comm)
unsigned int * boundary_idx_
Field< 3, FieldValue< 3 >::Scalar > region_id
double measure() const
Computes the measure of the element.
#define END_TIMER(tag)
Ends a timer with specified tag.
void create_transport_matrix_mpi()
FieldCommon & name(const string &name)
Implementation of range helper class.
arma::vec::fixed< spacedim > centre() const
Computes the barycenter.
unsigned int begin(int proc) const
get starting local index
LongIdx * get_el_4_loc() const