57 Input::register_class< ConvectionTransport, Mesh &, const Input::Record >(
_equation_name) +
71 "Setting of the fields output.")
198 VecDestroy(&(
vconc[sbi]));
199 VecDestroy(&(
vpconc[sbi]));
252 unsigned int i, sbi, n_subst;
256 tm_diag =
new double*[n_subst];
258 for (sbi = 0; sbi < n_subst; sbi++) {
264 conc =
new double*[n_subst];
267 for (sbi = 0; sbi < n_subst; sbi++) {
284 int sbi, n_subst, rank, np;
291 vconc =
new Vec[n_subst];
292 vpconc =
new Vec[n_subst];
299 for (sbi = 0; sbi < n_subst; sbi++) {
306 VecZeroEntries(
vconc[sbi]);
307 VecZeroEntries(
vpconc[sbi]);
320 VecZeroEntries(
out_conc[sbi].get_data_petsc());
343 unsigned int sbi, loc_el, loc_b = 0;
350 for (loc_el = 0; loc_el <
el_ds->
lsize(); loc_el++) {
352 if (elm->boundary_idx_ != NULL) {
356 Boundary *b = elm->side(si)->cond();
360 double aij = -(flux / elm->measure() );
366 VecSetValue(
bcvcorr[sbi], new_i, value * aij, ADD_VALUES);
375 VecSetValue(
bcvcorr[sbi], new_i, 0, ADD_VALUES);
407 unsigned int loc_el, sbi;
408 double csection, source, diag;
425 for (loc_el = 0; loc_el <
el_ds->
lsize(); loc_el++)
442 diag = src_sigma * csection;
446 max_cfl = std::max(max_cfl, fabs(diag));
449 {- src_sigma * ele->
measure() * csection});
471 std::stringstream ss;
497 bool cfl_changed =
false;
505 DebugOut() <<
"CFL changed - flow.\n";
512 DebugOut() <<
"CFL changed - mass matrix.\n";
522 DebugOut() <<
"CFL changed - source.\n";
530 VecCreateMPI(PETSC_COMM_WORLD,
el_ds->
lsize(),PETSC_DETERMINE, &cfl);
583 DebugOut() <<
"SRC - rescale dt.\n";
617 for (
unsigned int sbi = 0; sbi <
n_substances(); sbi++) {
688 for (
unsigned int loc_el = 0; loc_el <
el_ds->
lsize(); loc_el++) {
730 double flux, flux2, edg_flux;
734 for (
unsigned int loc_el = 0; loc_el <
el_ds->
lsize(); loc_el++) {
741 if (elm->side(si)->cond() == NULL) {
742 edg = elm->side(si)->edge();
744 for(
int s=0; s < edg->
n_sides; s++) {
746 if ( flux2 > 0) edg_flux+= flux2;
751 if (edg->
side(s) != elm->side(si)) {
756 if ( flux2 > 0.0 && flux <0.0)
757 aij = -(flux * flux2 / ( edg_flux * elm->measure() ) );
759 MatSetValue(
tm, new_i, new_j, aij, INSERT_VALUES);
763 aii -= (flux / elm->measure() );
774 if (flux > 0.0) aij = flux / elm->measure();
776 MatSetValue(
tm, new_i, new_j, aij, INSERT_VALUES);
781 aii -= (-flux) / elm->measure();
782 aij = (-flux) / el2->measure();
784 MatSetValue(
tm, new_j, new_i, aij, INSERT_VALUES);
787 MatSetValue(
tm, new_i, new_i, aii, INSERT_VALUES);
793 MatAssemblyBegin(
tm, MAT_FINAL_ASSEMBLY);
794 MatAssemblyEnd(
tm, MAT_FINAL_ASSEMBLY);
831 el_distribution_out = this->
el_ds;
void output_type(OutputTime::DiscreteSpace rt)
unsigned int size() const
get global size
void set_input_list(Input::Array input_list)
int IdxInt
Define integers that are indices into large arrays (elements, nodes, dofs etc.)
static auto subdomain(Mesh &mesh) -> IndexField
std::vector< VectorSeqDouble > out_conc
bool is_mass_diag_changed
Flag indicates that porosity or cross_section changed during last time.
double measure() const
Computes the measure of the element.
double time_changed() const
void update_solution() override
double end_time() const
End time.
double transport_matrix_time
void get_par_info(IdxInt *&el_4_loc, Distribution *&el_ds) override
Return array of indices of local elements and parallel distribution of elements.
const std::vector< std::string > & names()
#define FOR_EDGE_SIDES(i, j)
#define FOR_ELEMENTS(_mesh_, __i)
void alloc_transport_vectors()
unsigned int n_substances() override
Returns number of transported substances.
void output(TimeStep step)
double fix_dt_until_mark()
Fixing time step until fixed time mark.
IdxInt * get_el_4_loc() const
MultiField< 3, FieldValue< 3 >::Scalar > conc_mobile
Calculated concentrations in the mobile zone.
void create_mass_matrix()
void next_time()
Proceed to the next time according to current estimated time step.
void initialize() override
std::shared_ptr< OutputTime > output_stream_
TimeMark::Type target_mark_type
TimeMark type for time marks denoting end of every time interval where transport matrix remains const...
void set_initial_condition()
double transport_bc_time
Time of the last update of the boundary condition terms.
MultiField< 3, FieldValue< 3 >::Scalar > sources_density
Concentration sources - density of substance source, only positive part is used.
void set_boundary_conditions()
RegionSet get_region_set(const string &set_name) const
#define ELEMENT_FULL_ITER(_mesh_, i)
Fields computed from the mesh data.
EquationOutput output_fields
Fields indended for output, i.e. all input fields plus those representing solution.
#define FOR_ELEMENT_SIDES(i, j)
MultiField< 3, FieldValue< 3 >::Scalar > sources_conc
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_conc
const RegionDB & region_db() const
void set_balance_object(std::shared_ptr< Balance > balance) override
ElementAccessor< 3 > element_accessor(unsigned int idx, bool boundary=false)
double ** conc
Concentrations for phase, substance, element.
const TimeStep & step(int index=-1) const
virtual ~ConvectionTransport()
static Input::Type::Abstract & get_input_type()
Common specification of the input record for secondary equations.
MultiField< 3, FieldValue< 3 >::Scalar > init_conc
Initial concentrations.
#define ADD_FIELD(name,...)
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
void zero_time_step() override
static TimeMarks & marks()
void output_vector_gather()
Basic time management class.
const Input::Record input_rec
Record with input specification.
static constexpr bool value
const string _equation_name
const MH_DofHandler * mh_dh
static const Input::Type::Record & get_input_type()
unsigned int n_elements() const
bool is_local(unsigned int idx) const
identify local index
static constexpr Mask equation_result
Match result fields. These are never given by input or copy of input.
TimeMark::Type equation_fixed_mark_type() const
MultiField< 3, FieldValue< 3 >::Scalar > sources_sigma
Concentration sources - Robin type, in_flux = sources_sigma * (sources_conc - mobile_conc) ...
static constexpr Mask equation_external_output
Match an output field, that can be also copy of other field.
unsigned int begin(int proc) const
get starting local index
static auto region_id(Mesh &mesh) -> IndexField
ConvectionTransport(Mesh &init_mesh, const Input::Record in_rec)
static const int registrar
Registrar of class to factory.
bool is_changed_dt() const
#define START_TIMER(tag)
Starts a timer with specified tag.
SubstanceList substances_
Transported substances.
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm) const
double ** get_concentration_matrix() override
Getter for array of concentrations per element.
Field< 3, FieldValue< 3 >::Scalar > porosity
Mobile porosity - usually saturated water content in the case of unsaturated flow model...
std::shared_ptr< Balance > balance_
object for calculation and writing the mass balance to file.
vector< unsigned int > subst_idx
List of indices used to call balance methods for a set of quantities.
Distribution * get_el_ds() const
Field< 3, FieldValue< 3 >::Scalar > water_content
Water content - result of unsaturated water flow model or porosity.
Vec * vconc
Concentration vectors for mobile phase.
void mark_input_times(const TimeGovernor &tg)
TimeMark add(const TimeMark &mark)
Field< 3, FieldValue< 3 >::Integer > region_id
void create_transport_matrix_mpi()
Support classes for parallel programing.
void alloc_transport_structs_mpi()
int set_upper_constraint(double upper, std::string message)
Sets upper constraint for the next time step estimating.
double side_flux(const Side &side) const
temporary replacement for DofHandler accessor, flux through given side
bool is_convection_matrix_scaled
FLOW123D_FORCE_LINK_IN_CHILD(convectionTransport)
IdxInt * get_row_4_el() override
Return global array of order of elements within parallel vector.
#define ELEMENT_FULL_ITER_NULL(_mesh_)
void initialize(std::shared_ptr< OutputTime > stream, Mesh *mesh, Input::Record in_rec, const TimeGovernor &tg)
void set_components(const std::vector< string > &names)
ElementFullIter element() const
void compute_concentration_sources()
Assembles concentration sources for each substance. note: the source of concentration is multiplied b...
bool evaluate_time_constraint(double &time_constraint) override
VecScatter vconc_out_scatter
Vec vcfl_flow_
Parallel vector for flow contribution to CFL condition.
arma::vec3 centre() const
Computes the barycenter.
void set_target_time(double target_time) override
virtual void output_data() override
Write computed fields.
bool set_time(const TimeStep &time, LimitSide limit_side)
Distributed sparse graphs, partitioning.
Vec vcfl_source_
Parallel vector for source term contribution to CFL condition.
unsigned int bulk_idx() const
Returns index of the region in the bulk set.
#define WarningOut()
Macro defining 'warning' record of log.
FieldCommon & name(const string &name)
#define END_TIMER(tag)
Ends a timer with specified tag.
arma::vec::fixed< spacedim > centre() const
#define OLD_ASSERT_EQUAL(a, b)
#define FOR_ELM_NEIGHS_VB(i, j)
ElementAccessor< 3 > element_accessor() const
Gets ElementAccessor of this element.
double ** cumulative_corr
void set_mesh(const Mesh &mesh)
Class used for marking specified times at which some events occur.
FieldCommon & flags(FieldFlag::Flags::Mask mask)
Field< 3, FieldValue< 3 >::Scalar > cross_section
Pointer to DarcyFlow field cross_section.
Class for representation SI units of Fields.
Field< 3, FieldValue< 3 >::Integer > subdomain
#define MPI_Barrier(comm)
static UnitSI & dimensionless()
Returns dimensionless unit.
#define DebugOut()
Macro defining 'debug' record of log.
static bool print_message_table(ostream &stream, std::string equation_name)
Other possible transformation of coordinates:
SideIter side(const unsigned int i) const
IdxInt * get_row_4_el() const
ElementAccessor< 3 > element_accessor()
void make_transport_partitioning()
double cfl_max_step
Time step constraint coming from CFL condition.
ElementVector element
Vector of elements of the mesh.
unsigned int lsize(int proc) const
get local size