Flow123d
JB_transport-d4c8564
|
Go to the documentation of this file.
71 Input::register_class< ConvectionTransport, Mesh &, const Input::Record >(
_equation_name) +
86 "Specification of output fields and output times.")
94 .
description(
"Boundary condition for concentration of substances.")
99 .
description(
"Initial values for concentration of substances.")
115 .
description(
"Subdomain ids of the domain decomposition.");
134 eq_data_->transport_matrix_time = -1.0;
136 eq_data_->is_convection_matrix_scaled =
false;
142 eq_data_->dh_ = make_shared<DOFHandlerMultiDim>(init_mesh);
143 shared_ptr<DiscreteSpace> ds = make_shared<EqualOrderDiscreteSpace>( &init_mesh, fe);
177 eq_fields_->conc_mobile_fe[sbi] = create_field_fe< 3, FieldValue<3>::Scalar >(
eq_data_->dh_);
202 return eq_fields_->conc_mobile_fe[sbi]->vec().petsc_vec();
254 int sbi, n_subst, lsize;
260 vpconc =
new Vec[n_subst];
261 eq_data_->bcvcorr =
new Vec[n_subst];
267 for (sbi = 0; sbi < n_subst; sbi++) {
269 VecZeroEntries(
eq_data_->bcvcorr[sbi]);
272 VecZeroEntries(
vpconc[sbi]);
277 eq_data_->corr_vec.emplace_back(lsize, PETSC_COMM_WORLD);
279 eq_data_->tm_diag.emplace_back(lsize, PETSC_COMM_WORLD);
291 eq_data_->alloc_transport_structs_mpi(lsize);
301 std::stringstream ss;
331 bool changed_flux =
eq_fields_->flow_flux.changed();
336 bool cfl_changed =
false;
345 eq_data_->is_convection_matrix_scaled=
false;
347 DebugOut() <<
"CFL changed - flow.\n";
355 DebugOut() <<
"CFL changed - mass matrix.\n";
373 DebugOut() <<
"CFL changed - source.\n";
382 VecWAXPY(cfl, 1.0,
eq_data_->cfl_flow_.petsc_vec(),
eq_data_->cfl_source_.petsc_vec());
417 VecScale(
eq_data_->bcvcorr[sbi], dt);
424 DebugOut() <<
"SRC - rescale dt.\n";
429 VecScale(
eq_data_->corr_vec[sbi].petsc_vec(), dt);
430 VecScale(
eq_data_->tm_diag[sbi].petsc_vec(), dt);
439 double dt = (!
eq_data_->is_convection_matrix_scaled) ? dt_new : dt_scaled;
442 eq_data_->is_convection_matrix_scaled =
true;
454 }
else eq_data_->is_mass_diag_changed =
false;
459 for (
unsigned int sbi = 0; sbi <
n_substances(); sbi++) {
462 Vec vconc =
eq_fields_->conc_mobile_fe[sbi]->vec().petsc_vec();
477 VecCopy(vconc,
vpconc[sbi]);
479 if (
eq_data_->is_mass_diag_changed) {
483 VecPointwiseDivide(vconc, vconc,
eq_data_->mass_diag);
486 VecPointwiseDivide(vconc, vconc,
eq_data_->mass_diag);
487 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.