Flow123d
JS_before_hm-2072-g4aad0192b
|
Go to the documentation of this file.
71 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.");
131 eq_data_->transport_matrix_time = -1.0;
133 eq_data_->is_convection_matrix_scaled =
false;
139 eq_data_->dh_ = make_shared<DOFHandlerMultiDim>(init_mesh);
140 shared_ptr<DiscreteSpace> ds = make_shared<EqualOrderDiscreteSpace>( &init_mesh, fe);
169 eq_fields_->conc_mobile_fe[sbi] = create_field_fe< 3, FieldValue<3>::Scalar >(
eq_data_->dh_);
194 return eq_fields_->conc_mobile_fe[sbi]->vec().petsc_vec();
246 int sbi, n_subst, lsize;
252 vpconc =
new Vec[n_subst];
253 eq_data_->bcvcorr =
new Vec[n_subst];
259 for (sbi = 0; sbi < n_subst; sbi++) {
261 VecZeroEntries(
eq_data_->bcvcorr[sbi]);
264 VecZeroEntries(
vpconc[sbi]);
269 eq_data_->corr_vec.emplace_back(lsize, PETSC_COMM_WORLD);
271 eq_data_->tm_diag.emplace_back(lsize, PETSC_COMM_WORLD);
283 eq_data_->alloc_transport_structs_mpi(lsize);
293 std::stringstream ss;
323 bool changed_flux =
eq_fields_->flow_flux.changed();
328 bool cfl_changed =
false;
337 eq_data_->is_convection_matrix_scaled=
false;
339 DebugOut() <<
"CFL changed - flow.\n";
347 DebugOut() <<
"CFL changed - mass matrix.\n";
365 DebugOut() <<
"CFL changed - source.\n";
374 VecWAXPY(cfl, 1.0,
eq_data_->cfl_flow_.petsc_vec(),
eq_data_->cfl_source_.petsc_vec());
409 VecScale(
eq_data_->bcvcorr[sbi], dt);
416 DebugOut() <<
"SRC - rescale dt.\n";
421 VecScale(
eq_data_->corr_vec[sbi].petsc_vec(), dt);
422 VecScale(
eq_data_->tm_diag[sbi].petsc_vec(), dt);
431 double dt = (!
eq_data_->is_convection_matrix_scaled) ? dt_new : dt_scaled;
434 eq_data_->is_convection_matrix_scaled =
true;
446 }
else eq_data_->is_mass_diag_changed =
false;
451 for (
unsigned int sbi = 0; sbi <
n_substances(); sbi++) {
454 Vec vconc =
eq_fields_->conc_mobile_fe[sbi]->vec().petsc_vec();
469 VecCopy(vconc,
vpconc[sbi]);
471 if (
eq_data_->is_mass_diag_changed) {
475 VecPointwiseDivide(vconc, vconc,
eq_data_->mass_diag);
478 VecPointwiseDivide(vconc, vconc,
eq_data_->mass_diag);
479 VecAXPY(vconc, 1,
vpconc[sbi]);
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
#define OLD_ASSERT_EQUAL(a, b)
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()
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_
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.
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.
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)
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.