18 #ifndef ASSEMBLY_CONVECTION_HH_
19 #define ASSEMBLY_CONVECTION_HH_
34 template <
unsigned int dim>
41 static constexpr
const char *
name() {
return "MassAssemblyConvection"; }
63 ASSERT_EQ(cell.
dim(), dim).error(
"Dimension of element mismatch!");
70 auto p = *( this->
bulk_points(element_patch_idx).begin() );
82 VecZeroEntries(eq_data_->mass_diag);
83 eq_data_->balance_->start_mass_assembly(eq_data_->subst_idx);
89 eq_data_->balance_->finish_mass_assembly(eq_data_->subst_idx);
91 VecAssemblyBegin(eq_data_->mass_diag);
92 VecAssemblyEnd(eq_data_->mass_diag);
94 eq_data_->is_mass_diag_changed =
true;
98 shared_ptr<FiniteElement<dim>>
fe_;
107 template <
template<
IntDim...>
class DimAssembly>
117 template <
unsigned int dim>
124 static constexpr
const char *
name() {
return "InitCondAssemblyConvection"; }
148 ASSERT_EQ(cell.
dim(), dim).error(
"Dimension of element mismatch!");
151 auto p = *( this->
bulk_points(element_patch_idx).begin() );
159 shared_ptr<FiniteElement<dim>>
fe_;
170 template <
template<
IntDim...>
class DimAssembly>
182 template <
unsigned int dim>
189 static constexpr
const char *
name() {
return "ConcSourcesBdrAssemblyConvection"; }
210 fe_ = std::make_shared< FE_P_disc<dim> >(0);
219 ASSERT_EQ(cell.
dim(), dim).error(
"Dimension of element mismatch!");
230 auto p = *( this->
bulk_points(element_patch_idx).begin() );
242 max_cfl = std::max(max_cfl, fabs(diag));
245 {- eq_fields_->sources_sigma[sbi](p) * elm.measure() * eq_fields_->cross_section(p)},
246 {source * elm.measure()});
255 ASSERT_EQ(cell_side.
dim(), dim).error(
"Dimension of element mismatch!");
281 {local_p0_dof}, {0.0}, flux*
value);
289 {local_p0_dof}, {flux}, 0.0);
325 shared_ptr<FiniteElement<dim>>
fe_;
336 template <
template<
IntDim...>
class DimAssembly>
357 template <
unsigned int dim>
364 static constexpr
const char *
name() {
return "MatrixMpiAssemblyConvection"; }
380 fe_ = std::make_shared< FE_P_disc<dim> >(0);
399 ASSERT_EQ(edge_side_range.
begin()->element().dim(), dim).error(
"Dimension of element mismatch!");
401 unsigned int sid=0, s1, s2, i_col;
409 auto p = *( this->
edge_points(edge_side).begin() );
418 unsigned int n_edge_sides = edge_side_range.
begin()->n_edge_sides();
419 if (n_edge_sides<2)
return;
420 for( s1=0; s1<n_edge_sides; s1++ )
422 for( s2=0, i_col=0; s2<n_edge_sides; s2++ )
424 if (s2==s1)
continue;
438 if (dim == 1)
return;
439 ASSERT_EQ(cell_lower_dim.
dim(), dim-1).error(
"Dimension of element mismatch!");
480 MatAssemblyBegin(
eq_data_->
tm, MAT_FINAL_ASSEMBLY);
481 MatAssemblyEnd(
eq_data_->
tm, MAT_FINAL_ASSEMBLY);
490 shared_ptr<FiniteElement<dim>>
fe_;
511 template <
template<
IntDim...>
class DimAssembly>
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
Range< BulkPoint > bulk_points(unsigned int element_patch_idx) const
Return BulkPoint range of appropriate dimension.
Range< EdgePoint > edge_points(const DHCellSide &cell_side) const
Return EdgePoint range of appropriate dimension.
Quadrature * quad_low_
Quadrature used in assembling methods (dim-1).
Range< CouplingPoint > coupling_points(const DHCellSide &cell_side) const
Return CouplingPoint range of appropriate dimension.
int active_integrals_
Holds mask of active integrals.
Range< BoundaryPoint > boundary_points(const DHCellSide &cell_side) const
Return BoundaryPoint range of appropriate dimension.
ElementCacheMap * element_cache_map_
ElementCacheMap shared with GenericAssembly object.
ElementAccessor< 3 > element_accessor()
FEValues< 3 > fe_values_side_
FEValues of object (of P disc finite element type)
~ConcSourcesBdrAssemblyConvection()
Destructor.
ConcSourcesBdrAssemblyConvection(EqFields *eq_fields, EqData *eq_data)
Constructor.
EqFields * eq_fields_
Data objects shared with ConvectionTransport.
void end() override
Implements AssemblyBase::end.
FieldSet used_fields_
Sub field set contains fields used in calculation.
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
ConvectionTransport::EqData EqData
void boundary_side_integral(DHCellSide cell_side)
Assembles the fluxes on the boundary.
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
static constexpr const char * name()
void begin() override
Implements AssemblyBase::begin.
ConvectionTransport::EqFields EqFields
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Assemble integral over element.
bool sources_changed_
Flag indicates that sources part of equation was changed during last time.
bool is_convection_matrix_scaled
Flag indicates the state of object.
Vec * bcvcorr
Boundary condition correction vector.
VectorMPI cfl_source_
Parallel vector for source term contribution to CFL condition.
std::shared_ptr< Balance > balance_
object for calculation and writing the mass balance to file, shared with EquationBase.
VectorMPI cfl_flow_
Parallel vector for flow contribution to CFL condition.
unsigned int max_edg_sides
Maximal number of edge sides (evaluate from dim 1,2,3)
double transport_bc_time
Time of the last update of the boundary condition terms.
unsigned int n_substances()
Returns number of transported substances.
double transport_matrix_time
vector< VectorMPI > tm_diag
additions to PETSC transport matrix on the diagonal - from sources (for each substance)
Mat tm
PETSc transport matrix.
vector< VectorMPI > corr_vec
vector< unsigned int > subst_idx
List of indices used to call balance methods for a set of quantities.
std::shared_ptr< DOFHandlerMultiDim > dh_
MultiField< 3, FieldValue< 3 >::Scalar > init_conc
Initial concentrations.
FieldFEScalarVec conc_mobile_fe
Underlaying FieldFE for each substance of conc_mobile.
double side_flux(SidePoint &side_p, FEValues< 3 > &fe_side_values)
Calculate flux on given side point.
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_conc
Cell accessor allow iterate over DOF handler cells.
bool is_own() const
Return true if accessor represents own element (false for ghost element)
LocDofVec get_loc_dof_indices() const
Returns the local indices of dofs associated to the cell on the local process.
unsigned int get_dof_indices(std::vector< LongIdx > &indices) const
Fill vector of the global indices of dofs associated to the cell.
unsigned int dim() const
Return dimension of element appropriate to cell.
ElementAccessor< 3 > elm() const
Return ElementAccessor to element of loc_ele_idx_.
unsigned int local_idx() const
Return local index to element (index of DOF handler).
Side accessor allows to iterate over sides of DOF handler cell.
Side side() const
Return Side of given cell and side_idx.
const DHCellAccessor & cell() const
Return DHCellAccessor appropriate to the side.
unsigned int dim() const
Return dimension of element appropriate to the side.
ElementAccessor< 3 > element() const
double measure() const
Computes the measure of the element.
Directing class of FieldValueCache.
void initialize(Quadrature &_quadrature, FiniteElement< DIM > &_fe, UpdateFlags _flags)
Initialize structures and calculates cell-independent data.
void reinit(const ElementAccessor< spacedim > &cell)
Update cell-dependent data (gradients, Jacobians etc.)
Container for various descendants of FieldCommonBase.
Generic class of assemblation.
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Assemble integral over element.
InitCondAssemblyConvection(EqFields *eq_fields, EqData *eq_data)
Constructor.
ConvectionTransport::EqFields EqFields
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
ConvectionTransport::EqData EqData
std::vector< VectorMPI > vecs_
Set of data vectors of conc_mobile_fe objects.
~InitCondAssemblyConvection()
Destructor.
FieldSet used_fields_
Sub field set contains fields used in calculation.
EqFields * eq_fields_
Data objects shared with TransportDG.
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
static constexpr const char * name()
EqFields * eq_fields_
Data objects shared with TransportDG.
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Assemble integral over element.
void end() override
Implements AssemblyBase::end.
void begin() override
Implements AssemblyBase::begin.
~MassAssemblyConvection()
Destructor.
FieldSet used_fields_
Sub field set contains fields used in calculation.
MassAssemblyConvection(EqFields *eq_fields, EqData *eq_data)
Constructor.
static constexpr const char * name()
ConvectionTransport::EqFields EqFields
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
ConvectionTransport::EqData EqData
~MatrixMpiAssemblyConvection()
Destructor.
ConvectionTransport::EqFields EqFields
vector< LongIdx > dof_indices_i_
static constexpr const char * name()
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
std::vector< LongIdx > side_dofs_
void edge_integral(RangeConvert< DHEdgeSide, DHCellSide > edge_side_range)
Assembles the fluxes between sides of elements of the same dimension.
std::vector< LongIdx > all_elem_dofs_
MatrixMpiAssemblyConvection(EqFields *eq_fields, EqData *eq_data)
Constructor.
std::vector< double > elm_meassures_
ConvectionTransport::EqData EqData
std::vector< double > row_values_
void end() override
Implements AssemblyBase::end.
std::vector< double > side_flux_
EqFields * eq_fields_
Data objects shared with ConvectionTransport.
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
void begin() override
Implements AssemblyBase::begin.
void dimjoin_intergral(DHCellAccessor cell_lower_dim, DHCellSide neighb_side)
Assembles the fluxes between elements of different dimensions.
vector< FEValues< 3 > > fe_values_vec_
Vector of FEValues of object (of P disc finite element types)
FEValues< 3 > fe_values_side_
FEValues of object (of P disc finite element type)
vector< LongIdx > dof_indices_j_
Global DOF indices.
FieldSet used_fields_
Sub field set contains fields used in calculation.
IterConvert< ObjectIn, ObjectOut > begin()
Iterator to begin item of range.
unsigned int bulk_idx() const
Returns index of the region in the bulk set.
Field< 3, FieldValue< 3 >::Scalar > water_content
Water content - result of unsaturated water flow model or porosity.
MultiField< 3, FieldValue< 3 >::Scalar > sources_sigma
Concentration sources - Robin type, in_flux = sources_sigma * (sources_conc - mobile_conc)
MultiField< 3, FieldValue< 3 >::Scalar > sources_conc
MultiField< 3, FieldValue< 3 >::Scalar > sources_density
Concentration sources - density of substance source, only positive part is used.
Field< 3, FieldValue< 3 >::VectorFixed > flow_flux
Flow flux, can be result of water flow model.
Field< 3, FieldValue< 3 >::Scalar > cross_section
Pointer to DarcyFlow field cross_section.
void add_global(unsigned int pos, double val)
Add value to item on given global position.
double get(unsigned int pos) const
Return value on given position.
void set(unsigned int pos, double val)
Set value on given position.
Vec & petsc_vec()
Getter for PETSC vector of output data (e.g. can be used by scatters).
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,...
int LongIdx
Define type that represents indices of large arrays (elements, nodes, dofs etc.)
static constexpr bool value
unsigned int IntDim
A dimension index type.
Definitions of particular quadrature rules on simplices.
UpdateFlags
Enum type UpdateFlags indicates which quantities are to be recomputed on each finite element cell.
@ update_values
Shape function values.
@ update_normal_vectors
Normal vectors.
@ update_side_JxW_values
Transformed quadrature weight for cell sides.
@ update_quadrature_points
Transformed quadrature points.