Go to the documentation of this file.
70 Input::register_class< ConvectionTransport, Mesh &, const Input::Record >(
_equation_name) +
85 "Specification of output fields and output times.")
93 .
description(
"Boundary condition for concentration of substances.")
98 .
description(
"Initial values for concentration of substances.")
114 .
description(
"Subdomain ids of the domain decomposition.");
133 eq_data_->transport_matrix_time = -1.0;
135 eq_data_->is_convection_matrix_scaled =
false;
141 eq_data_->dh_ = make_shared<DOFHandlerMultiDim>(init_mesh);
142 shared_ptr<DiscreteSpace> ds = make_shared<EqualOrderDiscreteSpace>( &init_mesh, fe);
176 eq_fields_->conc_mobile_fe[sbi] = create_field_fe< 3, FieldValue<3>::Scalar >(
eq_data_->dh_);
201 return eq_fields_->conc_mobile_fe[sbi]->vec().petsc_vec();
253 int sbi, n_subst, lsize;
259 vpconc =
new Vec[n_subst];
260 eq_data_->bcvcorr =
new Vec[n_subst];
266 for (sbi = 0; sbi < n_subst; sbi++) {
268 VecZeroEntries(
eq_data_->bcvcorr[sbi]);
271 VecZeroEntries(
vpconc[sbi]);
276 eq_data_->corr_vec.emplace_back(lsize, PETSC_COMM_WORLD);
278 eq_data_->tm_diag.emplace_back(lsize, PETSC_COMM_WORLD);
290 eq_data_->alloc_transport_structs_mpi(lsize);
300 std::stringstream ss;
330 bool changed_flux =
eq_fields_->flow_flux.changed();
335 bool cfl_changed =
false;
344 eq_data_->is_convection_matrix_scaled=
false;
346 DebugOut() <<
"CFL changed - flow.\n";
354 DebugOut() <<
"CFL changed - mass matrix.\n";
372 DebugOut() <<
"CFL changed - source.\n";
381 VecWAXPY(cfl, 1.0,
eq_data_->cfl_flow_.petsc_vec(),
eq_data_->cfl_source_.petsc_vec());
416 VecScale(
eq_data_->bcvcorr[sbi], dt);
423 DebugOut() <<
"SRC - rescale dt.\n";
428 VecScale(
eq_data_->corr_vec[sbi].petsc_vec(), dt);
429 VecScale(
eq_data_->tm_diag[sbi].petsc_vec(), dt);
438 double dt = (!
eq_data_->is_convection_matrix_scaled) ? dt_new : dt_scaled;
441 eq_data_->is_convection_matrix_scaled =
true;
453 }
else eq_data_->is_mass_diag_changed =
false;
458 for (
unsigned int sbi = 0; sbi <
n_substances(); sbi++) {
461 Vec vconc =
eq_fields_->conc_mobile_fe[sbi]->vec().petsc_vec();
476 VecCopy(vconc,
vpconc[sbi]);
478 if (
eq_data_->is_mass_diag_changed) {
482 VecPointwiseDivide(vconc, vconc,
eq_data_->mass_diag);
485 VecPointwiseDivide(vconc, vconc,
eq_data_->mass_diag);
486 VecAXPY(vconc, 1,
vpconc[sbi]);
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
static Input::Type::Record & user_fields_template(std::string equation_name)
Template Record with common key user_fields for derived equations.
unsigned int max_edge_sides(unsigned int dim) const
const string _equation_name
void set_balance_object(std::shared_ptr< Balance > balance) override
Field< 3, FieldValue< 3 >::Scalar > region_id
static UnitSI & dimensionless()
Returns dimensionless unit.
Distributed sparse graphs, partitioning.
unsigned int lsize(int proc) const
get local size
Basic time management class.
double end_time() const
End time.
static const Input::Type::Record & get_input_type()
std::shared_ptr< FieldSet > eq_fieldset_
void set_min_edge_sides(unsigned int val)
GenericAssembly< MatrixMpiAssemblyConvection > * matrix_mpi_assembly_
Distribution * get_el_ds() const
TimeMark::Type equation_fixed_mark_type() const
Support classes for parallel programing.
EquationOutput output_fields
Fields indended for output, i.e. all input fields plus those representing solution.
MultiField< 3, FieldValue< 3 >::Scalar > conc_mobile
Calculated concentrations in the mobile zone.
int set_upper_constraint(double upper, std::string message)
Sets upper constraint for the next time step estimating.
Class FEValues calculates finite element data on the actual cells such as shape function values,...
void chkerr(unsigned int ierr)
Replacement of new/delete operator in the spirit of xmalloc.
#define FLOW123D_FORCE_LINK_IN_CHILD(x)
virtual ~ConvectionTransport()
std::shared_ptr< EqData > eq_data_
FieldCommon & flags(FieldFlag::Flags::Mask mask)
unsigned int n_substances() override
Returns number of transported substances.
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_conc
std::shared_ptr< OutputTime > output_stream_
void init_user_fields(Input::Array user_fields, FieldSet &output_fields)
GenericAssembly< InitCondAssemblyConvection > * init_cond_assembly_
MultiField< 3, FieldValue< 3 >::Scalar > init_conc
Initial concentrations.
void assemble(std::shared_ptr< DOFHandlerMultiDim > dh) override
General assemble methods.
static constexpr Mask equation_external_output
Match an output field, that can be also copy of other field.
Definitions of basic Lagrangean finite elements with polynomial shape functions.
std::shared_ptr< Balance > balance() const
Class used for marking specified times at which some events occur.
void alloc_transport_structs_mpi()
std::shared_ptr< Balance > balance_
object for calculation and writing the mass balance to file.
void set_default_fieldset()
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.
void zero_time_step() override
Definitions of particular quadrature rules on simplices.
const TimeStep & step(int index=-1) const
virtual void output_data() override
Write computed fields.
GenericAssembly< ConcSourcesBdrAssemblyConvection > * conc_sources_bdr_assembly_
static auto subdomain(Mesh &mesh) -> IndexField
static bool print_message_table(ostream &stream, std::string equation_name)
Class for representation SI units of Fields.
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
std::shared_ptr< EqFields > eq_fields_
TimeMark add(const TimeMark &mark)
static auto region_id(Mesh &mesh) -> IndexField
Vec get_component_vec(unsigned int sbi) override
Return PETSc vector with solution for sbi-th substance.
FieldCommon & input_default(const string &input_default)
FieldFEScalarVec & get_p0_interpolation() override
Getter for P0 interpolation by FieldFE.
Field< 3, FieldValue< 3 >::Scalar > subdomain
static TimeMarks & marks()
TimeMark::Type target_mark_type
TimeMark type for time marks denoting end of every time interval where transport matrix remains const...
#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.
bool is_changed_dt() const
ConvectionTransport(Mesh &init_mesh, const Input::Record in_rec)
GenericAssembly< MassAssemblyConvection > * mass_assembly_
general assembly objects, hold assembly objects of appropriate dimension
void set_target_time(double target_time) override
unsigned int n_elements() const
void alloc_transport_vectors()
FieldCommon & description(const string &description)
#define DebugOut()
Macro defining 'debug' record of log.
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR) only for debug mode.
void next_time()
Proceed to the next time according to current estimated time step.
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.
#define START_TIMER(tag)
Starts a timer with specified tag.
#define MPI_Barrier(comm)
#define END_TIMER(tag)
Ends a timer with specified tag.
FieldCommon & name(const string &name)
Implementation of range helper class.