18 #ifndef ASSEMBLY_DG_HH_ 19 #define ASSEMBLY_DG_HH_ 35 template <
unsigned int dim,
class Model>
42 static constexpr
const char *
name() {
return "MassAssemblyDG"; }
84 for (
unsigned int sbi=0; sbi<
eq_data_->n_substances(); ++sbi)
87 for (
unsigned int i=0; i<
ndofs_; i++)
89 for (
unsigned int j=0; j<
ndofs_; j++)
93 for (
auto p : this->
bulk_points(element_patch_idx) )
102 for (
unsigned int i=0; i<
ndofs_; i++)
107 for (
auto p : this->
bulk_points(element_patch_idx) )
136 shared_ptr<FiniteElement<dim>>
fe_;
153 template <
template<
IntDim...>
class DimAssembly>
162 template <
unsigned int dim,
class Model>
169 static constexpr
const char *
name() {
return "StiffnessAssemblyDG"; }
187 for (
auto a : averages)
if (a !=
nullptr)
delete[] a;
188 for (
auto a : waverages)
if (a !=
nullptr)
delete[] a;
189 for (
auto a : jumps)
if (a !=
nullptr)
delete[] a;
202 fe_values_vb_.initialize(*this->
quad_low_, *fe_low_, u);
204 fe_values_side_.initialize(*this->
quad_low_, *
fe_, u_side);
212 side_dof_indices_vb_.resize(2*
ndofs_);
226 fv_sb_[0] = &fe_values_vb_;
227 fv_sb_[1] = &fe_values_side_;
231 averages[s] =
new double[qsize_lower_dim_*
fe_->n_dofs()];
234 for (
unsigned int s=0; s<2; s++)
236 waverages[s] =
new double[qsize_lower_dim_*
fe_->n_dofs()];
237 jumps[s] =
new double[qsize_lower_dim_*
fe_->n_dofs()];
246 if (!cell.
is_own())
return;
255 for (
unsigned int sbi=0; sbi<
eq_data_->n_substances(); sbi++)
257 for (
unsigned int i=0; i<
ndofs_; i++)
258 for (
unsigned int j=0; j<
ndofs_; j++)
262 for (
auto p : this->
bulk_points(element_patch_idx) )
264 for (
unsigned int i=0; i<
ndofs_; i++)
269 for (
unsigned int j=0; j<
ndofs_; j++)
284 ASSERT_EQ_DBG(cell_side.
dim(), dim).error(
"Dimension of element mismatch!");
291 fe_values_side_.reinit(side);
295 for (
unsigned int sbi=0; sbi<
eq_data_->n_substances(); sbi++)
301 double side_flux = 0;
304 side_flux += arma::dot(
eq_fields_->advection_coef[sbi](p), fe_values_side_.normal_vector(k))*fe_values_side_.JxW(k);
307 double transport_flux = side_flux/side.
measure();
311 unsigned int bc_type =
eq_fields_->bc_type[sbi](p_bdr);
322 transport_flux += gamma_l;
329 double flux_times_JxW;
334 flux_times_JxW =
eq_fields_->cross_section(p)*
eq_fields_->bc_robin_sigma[sbi](p_bdr)*fe_values_side_.JxW(k);
339 flux_times_JxW = (transport_flux +
eq_fields_->cross_section(p)*
eq_fields_->bc_robin_sigma[sbi](p_bdr))*fe_values_side_.JxW(k);
344 flux_times_JxW = transport_flux*fe_values_side_.JxW(k);
346 for (
unsigned int i=0; i<
ndofs_; i++)
348 for (
unsigned int j=0; j<
ndofs_; j++)
351 local_matrix_[i*ndofs_+j] += flux_times_JxW*fe_values_side_.shape_value(i,k)*fe_values_side_.shape_value(j,k);
355 local_matrix_[i*ndofs_+j] -= (arma::dot(
eq_fields_->diffusion_coef[sbi](p)*fe_values_side_.shape_grad(j,k),fe_values_side_.normal_vector(k))*fe_values_side_.shape_value(i,k)
356 + arma::dot(
eq_fields_->diffusion_coef[sbi](p)*fe_values_side_.shape_grad(i,k),fe_values_side_.normal_vector(k))*fe_values_side_.shape_value(j,k)*
eq_data_->
dg_variant 357 )*fe_values_side_.JxW(k);
373 double gamma_l, omega[2], transport_flux, delta[2], delta_sum;
374 double aniso1, aniso2;
375 double local_alpha=0.0;
379 auto dh_edge_cell =
eq_data_->
dh_->cell_accessor_from_element( edge_side.elem_idx() );
380 dh_edge_cell.get_dof_indices(side_dof_indices_[sid]);
381 fe_values_vec_[sid].reinit(edge_side.side());
384 arma::vec3 normal_vector = fe_values_vec_[0].normal_vector(0);
387 for (
unsigned int sbi=0; sbi<
eq_data_->n_substances(); sbi++)
390 double pflux = 0, nflux = 0;
397 fluxes[sid] += arma::dot(
eq_fields_->advection_coef[sbi](p), fe_values_vec_[sid].normal_vector(k))*fe_values_vec_[sid].JxW(k);
400 fluxes[sid] /= edge_side.measure();
402 pflux += fluxes[sid];
404 nflux += fluxes[sid];
413 for (
unsigned int k=0; k<qsize_lower_dim_; k++)
415 for (
unsigned int i=0; i<
fe_->n_dofs(); i++)
416 averages[s1][k*
fe_->n_dofs()+i] = fe_values_vec_[s1].shape_value(i,k)*0.5;
424 for(
DHCellSide edge_side1 : edge_side_range )
427 for(
DHCellSide edge_side2 : edge_side_range )
430 if (s2<=s1)
continue;
431 ASSERT(edge_side1.is_valid()).error(
"Invalid side of edge.");
433 arma::vec3 nv = fe_values_vec_[s1].normal_vector(0);
437 if (fluxes[s2] > 0 && fluxes[s1] < 0)
438 transport_flux = fluxes[s1]*fabs(fluxes[s2]/pflux);
439 else if (fluxes[s2] < 0 && fluxes[s1] > 0)
440 transport_flux = fluxes[s1]*fabs(fluxes[s2]/nflux);
444 gamma_l = 0.5*fabs(transport_flux);
450 auto p2 = p1.point_on(edge_side2);
451 delta[0] += dot(
eq_fields_->diffusion_coef[sbi](p1)*normal_vector,normal_vector);
452 delta[1] += dot(
eq_fields_->diffusion_coef[sbi](p2)*normal_vector,normal_vector);
455 delta[0] /= qsize_lower_dim_;
456 delta[1] /= qsize_lower_dim_;
458 delta_sum = delta[0] + delta[1];
461 if (fabs(delta_sum) > 0)
463 omega[0] = delta[1]/delta_sum;
464 omega[1] = delta[0]/delta_sum;
465 double h = edge_side1.diameter();
468 gamma_l += local_alpha/h*aniso1*aniso2*(delta[0]*delta[1]/delta_sum);
471 for (
int i=0; i<2; i++) omega[i] = 0;
474 int sd[2];
bool is_side_own[2];
475 sd[0] = s1; is_side_own[0] = edge_side1.cell().is_own();
476 sd[1] = s2; is_side_own[1] = edge_side2.cell().is_own();
482 auto p2 = p1.point_on(edge_side2);
483 for (
unsigned int i=0; i<
fe_->n_dofs(); i++)
485 for (
int n=0; n<2; n++)
487 jumps[n][k*
fe_->n_dofs()+i] = (n==0)*fe_values_vec_[s1].shape_value(i,k) - (n==1)*fe_values_vec_[s2].shape_value(i,k);
488 waverages[n][k*
fe_->n_dofs()+i] = arma::dot(
eq_fields_->diffusion_coef[sbi]( (n==0 ? p1 : p2) )*fe_values_vec_[sd[n]].shape_grad(i,k),nv)*omega[n];
495 for (
int n=0; n<2; n++)
497 if (!is_side_own[n])
continue;
499 for (
int m=0; m<2; m++)
501 for (
unsigned int i=0; i<fe_values_vec_[sd[n]].n_dofs(); i++)
502 for (
unsigned int j=0; j<fe_values_vec_[sd[m]].n_dofs(); j++)
507 for (
unsigned int i=0; i<fe_values_vec_[sd[n]].n_dofs(); i++)
509 for (
unsigned int j=0; j<fe_values_vec_[sd[m]].n_dofs(); j++)
511 int index = i*fe_values_vec_[sd[m]].n_dofs()+j;
515 transport_flux*jumps[n][k*
fe_->n_dofs()+i]*averages[sd[m]][k*
fe_->n_dofs()+j]
518 + gamma_l*jumps[n][k*
fe_->n_dofs()+i]*jumps[m][k*
fe_->n_dofs()+j]
521 - jumps[n][k*
fe_->n_dofs()+i]*waverages[m][k*
fe_->n_dofs()+j]
523 )*fe_values_vec_[0].JxW(k);
527 eq_data_->
ls[sbi]->
mat_set_values(fe_values_vec_[sd[n]].n_dofs(), &(side_dof_indices_[sd[n]][0]), fe_values_vec_[sd[m]].n_dofs(), &(side_dof_indices_[sd[m]][0]), &(
local_matrix_[0]));
539 if (dim == 1)
return;
540 ASSERT_EQ_DBG(cell_lower_dim.
dim(), dim-1).error(
"Dimension of element mismatch!");
544 double comm_flux[2][2];
545 unsigned int n_dofs[2];
548 for(
unsigned int i=0; i<n_indices; ++i) {
551 fe_values_vb_.reinit(elm_lower_dim);
552 n_dofs[0] = fv_sb_[0]->n_dofs();
556 for(
unsigned int i=0; i<n_indices; ++i) {
559 fe_values_side_.reinit(neighb_side.
side());
560 n_dofs[1] = fv_sb_[1]->n_dofs();
563 bool own_element_id[2];
564 own_element_id[0] = cell_lower_dim.
is_own();
565 own_element_id[1] = cell_higher_dim.
is_own();
568 for (
unsigned int sbi=0; sbi<
eq_data_->n_substances(); sbi++)
570 for (
unsigned int i=0; i<n_dofs[0]+n_dofs[1]; i++)
571 for (
unsigned int j=0; j<n_dofs[0]+n_dofs[1]; j++)
578 auto p_low = p_high.lower_dim(cell_lower_dim);
586 double sigma =
eq_fields_->
fracture_sigma[sbi](p_low)*arma::dot(
eq_fields_->diffusion_coef[sbi](p_low)*fe_values_side_.normal_vector(k),fe_values_side_.normal_vector(k))*
589 double transport_flux = arma::dot(
eq_fields_->advection_coef[sbi](p_high), fe_values_side_.normal_vector(k));
591 comm_flux[0][0] = (sigma-min(0.,transport_flux))*fv_sb_[0]->JxW(k);
592 comm_flux[0][1] = -(sigma-min(0.,transport_flux))*fv_sb_[0]->JxW(k);
593 comm_flux[1][0] = -(sigma+max(0.,transport_flux))*fv_sb_[0]->JxW(k);
594 comm_flux[1][1] = (sigma+max(0.,transport_flux))*fv_sb_[0]->JxW(k);
596 for (
int n=0; n<2; n++)
598 if (!own_element_id[n])
continue;
600 for (
unsigned int i=0; i<n_dofs[n]; i++)
601 for (
int m=0; m<2; m++)
602 for (
unsigned int j=0; j<n_dofs[m]; j++)
603 local_matrix_[(i+n*n_dofs[0])*(n_dofs[0]+n_dofs[1]) + m*n_dofs[0] + j] +=
604 comm_flux[m][n]*fv_sb_[m]->shape_value(j,k)*fv_sb_[n]->shape_value(i,k);
614 shared_ptr<FiniteElement<dim>>
fe_;
641 template <
template<
IntDim...>
class DimAssembly>
650 template <
unsigned int dim,
class Model>
657 static constexpr
const char *
name() {
return "SourcesAssemblyDG"; }
682 local_rhs_.resize(
ndofs_);
683 local_source_balance_vector_.resize(
ndofs_);
684 local_source_balance_rhs_.resize(
ndofs_);
701 for (
unsigned int sbi=0; sbi<
eq_data_->n_substances(); sbi++)
703 fill_n( &(local_rhs_[0]),
ndofs_, 0 );
704 local_source_balance_vector_.assign(
ndofs_, 0);
705 local_source_balance_rhs_.assign(
ndofs_, 0);
708 for (
auto p : this->
bulk_points(element_patch_idx) )
712 for (
unsigned int i=0; i<
ndofs_; i++)
718 for (
unsigned int i=0; i<
ndofs_; i++)
721 for (
auto p : this->
bulk_points(element_patch_idx) )
727 local_source_balance_rhs_[i] += local_rhs_[i];
731 local_source_balance_vector_, local_source_balance_rhs_);
749 shared_ptr<FiniteElement<dim>>
fe_;
766 template <
template<
IntDim...>
class DimAssembly>
775 template <
unsigned int dim,
class Model>
782 static constexpr
const char *
name() {
return "BdrConditionAssemblyDG"; }
811 local_rhs_.resize(
ndofs_);
812 local_flux_balance_vector_.resize(
ndofs_);
821 const unsigned int cond_idx = cell_side.
side().
cond_idx();
825 fe_values_side_.reinit(cell_side.
side());
830 for (
unsigned int sbi=0; sbi<
eq_data_->n_substances(); sbi++)
832 fill_n(&(local_rhs_[0]),
ndofs_, 0);
833 local_flux_balance_vector_.assign(
ndofs_, 0);
834 local_flux_balance_rhs_ = 0;
836 double side_flux = 0;
839 side_flux += arma::dot(
eq_fields_->advection_coef[sbi](p), fe_values_side_.normal_vector(k))*fe_values_side_.JxW(k);
842 double transport_flux = side_flux/cell_side.
measure();
846 unsigned int bc_type =
eq_fields_->bc_type[sbi](p_bdr);
852 auto p_bdr = p.point_bdr(bc_elm);
853 double bc_term = -transport_flux*
eq_fields_->bc_dirichlet_value[sbi](p_bdr)*fe_values_side_.JxW(k);
854 for (
unsigned int i=0; i<
ndofs_; i++)
855 local_rhs_[i] += bc_term*fe_values_side_.shape_value(i,k);
858 for (
unsigned int i=0; i<
ndofs_; i++)
859 local_flux_balance_rhs_ -= local_rhs_[i];
866 auto p_bdr = p.point_bdr(bc_elm);
867 double bc_term =
eq_data_->
gamma[sbi][cond_idx]*
eq_fields_->bc_dirichlet_value[sbi](p_bdr)*fe_values_side_.JxW(k);
869 for (
unsigned int i=0; i<
ndofs_; i++)
870 local_rhs_[i] += bc_term*fe_values_side_.shape_value(i,k)
871 + arma::dot(bc_grad,fe_values_side_.shape_grad(i,k));
877 for (
unsigned int i=0; i<
ndofs_; i++)
879 local_flux_balance_vector_[i] += (arma::dot(
eq_fields_->advection_coef[sbi](p), fe_values_side_.normal_vector(k))*fe_values_side_.shape_value(i,k)
880 - arma::dot(
eq_fields_->diffusion_coef[sbi](p)*fe_values_side_.shape_grad(i,k),fe_values_side_.normal_vector(k))
881 +
eq_data_->
gamma[sbi][cond_idx]*fe_values_side_.shape_value(i,k))*fe_values_side_.JxW(k);
886 for (
unsigned int i=0; i<
ndofs_; i++)
887 local_flux_balance_rhs_ -= local_rhs_[i];
894 auto p_bdr = p.point_bdr(bc_elm);
896 eq_fields_->bc_flux[sbi](p_bdr)) * fe_values_side_.JxW(k);
897 for (
unsigned int i=0; i<
ndofs_; i++)
898 local_rhs_[i] += bc_term*fe_values_side_.shape_value(i,k);
902 for (
unsigned int i=0; i<
ndofs_; i++)
906 auto p_bdr = p.point_bdr(bc_elm);
907 local_flux_balance_vector_[i] +=
eq_fields_->cross_section(p) *
eq_fields_->bc_robin_sigma[sbi](p_bdr) *
908 fe_values_side_.JxW(k) * fe_values_side_.shape_value(i,k);
911 local_flux_balance_rhs_ -= local_rhs_[i];
919 auto p_bdr = p.point_bdr(bc_elm);
921 eq_fields_->bc_flux[sbi](p_bdr)) * fe_values_side_.JxW(k);
922 for (
unsigned int i=0; i<
ndofs_; i++)
923 local_rhs_[i] += bc_term*fe_values_side_.shape_value(i,k);
927 for (
unsigned int i=0; i<
ndofs_; i++)
931 auto p_bdr = p.point_bdr(bc_elm);
932 local_flux_balance_vector_[i] +=
eq_fields_->cross_section(p)*(arma::dot(
eq_fields_->advection_coef[sbi](p), fe_values_side_.normal_vector(k)) +
933 eq_fields_->bc_robin_sigma[sbi](p_bdr))*fe_values_side_.JxW(k)*fe_values_side_.shape_value(i,k);
936 local_flux_balance_rhs_ -= local_rhs_[i];
944 for (
unsigned int i=0; i<
ndofs_; i++)
945 local_flux_balance_vector_[i] += arma::dot(
eq_fields_->advection_coef[sbi](p), fe_values_side_.normal_vector(k))*fe_values_side_.JxW(k)*fe_values_side_.shape_value(i,k);
953 local_flux_balance_vector_, local_flux_balance_rhs_);
971 shared_ptr<FiniteElement<dim>>
fe_;
988 template <
template<
IntDim...>
class DimAssembly>
997 template <
unsigned int dim,
class Model>
1004 static constexpr
const char *
name() {
return "InitConditionAssemblyDG"; }
1028 local_rhs_.resize(ndofs_);
1042 for (
unsigned int sbi=0; sbi<
eq_data_->n_substances(); sbi++)
1044 for (
unsigned int i=0; i<
ndofs_; i++)
1047 for (
unsigned int j=0; j<
ndofs_; j++)
1052 for (
auto p : this->
bulk_points(element_patch_idx) )
1056 for (
unsigned int i=0; i<
ndofs_; i++)
1058 for (
unsigned int j=0; j<
ndofs_; j++)
1071 shared_ptr<FiniteElement<dim>>
fe_;
1087 template <
template<
IntDim...>
class DimAssembly>
TransportDG< Model >::EqFields EqFields
unsigned int ndofs_
Number of dofs.
FieldSet used_fields_
Sub field set contains fields used in calculation.
UpdateFlags
Enum type UpdateFlags indicates which quantities are to be recomputed on each finite element cell...
MultiField< 3, FieldValue< 3 >::Scalar > dg_penalty
Penalty enforcing inter-element continuity of solution (for each substance).
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
Container for various descendants of FieldCommonBase.
static constexpr const char * name()
vector< PetscScalar > local_matrix_
Auxiliary vector for assemble methods.
FEValues< 3 > fe_values_
FEValues of object (of P disc finite element type)
Transformed quadrature weight for cell sides.
#define ASSERT_EQ_DBG(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Assemble integral over element.
Quadrature * quad_low_
Quadrature used in assembling methods (dim-1).
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Assembles the cell (volume) integral into the stiffness matrix.
double elem_anisotropy(ElementAccessor< 3 > e) const
Compute and return anisotropy of given element.
std::vector< std::vector< double > > gamma
Penalty parameters.
vector< LongIdx > dof_indices_
Vector of global DOF indices.
int active_integrals_
Holds mask of active integrals.
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
unsigned int dim() const
Return dimension of element appropriate to the side.
EqFields * eq_fields_
Data objects shared with TransportDG.
Range< EdgePoint > edge_points(const DHCellSide &cell_side) const
Return EdgePoint range of appropriate dimension.
unsigned int dg_order
Polynomial order of finite elements.
TransportDG< Model >::EqData EqData
unsigned int get_dof_indices(std::vector< LongIdx > &indices) const
Fill vector of the global indices of dofs associated to the cell.
unsigned int ndofs_
Number of dofs.
FEValues< 3 > fe_values_
FEValues of object (of P disc finite element type)
~InitConditionAssemblyDG()
Destructor.
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
TransportDG< Model >::EqFields EqFields
virtual void rhs_set_values(int nrow, int *rows, double *vals)=0
vector< vector< LongIdx > > side_dof_indices_
Vector of vectors of side DOF indices.
unsigned int dim() const
Return dimension of element appropriate to cell.
FieldSet used_fields_
Sub field set contains fields used in calculation.
vector< LongIdx > dof_indices_
Vector of global DOF indices.
FEValues< 3 > fe_values_vb_
FEValues of dim-1 object (of P disc finite element type)
SourcesAssemblyDG(EqFields *eq_fields, EqData *eq_data)
Constructor.
arma::vec::fixed< spacedim > shape_grad(const unsigned int function_no, const unsigned int point_no) const
Return the gradient of the function_no-th shape function at the point_no-th quadrature point...
Directing class of FieldValueCache.
vector< PetscScalar > local_matrix_
Auxiliary vector for assemble methods.
Cell accessor allow iterate over DOF handler cells.
MassAssemblyDG(EqFields *eq_fields, EqData *eq_data)
Constructor.
Class FEValues calculates finite element data on the actual cells such as shape function values...
int dg_variant
DG variant ((non-)symmetric/incomplete.
vector< LongIdx > dof_indices_
Vector of global DOF indices.
vector< PetscScalar > local_source_balance_rhs_
Auxiliary vector for set_sources method.
LocDofVec get_loc_dof_indices() const
Returns the local indices of dofs associated to the cell on the local process.
~SourcesAssemblyDG()
Destructor.
EqFields * eq_fields_
Data objects shared with TransportDG.
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
const TimeStep & step(int index=-1) const
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
std::shared_ptr< Balance > balance_
IterConvert< ObjectIn, ObjectOut > begin()
Iterator to begin item of range.
static constexpr const char * name()
bool is_own() const
Return true if accessor represents own element (false for ghost element)
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
EqFields * eq_fields_
Data objects shared with TransportDG.
FEValues< 3 > fe_values_side_
FEValues of object (of P disc finite element type)
Side side() const
Return Side of given cell and side_idx.
void reinit(const ElementAccessor< spacedim > &cell)
Update cell-dependent data (gradients, Jacobians etc.)
void end() override
Implements AssemblyBase::end.
void begin() override
Implements AssemblyBase::begin.
vector< PetscScalar > local_mass_balance_vector_
Same as previous.
void begin() override
Implements AssemblyBase::begin.
InitConditionAssemblyDG(EqFields *eq_fields, EqData *eq_data)
Constructor.
FieldSet used_fields_
Sub field set contains fields used in calculation.
Discontinuous Lagrangean finite element on dim dimensional simplex.
Transformed quadrature points.
const ElementAccessor< 3 > elm() const
Return ElementAccessor to element of loc_ele_idx_.
unsigned int max_edg_sides
Maximal number of edge sides (evaluate from dim 1,2,3)
unsigned int ndofs_
Number of dofs.
vector< double * > jumps
Auxiliary storage for jumps of shape functions.
vector< vector< arma::mat33 > > dif_coef
Diffusion coefficients.
FEValues< 3 > fe_values_
FEValues of object (of P disc finite element type)
FEValues< 3 > fe_values_side_
FEValues of object (of P disc finite element type)
void end() override
Implements AssemblyBase::end.
TransportDG< Model >::EqFields EqFields
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Assemble integral over element.
void dimjoin_intergral(DHCellAccessor cell_lower_dim, DHCellSide neighb_side)
Assembles the fluxes between elements of different dimensions.
void edge_integral(RangeConvert< DHEdgeSide, DHCellSide > edge_side_range)
Assembles the fluxes between sides of elements of the same dimension.
TransportDG< Model >::EqData EqData
vector< double * > waverages
Auxiliary storage for weighted averages of shape functions.
std::vector< Vec > ret_vec
Auxiliary vectors for calculation of sources in balance due to retardation (e.g. sorption).
vector< FEValues< 3 > * > fv_sb_
Auxiliary vector, holds FEValues objects for assemble element-side.
Range< BulkPoint > bulk_points(unsigned int element_patch_idx) const
Return BulkPoint range of appropriate dimension.
Definitions of basic Lagrangean finite elements with polynomial shape functions.
FEValues< 3 > fe_values_
FEValues of object (of P disc finite element type)
LinSys ** ls
Linear algebra system for the transport equation.
ElementAccessor< 3 > element() const
void boundary_side_integral(DHCellSide cell_side)
Assembles the fluxes on the boundary.
vector< PetscScalar > local_rhs_
Auxiliary vector for set_sources method.
void initialize(Quadrature &_quadrature, FiniteElement< DIM > &_fe, UpdateFlags _flags)
Initialize structures and calculates cell-independent data.
static constexpr const char * name()
vector< PetscScalar > local_rhs_
Auxiliary vector for set_sources method.
vector< PetscScalar > local_matrix_
Auxiliary vector for assemble methods.
void boundary_side_integral(DHCellSide cell_side)
Implements AssemblyBase::boundary_side_integral.
static constexpr const char * name()
void initialize(ElementCacheMap *element_cache_map)
Initialize auxiliary vectors and other data members.
unsigned int ndofs_
Number of dofs.
Shape function gradients.
vector< LongIdx > dof_indices_
Vector of global DOF indices.
unsigned int IntDim
A dimension index type.
StiffnessAssemblyDG(EqFields *eq_fields, EqData *eq_data)
Constructor.
void set_DG_parameters_boundary(Side side, const int K_size, const std::vector< arma::mat33 > &K, const double flux, const arma::vec3 &normal_vector, const double alpha, double &gamma)
Sets up parameters of the DG method on a given boundary edge.
double measure() const
Calculate metrics of the side.
unsigned int qsize_lower_dim_
Size of quadrature of dim-1.
FieldSet used_fields_
Sub field set contains fields used in calculation.
vector< LongIdx > dof_indices_
Vector of global DOF indices.
Discontinuous Galerkin method for equation of transport with dispersion.
FieldSet used_fields_
Sub field set contains fields used in calculation.
TransportDG< Model >::EqData EqData
PetscScalar local_flux_balance_rhs_
Auxiliary variable for set_boundary_conditions method.
const DHCellAccessor & cell() const
Return DHCellAccessor appropriate to the side.
void set_values(int nrow, int *rows, int ncol, int *cols, PetscScalar *mat_vals, PetscScalar *rhs_vals)
Set values in the system matrix and values in the right-hand side vector on corresponding rows...
unsigned int cond_idx() const
Returns global index of the prescribed boundary condition.
EqFields * eq_fields_
Data objects shared with TransportDG.
vector< LongIdx > side_dof_indices_vb_
Vector of side DOF indices (assemble element-side fluxex)
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
~BdrConditionAssemblyDG()
Destructor.
EqFields * eq_fields_
Data objects shared with TransportDG.
TransportDG< Model >::EqFields EqFields
TransportDG< Model >::EqData EqData
TransportDG< Model >::EqData EqData
void end() override
Implements AssemblyBase::end.
vector< FEValues< 3 > > fe_values_vec_
Vector of FEValues of object (of P disc finite element types)
unsigned int ndofs_
Number of dofs.
Generic class of assemblation.
MultiField< 3, FieldValue< 3 >::Scalar > fracture_sigma
Transition parameter for diffusive transfer on fractures (for each substance).
std::shared_ptr< DOFHandlerMultiDim > dh_
Object for distribution of dofs.
unsigned int bulk_idx() const
Returns index of the region in the bulk set.
Definitions of particular quadrature rules on simplices.
vector< PetscScalar > local_rhs_
Auxiliary vector for set_sources method.
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
shared_ptr< FiniteElement< dim-1 > > fe_low_
Finite element for the solution of the advection-diffusion equation (dim-1).
BdrConditionAssemblyDG(EqFields *eq_fields, EqData *eq_data)
Constructor.
static constexpr const char * name()
unsigned int index() const
void cell_integral(DHCellAccessor cell, unsigned int element_patch_idx)
Assemble integral over element.
TransportDG< Model >::EqFields EqFields
Range< CouplingPoint > coupling_points(const DHCellSide &cell_side) const
Return CouplingPoint range of appropriate dimension.
virtual void mat_set_values(int nrow, int *rows, int ncol, int *cols, double *vals)=0
vector< PetscScalar > local_flux_balance_vector_
Auxiliary vector for set_boundary_conditions method.
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
double JxW(const unsigned int point_no)
Return the product of Jacobian determinant and the quadrature weight at given quadrature point...
double shape_value(const unsigned int function_no, const unsigned int point_no) const
Return the value of the function_no-th shape function at the point_no-th quadrature point...
Range< BoundaryPoint > boundary_points(const DHCellSide &cell_side) const
Return BoundaryPoint range of appropriate dimension.
unsigned int size() const
Returns number of quadrature points.
~StiffnessAssemblyDG()
Destructor.
vector< PetscScalar > local_source_balance_vector_
Auxiliary vector for set_sources method.
vector< PetscScalar > local_retardation_balance_vector_
Auxiliary vector for assemble mass matrix.
#define DebugOut()
Macro defining 'debug' record of log.
unsigned int idx() const
Return local idx of element in boundary / bulk part of element vector.
~MassAssemblyDG()
Destructor.
LinSys ** ls_dt
Linear algebra system for the time derivative (actually it is used only for handling the matrix struc...
Quadrature * quad_
Quadrature used in assembling methods.
Side accessor allows to iterate over sides of DOF handler cell.
void begin() override
Implements AssemblyBase::begin.
ElementAccessor< 3 > element_accessor()
std::string print_update_flags(UpdateFlags u) const
Print update flags to string format.
ElementCacheMap * element_cache_map_
ElementCacheMap shared with GenericAssembly object.
Transformed quadrature weights.
vector< double * > averages
Auxiliary storage for averages of shape functions.