69 Input::register_class< ConvectionTransport, Mesh &, const Input::Record >(
_equation_name) +
84 "Specification of output fields and output times.")
92 .
description(
"Boundary condition for concentration of substances.")
97 .
description(
"Initial values for concentration of substances.")
113 .
description(
"Subdomain ids of the domain decomposition.");
132 eq_data_->transport_matrix_time = -1.0;
134 eq_data_->is_convection_matrix_scaled =
false;
140 eq_data_->dh_ = make_shared<DOFHandlerMultiDim>(init_mesh);
141 shared_ptr<DiscreteSpace> ds = make_shared<EqualOrderDiscreteSpace>( &init_mesh, fe);
200 return eq_fields_->conc_mobile_fe[sbi]->vec().petsc_vec();
252 int sbi, n_subst, lsize;
258 vpconc =
new Vec[n_subst];
259 eq_data_->bcvcorr =
new Vec[n_subst];
265 for (sbi = 0; sbi < n_subst; sbi++) {
267 VecZeroEntries(
eq_data_->bcvcorr[sbi]);
270 VecZeroEntries(
vpconc[sbi]);
275 eq_data_->corr_vec.emplace_back(lsize, PETSC_COMM_WORLD);
277 eq_data_->tm_diag.emplace_back(lsize, PETSC_COMM_WORLD);
289 eq_data_->alloc_transport_structs_mpi(lsize);
299 std::stringstream ss;
329 bool changed_flux =
eq_fields_->flow_flux.changed();
334 bool cfl_changed =
false;
343 eq_data_->is_convection_matrix_scaled=
false;
345 DebugOut() <<
"CFL changed - flow.\n";
353 DebugOut() <<
"CFL changed - mass matrix.\n";
371 DebugOut() <<
"CFL changed - source.\n";
380 VecWAXPY(cfl, 1.0,
eq_data_->cfl_flow_.petsc_vec(),
eq_data_->cfl_source_.petsc_vec());
415 VecScale(
eq_data_->bcvcorr[sbi], dt);
422 DebugOut() <<
"SRC - rescale dt.\n";
427 VecScale(
eq_data_->corr_vec[sbi].petsc_vec(), dt);
428 VecScale(
eq_data_->tm_diag[sbi].petsc_vec(), dt);
437 double dt = (!
eq_data_->is_convection_matrix_scaled) ? dt_new : dt_scaled;
440 eq_data_->is_convection_matrix_scaled =
true;
452 }
else eq_data_->is_mass_diag_changed =
false;
457 for (
unsigned int sbi = 0; sbi <
n_substances(); sbi++) {
460 Vec vconc =
eq_fields_->conc_mobile_fe[sbi]->vec().petsc_vec();
475 VecCopy(vconc,
vpconc[sbi]);
477 if (
eq_data_->is_mass_diag_changed) {
481 VecPointwiseDivide(vconc, vconc,
eq_data_->mass_diag);
484 VecPointwiseDivide(vconc, vconc,
eq_data_->mass_diag);
485 VecAXPY(vconc, 1,
vpconc[sbi]);
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR) only for debug mode.
static Input::Type::Abstract & get_input_type()
Common specification of the input record for secondary equations.
Field< 3, FieldValue< 3 >::Scalar > subdomain
MultiField< 3, FieldValue< 3 >::Scalar > init_conc
Initial concentrations.
Field< 3, FieldValue< 3 >::Scalar > region_id
EquationOutput output_fields
Fields indended for output, i.e. all input fields plus those representing solution.
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_conc
MultiField< 3, FieldValue< 3 >::Scalar > conc_mobile
Calculated concentrations in the mobile zone.
FieldFEScalarVec & get_p0_interpolation() override
Getter for P0 interpolation by FieldFE.
GenericAssembly< MassAssemblyConvectionDim > * mass_assembly_
general assembly objects, hold assembly objects of appropriate dimension
unsigned int n_substances() override
Returns number of transported substances.
void initialize() override
void set_target_time(double target_time) override
void update_solution() override
GenericAssembly< InitCondAssemblyConvectionDim > * init_cond_assembly_
void alloc_transport_structs_mpi()
std::shared_ptr< EqFields > eq_fields_
void zero_time_step() override
void alloc_transport_vectors()
ConvectionTransport(Mesh &init_mesh, const Input::Record in_rec)
const Input::Record input_rec
Record with input specification.
virtual void output_data() override
Write computed fields.
Vec get_component_vec(unsigned int sbi) override
Return PETSc vector with solution for sbi-th substance.
std::shared_ptr< OutputTime > output_stream_
void set_balance_object(std::shared_ptr< Balance > balance) override
static const Input::Type::Record & get_input_type()
TimeMark::Type target_mark_type
TimeMark type for time marks denoting end of every time interval where transport matrix remains const...
GenericAssembly< ConcSourcesBdrAssemblyConvectionDim > * conc_sources_bdr_assembly_
GenericAssembly< MatrixMpiAssemblyConvectionDim > * matrix_mpi_assembly_
bool evaluate_time_constraint(double &time_constraint) override
double cfl_max_step
Time step constraint coming from CFL condition.
static const int registrar
Registrar of class to factory.
std::shared_ptr< EqData > eq_data_
virtual ~ConvectionTransport()
unsigned int lsize(int proc) const
get local size
std::shared_ptr< Balance > balance() const
std::shared_ptr< FieldSet > eq_fieldset_
void init_user_fields(Input::Array user_fields, FieldSet &output_fields)
static Input::Type::Record & user_fields_template(std::string equation_name)
Template Record with common key user_fields for derived equations.
std::shared_ptr< Balance > balance_
object for calculation and writing the mass balance to file.
static bool print_message_table(ostream &stream, std::string equation_name)
FieldCommon & description(const string &description)
FieldCommon & flags(FieldFlag::Flags::Mask mask)
FieldCommon & name(const string &name)
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
FieldCommon & input_default(const string &input_default)
static constexpr Mask equation_result
Match result fields. These are never given by input or copy of input.
static constexpr Mask equation_external_output
Match an output field, that can be also copy of other field.
void set_default_fieldset()
Generic class of assemblation.
static auto region_id(Mesh &mesh) -> IndexField
static auto subdomain(Mesh &mesh) -> IndexField
Distribution * get_el_ds() const
unsigned int n_elements() const
unsigned int max_edge_sides(unsigned int dim) const
TimeMark::Type equation_fixed_mark_type() const
int set_upper_constraint(double upper, std::string message)
Sets upper constraint for the next time step estimating.
bool is_changed_dt() const
double end_time() const
End time.
double fix_dt_until_mark()
Fixing time step until fixed time mark.
const TimeStep & step(int index=-1) const
static TimeMarks & marks()
void next_time()
Proceed to the next time according to current estimated time step.
Class used for marking specified times at which some events occur.
TimeMark add(const TimeMark &mark)
Class for representation SI units of Fields.
static UnitSI & dimensionless()
Returns dimensionless unit.
Support classes for parallel programing.
Definitions of basic Lagrangean finite elements with polynomial shape functions.
#define FLOW123D_FORCE_LINK_IN_CHILD(x)
#define WarningOut()
Macro defining 'warning' record of log.
#define DebugOut()
Macro defining 'debug' record of log.
#define MPI_Barrier(comm)
Definitions of particular quadrature rules on simplices.
Implementation of range helper class.
Distributed sparse graphs, partitioning.
#define END_TIMER(tag)
Ends a timer with specified tag.
#define START_TIMER(tag)
Starts a timer with specified tag.
void chkerr(unsigned int ierr)
Replacement of new/delete operator in the spirit of xmalloc.
Basic time management class.
const string _equation_name