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]);
#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.
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< InitCondAssemblyConvection > * init_cond_assembly_
void alloc_transport_structs_mpi()
std::shared_ptr< EqFields > eq_fields_
void zero_time_step() override
GenericAssembly< MassAssemblyConvection > * mass_assembly_
general assembly objects, hold assembly objects of appropriate dimension
void alloc_transport_vectors()
GenericAssembly< MatrixMpiAssemblyConvection > * matrix_mpi_assembly_
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< ConcSourcesBdrAssemblyConvection > * conc_sources_bdr_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()
void assemble(std::shared_ptr< DOFHandlerMultiDim > dh) override
General assemble methods.
void set_min_edge_sides(unsigned int val)
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.
Class FEValues calculates finite element data on the actual cells such as shape function values,...
#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