18 #ifndef ASSEMBLY_DG_HH_ 19 #define ASSEMBLY_DG_HH_ 46 std::array<std::shared_ptr<BulkIntegral>, 3>
bulk_;
47 std::array<std::shared_ptr<EdgeIntegral>, 3>
edge_;
48 std::array<std::shared_ptr<CouplingIntegral>, 2>
coupling_;
49 std::array<std::shared_ptr<BoundaryIntegral>, 3>
boundary_;
63 template <
template<
Dim...>
class DimAssembly>
102 : multidim_assembly_(eq_data),
103 active_integrals_(active_integrals), integrals_size_({0, 0, 0, 0})
105 eval_points_ = std::make_shared<EvalPoints>();
107 multidim_assembly_.template get<1>()->create_integrals(eval_points_, integrals_, active_integrals_);
108 multidim_assembly_.template get<2>()->create_integrals(eval_points_, integrals_, active_integrals_);
109 multidim_assembly_.template get<3>()->create_integrals(eval_points_, integrals_, active_integrals_);
110 element_cache_map_.init(eval_points_);
114 return multidim_assembly_;
127 void assemble(std::shared_ptr<DOFHandlerMultiDim> dh) {
129 multidim_assembly_.template get<1>()->begin();
130 for (
auto cell : dh->local_range() )
132 this->add_integrals_of_computing_step(cell);
136 for (i=0; i<integrals_size_[0]; ++i) {
137 switch (bulk_integral_data_[i].cell.dim()) {
139 multidim_assembly_.template get<1>()->assemble_volume_integrals(bulk_integral_data_[i].cell);
142 multidim_assembly_.template get<2>()->assemble_volume_integrals(bulk_integral_data_[i].cell);
145 multidim_assembly_.template get<3>()->assemble_volume_integrals(bulk_integral_data_[i].cell);
154 for (i=0; i<integrals_size_[3]; ++i) {
155 switch (boundary_integral_data_[i].side.dim()) {
157 multidim_assembly_.template get<1>()->assemble_fluxes_boundary(boundary_integral_data_[i].side);
160 multidim_assembly_.template get<2>()->assemble_fluxes_boundary(boundary_integral_data_[i].side);
163 multidim_assembly_.template get<3>()->assemble_fluxes_boundary(boundary_integral_data_[i].side);
172 for (i=0; i<integrals_size_[1]; ++i) {
173 switch (edge_integral_data_[i].edge_side_range.begin()->dim()) {
175 multidim_assembly_.template get<1>()->assemble_fluxes_element_element(edge_integral_data_[i].edge_side_range);
178 multidim_assembly_.template get<2>()->assemble_fluxes_element_element(edge_integral_data_[i].edge_side_range);
181 multidim_assembly_.template get<3>()->assemble_fluxes_element_element(edge_integral_data_[i].edge_side_range);
190 for (i=0; i<integrals_size_[2]; ++i) {
191 switch (coupling_integral_data_[i].side.dim()) {
193 multidim_assembly_.template get<2>()->assemble_fluxes_element_side(coupling_integral_data_[i].cell, coupling_integral_data_[i].side);
196 multidim_assembly_.template get<3>()->assemble_fluxes_element_side(coupling_integral_data_[i].cell, coupling_integral_data_[i].side);
203 multidim_assembly_.template get<1>()->end();
209 for (
unsigned int i=0; i<integrals_size_[0]; ++i) {
211 unsigned int data_size = eval_points_->subset_size( bulk_integral_data_[i].cell.dim(), bulk_integral_data_[i].subset_index );
212 element_cache_map_.mark_used_eval_points(bulk_integral_data_[i].cell, bulk_integral_data_[i].subset_index, data_size);
215 for (
unsigned int i=0; i<integrals_size_[1]; ++i) {
217 for (
DHCellSide edge_side : edge_integral_data_[i].edge_side_range) {
218 unsigned int side_dim = edge_side.dim();
219 unsigned int data_size = eval_points_->subset_size( side_dim, edge_integral_data_[i].subset_index ) / (side_dim+1);
220 unsigned int start_point = data_size * edge_side.side_idx();
221 element_cache_map_.mark_used_eval_points(edge_side.cell(), edge_integral_data_[i].subset_index, data_size, start_point);
225 for (
unsigned int i=0; i<integrals_size_[2]; ++i) {
227 unsigned int bulk_data_size = eval_points_->subset_size( coupling_integral_data_[i].cell.dim(), coupling_integral_data_[i].bulk_subset_index );
228 element_cache_map_.mark_used_eval_points(coupling_integral_data_[i].cell, coupling_integral_data_[i].bulk_subset_index, bulk_data_size);
230 unsigned int side_dim = coupling_integral_data_[i].side.dim();
231 unsigned int side_data_size = eval_points_->subset_size( side_dim, coupling_integral_data_[i].side_subset_index ) / (side_dim+1);
232 unsigned int start_point = side_data_size * coupling_integral_data_[i].side.side_idx();
233 element_cache_map_.mark_used_eval_points(coupling_integral_data_[i].side.cell(), coupling_integral_data_[i].side_subset_index, side_data_size, start_point);
236 for (
unsigned int i=0; i<integrals_size_[3]; ++i) {
238 unsigned int side_dim = boundary_integral_data_[i].side.dim();
239 unsigned int data_size = eval_points_->subset_size( side_dim, boundary_integral_data_[i].subset_index ) / (side_dim+1);
240 unsigned int start_point = data_size * boundary_integral_data_[i].side.side_idx();
241 element_cache_map_.mark_used_eval_points(boundary_integral_data_[i].side.cell(), boundary_integral_data_[i].subset_index, data_size, start_point);
251 for (
unsigned int i=0; i<4; i++) integrals_size_[i] = 0;
252 element_cache_map_.start_elements_update();
257 this->add_volume_integral(cell);
258 element_cache_map_.add(cell);
264 if ( (cell_side.side().edge().n_sides() == 1) && (cell_side.side().is_boundary()) ) {
265 this->add_boundary_integral(cell_side);
266 element_cache_map_.add(cell_side);
270 if ( (cell_side.n_edge_sides() >= 2) && (cell_side.edge_sides().begin()->element().idx() == cell.
elm_idx())) {
271 this->add_edge_integral(cell_side.edge_sides());
273 element_cache_map_.add(edge_side);
280 if (cell.
dim() != neighb_side.dim()-1)
continue;
281 this->add_coupling_integral(cell, neighb_side);
282 element_cache_map_.add(cell);
283 element_cache_map_.add(neighb_side);
286 element_cache_map_.prepare_elements_to_update();
287 this->insert_eval_points_from_integral_data();
288 element_cache_map_.create_elements_points_map();
291 element_cache_map_.finish_elements_update();
296 bulk_integral_data_[ integrals_size_[0] ].cell = cell;
297 bulk_integral_data_[ integrals_size_[0] ].subset_index = integrals_.bulk_[cell.
dim()-1]->get_subset_idx();
298 integrals_size_[0]++;
303 edge_integral_data_[ integrals_size_[1] ].edge_side_range = edge_side_range;
304 edge_integral_data_[ integrals_size_[1] ].subset_index = integrals_.edge_[edge_side_range.
begin()->
dim()-1]->get_subset_idx();
305 integrals_size_[1]++;
310 coupling_integral_data_[ integrals_size_[2] ].cell = cell;
311 coupling_integral_data_[ integrals_size_[2] ].side = ngh_side;
312 coupling_integral_data_[ integrals_size_[2] ].bulk_subset_index = integrals_.coupling_[cell.
dim()-1]->get_subset_low_idx();
313 coupling_integral_data_[ integrals_size_[2] ].side_subset_index = integrals_.coupling_[cell.
dim()-1]->get_subset_high_idx();
314 integrals_size_[2]++;
319 boundary_integral_data_[ integrals_size_[3] ].side = bdr_side;
320 boundary_integral_data_[ integrals_size_[3] ].subset_index = integrals_.boundary_[bdr_side.
dim()-1]->get_subset_idx();
321 integrals_size_[3]++;
347 template <
unsigned int dim>
353 quad_ =
new QGauss(dim, 2*quad_order);
354 quad_low_ =
new QGauss(dim-1, 2*quad_order);
384 integrals.
bulk_[dim-1] = eval_points->add_bulk<dim>(*quad_);
386 integrals.
edge_[dim-1] = eval_points->add_edge<dim>(*quad_low_);
388 integrals.
coupling_[dim-2] = eval_points->add_coupling<dim>(*quad_low_);
390 integrals.
boundary_[dim-1] = eval_points->add_boundary<dim>(*quad_low_);
402 template <
unsigned int dim,
class Model>
410 :
AssemblyBase<dim>(data->dg_order), model_(nullptr), data_(data) {}
417 this->model_ = &model;
419 fe_ = std::make_shared< FE_P_disc<dim> >(data_->dg_order);
421 ndofs_ = fe_->n_dofs();
422 qsize_ = this->quad_->size();
423 dof_indices_.resize(ndofs_);
424 local_matrix_.resize(4*ndofs_*ndofs_);
425 local_retardation_balance_vector_.resize(ndofs_);
426 local_mass_balance_vector_.resize(ndofs_);
428 mm_coef_.resize(qsize_);
429 ret_coef_.resize(model_->n_substances());
430 for (
unsigned int sbi=0; sbi<model_->n_substances(); sbi++)
432 ret_coef_[sbi].resize(qsize_);
443 fe_values_.reinit(elm);
446 model_->compute_mass_matrix_coefficient(fe_values_.point_list(), elm, mm_coef_);
447 model_->compute_retardation_coefficient(fe_values_.point_list(), elm, ret_coef_);
449 for (
unsigned int sbi=0; sbi<model_->n_substances(); ++sbi)
452 for (
unsigned int i=0; i<ndofs_; i++)
454 for (
unsigned int j=0; j<ndofs_; j++)
456 local_matrix_[i*ndofs_+j] = 0;
457 for (
unsigned int k=0; k<qsize_; k++)
458 local_matrix_[i*ndofs_+j] += (mm_coef_[k]+ret_coef_[sbi][k])*fe_values_.shape_value(j,k)*fe_values_.shape_value(i,k)*fe_values_.JxW(k);
462 for (
unsigned int i=0; i<ndofs_; i++)
464 local_mass_balance_vector_[i] = 0;
465 local_retardation_balance_vector_[i] = 0;
466 for (
unsigned int k=0; k<qsize_; k++)
468 local_mass_balance_vector_[i] += mm_coef_[k]*fe_values_.shape_value(i,k)*fe_values_.JxW(k);
469 local_retardation_balance_vector_[i] -= ret_coef_[sbi][k]*fe_values_.shape_value(i,k)*fe_values_.JxW(k);
473 model_->balance()->add_mass_values(model_->get_subst_idx()[sbi], cell, cell.
get_loc_dof_indices(),
474 local_mass_balance_vector_, 0);
476 data_->ls_dt[sbi]->mat_set_values(ndofs_, &(dof_indices_[0]), ndofs_, &(dof_indices_[0]), &(local_matrix_[0]));
477 VecSetValues(data_->ret_vec[sbi], ndofs_, &(dof_indices_[0]), &(local_retardation_balance_vector_[0]), ADD_VALUES);
484 model_->balance()->start_mass_assembly( model_->subst_idx() );
490 model_->balance()->finish_mass_assembly( model_->subst_idx() );
505 velocity.resize(point_list.
size());
506 model_->velocity_field_ptr()->value_list(point_list, cell, velocity);
509 shared_ptr<FiniteElement<dim>>
fe_;
532 template <
template<
Dim...>
class DimAssembly>
541 template <
unsigned int dim,
class Model>
549 :
AssemblyBase<dim>(data->dg_order), fe_rt_(nullptr), model_(nullptr), data_(data) {}
553 if (fe_rt_==
nullptr)
return;
561 this->model_ = &model;
563 fe_ = std::make_shared< FE_P_disc<dim> >(data_->dg_order);
564 fe_low_ = std::make_shared<
FE_P_disc<dim-1> >(data_->dg_order);
566 fe_rt_low_ =
new FE_RT0<dim-1>();
576 qsize_ = this->quad_->size();
577 qsize_lower_dim_ = this->quad_low_->size();
578 dof_indices_.resize(ndofs_);
579 side_dof_indices_vb_.resize(2*ndofs_);
580 local_matrix_.resize(4*ndofs_*ndofs_);
581 local_retardation_balance_vector_.resize(ndofs_);
582 local_mass_balance_vector_.resize(ndofs_);
583 velocity_.resize(qsize_);
584 side_velocity_vec_.resize(data_->ad_coef_edg.size());
586 sigma_.resize(qsize_lower_dim_);
587 csection_.resize(qsize_lower_dim_);
588 csection_higher_.resize(qsize_lower_dim_);
589 dg_penalty_.resize(data_->ad_coef_edg.size());
591 mm_coef_.resize(qsize_);
592 ret_coef_.resize(model_->n_substances());
593 for (
unsigned int sbi=0; sbi<model_->n_substances(); sbi++)
595 ret_coef_[sbi].resize(qsize_);
598 fe_values_vec_.resize(data_->ad_coef_edg.size());
599 for (
unsigned int sid=0; sid<data_->ad_coef_edg.size(); sid++)
602 fe_values_vec_[sid].initialize(*this->quad_low_, *fe_,
609 fv_sb_[0] = &fe_values_vb_;
610 fv_sb_[1] = &fe_values_side_;
618 if (!cell.
is_own())
return;
622 fe_values_.reinit(elm);
626 calculate_velocity(elm, velocity_, fv_rt_.point_list());
627 model_->compute_advection_diffusion_coefficients(fe_values_.point_list(), velocity_, elm, data_->ad_coef, data_->dif_coef);
628 model_->compute_sources_sigma(fe_values_.point_list(), elm, sources_sigma_);
631 for (
unsigned int sbi=0; sbi<model_->n_substances(); sbi++)
633 for (
unsigned int i=0; i<ndofs_; i++)
634 for (
unsigned int j=0; j<ndofs_; j++)
635 local_matrix_[i*ndofs_+j] = 0;
637 for (
unsigned int k=0; k<qsize_; k++)
639 for (
unsigned int i=0; i<ndofs_; i++)
641 arma::vec3 Kt_grad_i = data_->dif_coef[sbi][k].t()*fe_values_.shape_grad(i,k);
642 double ad_dot_grad_i = arma::dot(data_->ad_coef[sbi][k], fe_values_.shape_grad(i,k));
644 for (
unsigned int j=0; j<ndofs_; j++)
645 local_matrix_[i*ndofs_+j] += (arma::dot(Kt_grad_i, fe_values_.shape_grad(j,k))
646 -fe_values_.shape_value(j,k)*ad_dot_grad_i
647 +sources_sigma_[sbi][k]*fe_values_.shape_value(j,k)*fe_values_.shape_value(i,k))*fe_values_.JxW(k);
650 data_->ls[sbi]->mat_set_values(ndofs_, &(dof_indices_[0]), ndofs_, &(dof_indices_[0]), &(local_matrix_[0]));
658 ASSERT_EQ_DBG(cell_side.
dim(), dim).error(
"Dimension of element mismatch!");
666 fe_values_side_.reinit(side);
667 fsv_rt_.reinit(side);
669 calculate_velocity(elm_acc, velocity_, fsv_rt_.point_list());
670 model_->compute_advection_diffusion_coefficients(fe_values_side_.point_list(), velocity_, elm_acc, data_->ad_coef, data_->dif_coef);
673 data_->cross_section.value_list(fe_values_side_.point_list(), elm_acc, csection_);
675 for (
unsigned int sbi=0; sbi<model_->n_substances(); sbi++)
677 std::fill(local_matrix_.begin(), local_matrix_.end(), 0);
681 double side_flux = 0;
682 for (
unsigned int k=0; k<qsize_lower_dim_; k++)
683 side_flux += arma::dot(data_->ad_coef[sbi][k], fe_values_side_.normal_vector(k))*fe_values_side_.JxW(k);
684 double transport_flux = side_flux/side.
measure();
690 data_->set_DG_parameters_boundary(side, qsize_lower_dim_, data_->dif_coef[sbi], transport_flux, fe_values_side_.normal_vector(0), data_->dg_penalty[sbi].value(elm_acc.centre(), elm_acc), gamma_l);
691 data_->gamma[sbi][side.
cond_idx()] = gamma_l;
692 transport_flux += gamma_l;
696 for (
unsigned int k=0; k<qsize_lower_dim_; k++)
698 double flux_times_JxW;
702 model_->get_flux_bc_sigma(sbi, fe_values_side_.point_list(), side.
cond().
element_accessor(), sigma_);
703 flux_times_JxW = csection_[k]*sigma_[k]*fe_values_side_.JxW(k);
707 model_->get_flux_bc_sigma(sbi, fe_values_side_.point_list(), side.
cond().
element_accessor(), sigma_);
708 flux_times_JxW = (transport_flux + csection_[k]*sigma_[k])*fe_values_side_.JxW(k);
713 flux_times_JxW = transport_flux*fe_values_side_.JxW(k);
715 for (
unsigned int i=0; i<ndofs_; i++)
717 for (
unsigned int j=0; j<ndofs_; j++)
720 local_matrix_[i*ndofs_+j] += flux_times_JxW*fe_values_side_.shape_value(i,k)*fe_values_side_.shape_value(j,k);
724 local_matrix_[i*ndofs_+j] -= (arma::dot(data_->dif_coef[sbi][k]*fe_values_side_.shape_grad(j,k),fe_values_side_.normal_vector(k))*fe_values_side_.shape_value(i,k)
725 + arma::dot(data_->dif_coef[sbi][k]*fe_values_side_.shape_grad(i,k),fe_values_side_.normal_vector(k))*fe_values_side_.shape_value(j,k)*data_->dg_variant
726 )*fe_values_side_.JxW(k);
731 data_->ls[sbi]->mat_set_values(ndofs_, &(dof_indices_[0]), ndofs_, &(dof_indices_[0]), &(local_matrix_[0]));
743 auto dh_edge_cell = data_->dh_->cell_accessor_from_element( edge_side.elem_idx() );
745 dh_edge_cell.get_dof_indices(side_dof_indices_[sid]);
746 fe_values_vec_[sid].reinit(edge_side.side());
747 fsv_rt_.reinit(edge_side.side());
748 calculate_velocity(edg_elm, side_velocity_vec_[sid], fsv_rt_.point_list());
749 model_->compute_advection_diffusion_coefficients(fe_values_vec_[sid].point_list(), side_velocity_vec_[sid], edg_elm, data_->ad_coef_edg[sid], data_->dif_coef_edg[sid]);
750 dg_penalty_[sid].resize(model_->n_substances());
751 for (
unsigned int sbi=0; sbi<model_->n_substances(); sbi++)
752 dg_penalty_[sid][sbi] = data_->dg_penalty[sbi].value(edg_elm.
centre(), edg_elm);
755 arma::vec3 normal_vector = fe_values_vec_[0].normal_vector(0);
758 for (
unsigned int sbi=0; sbi<model_->n_substances(); sbi++)
761 double pflux = 0, nflux = 0;
766 for (
unsigned int k=0; k<qsize_lower_dim_; k++)
767 fluxes[sid] += arma::dot(data_->ad_coef_edg[sid][sbi][k], fe_values_vec_[sid].normal_vector(k))*fe_values_vec_[sid].JxW(k);
768 fluxes[sid] /= edge_side.measure();
770 pflux += fluxes[sid];
772 nflux += fluxes[sid];
777 for(
DHCellSide edge_side1 : edge_side_range )
780 for(
DHCellSide edge_side2 : edge_side_range )
783 if (s2<=s1)
continue;
784 ASSERT(edge_side1.is_valid()).error(
"Invalid side of edge.");
786 arma::vec3 nv = fe_values_vec_[s1].normal_vector(0);
790 if (fluxes[s2] > 0 && fluxes[s1] < 0)
791 transport_flux = fluxes[s1]*fabs(fluxes[s2]/pflux);
792 else if (fluxes[s2] < 0 && fluxes[s1] > 0)
793 transport_flux = fluxes[s1]*fabs(fluxes[s2]/nflux);
797 gamma_l = 0.5*fabs(transport_flux);
801 for (
unsigned int k=0; k<qsize_lower_dim_; k++)
803 delta[0] += dot(data_->dif_coef_edg[s1][sbi][k]*normal_vector,normal_vector);
804 delta[1] += dot(data_->dif_coef_edg[s2][sbi][k]*normal_vector,normal_vector);
806 delta[0] /= qsize_lower_dim_;
807 delta[1] /= qsize_lower_dim_;
809 delta_sum = delta[0] + delta[1];
812 if (fabs(delta_sum) > 0)
814 omega[0] = delta[1]/delta_sum;
815 omega[1] = delta[0]/delta_sum;
816 double local_alpha = max(dg_penalty_[s1][sbi], dg_penalty_[s2][sbi]);
817 double h = edge_side1.diameter();
818 aniso1 = data_->elem_anisotropy(edge_side1.element());
819 aniso2 = data_->elem_anisotropy(edge_side2.element());
820 gamma_l += local_alpha/h*aniso1*aniso2*(delta[0]*delta[1]/delta_sum);
823 for (
int i=0; i<2; i++) omega[i] = 0;
826 int sd[2];
bool is_side_own[2];
827 sd[0] = s1; is_side_own[0] = edge_side1.cell().is_own();
828 sd[1] = s2; is_side_own[1] = edge_side2.cell().is_own();
830 #define AVERAGE(i,k,side_id) (fe_values_vec_[sd[side_id]].shape_value(i,k)*0.5) 831 #define WAVERAGE(i,k,side_id) (arma::dot(data_->dif_coef_edg[sd[side_id]][sbi][k]*fe_values_vec_[sd[side_id]].shape_grad(i,k),nv)*omega[side_id]) 832 #define JUMP(i,k,side_id) ((side_id==0?1:-1)*fe_values_vec_[sd[side_id]].shape_value(i,k)) 835 for (
int n=0; n<2; n++)
837 if (!is_side_own[n])
continue;
839 for (
int m=0; m<2; m++)
841 for (
unsigned int i=0; i<fe_values_vec_[sd[n]].n_dofs(); i++)
842 for (
unsigned int j=0; j<fe_values_vec_[sd[m]].n_dofs(); j++)
843 local_matrix_[i*fe_values_vec_[sd[m]].n_dofs()+j] = 0;
845 for (
unsigned int k=0; k<qsize_lower_dim_; k++)
847 double flux_times_JxW = transport_flux*fe_values_vec_[0].JxW(k);
848 double gamma_times_JxW = gamma_l*fe_values_vec_[0].JxW(k);
850 for (
unsigned int i=0; i<fe_values_vec_[sd[n]].n_dofs(); i++)
852 double flux_JxW_jump_i = flux_times_JxW*
JUMP(i,k,n);
853 double gamma_JxW_jump_i = gamma_times_JxW*
JUMP(i,k,n);
854 double JxW_jump_i = fe_values_vec_[0].JxW(k)*
JUMP(i,k,n);
855 double JxW_var_wavg_i = fe_values_vec_[0].JxW(k)*
WAVERAGE(i,k,n)*data_->dg_variant;
857 for (
unsigned int j=0; j<fe_values_vec_[sd[m]].n_dofs(); j++)
859 int index = i*fe_values_vec_[sd[m]].n_dofs()+j;
862 local_matrix_[index] += flux_JxW_jump_i*
AVERAGE(j,k,m);
865 local_matrix_[index] += gamma_JxW_jump_i*
JUMP(j,k,m);
868 local_matrix_[index] -=
WAVERAGE(j,k,m)*JxW_jump_i;
869 local_matrix_[index] -=
JUMP(j,k,m)*JxW_var_wavg_i;
873 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]));
888 if (dim == 1)
return;
889 ASSERT_EQ_DBG(cell_lower_dim.
dim(), dim-1).error(
"Dimension of element mismatch!");
895 for(
unsigned int i=0; i<n_indices; ++i) {
896 side_dof_indices_vb_[i] = dof_indices_[i];
898 fe_values_vb_.reinit(elm_lower_dim);
899 n_dofs[0] = fv_sb_[0]->n_dofs();
904 for(
unsigned int i=0; i<n_indices; ++i) {
905 side_dof_indices_vb_[i+n_dofs[0]] = dof_indices_[i];
907 fe_values_side_.reinit(neighb_side.
side());
908 n_dofs[1] = fv_sb_[1]->n_dofs();
911 bool own_element_id[2];
912 own_element_id[0] = cell_lower_dim.
is_own();
913 own_element_id[1] = cell_higher_dim.
is_own();
915 fsv_rt_.reinit(neighb_side.
side());
916 fv_rt_vb_.reinit(elm_lower_dim);
917 calculate_velocity(elm_higher_dim, velocity_higher_, fsv_rt_.point_list());
918 calculate_velocity(elm_lower_dim, velocity_, fv_rt_vb_.point_list());
919 model_->compute_advection_diffusion_coefficients(fe_values_vb_.point_list(), velocity_, elm_lower_dim, data_->ad_coef_edg[0], data_->dif_coef_edg[0]);
920 model_->compute_advection_diffusion_coefficients(fe_values_vb_.point_list(), velocity_higher_, elm_higher_dim, data_->ad_coef_edg[1], data_->dif_coef_edg[1]);
921 data_->cross_section.value_list(fe_values_vb_.point_list(), elm_lower_dim, csection_);
922 data_->cross_section.value_list(fe_values_vb_.point_list(), elm_higher_dim, csection_higher_);
924 for (
unsigned int sbi=0; sbi<model_->n_substances(); sbi++)
926 for (
unsigned int i=0; i<n_dofs[0]+n_dofs[1]; i++)
927 for (
unsigned int j=0; j<n_dofs[0]+n_dofs[1]; j++)
928 local_matrix_[i*(n_dofs[0]+n_dofs[1])+j] = 0;
931 data_->fracture_sigma[sbi].value_list(fe_values_vb_.point_list(), elm_lower_dim, sigma_);
934 for (
unsigned int k=0; k<qsize_lower_dim_; k++)
943 double sigma = sigma_[k]*arma::dot(data_->dif_coef_edg[0][sbi][k]*fe_values_side_.normal_vector(k),fe_values_side_.normal_vector(k))*
944 2*csection_higher_[k]*csection_higher_[k]/(csection_[k]*csection_[k]);
946 double transport_flux = arma::dot(data_->ad_coef_edg[1][sbi][k], fe_values_side_.normal_vector(k));
948 comm_flux[0][0] = (sigma-min(0.,transport_flux))*fv_sb_[0]->JxW(k);
949 comm_flux[0][1] = -(sigma-min(0.,transport_flux))*fv_sb_[0]->JxW(k);
950 comm_flux[1][0] = -(sigma+max(0.,transport_flux))*fv_sb_[0]->JxW(k);
951 comm_flux[1][1] = (sigma+max(0.,transport_flux))*fv_sb_[0]->JxW(k);
953 for (
int n=0; n<2; n++)
955 if (!own_element_id[n])
continue;
957 for (
unsigned int i=0; i<n_dofs[n]; i++)
958 for (
int m=0; m<2; m++)
959 for (
unsigned int j=0; j<n_dofs[m]; j++)
960 local_matrix_[(i+n*n_dofs[0])*(n_dofs[0]+n_dofs[1]) + m*n_dofs[0] + j] +=
961 comm_flux[m][n]*fv_sb_[m]->shape_value(j,k)*fv_sb_[n]->shape_value(i,k);
964 data_->ls[sbi]->mat_set_values(n_dofs[0]+n_dofs[1], &(side_dof_indices_vb_[0]), n_dofs[0]+n_dofs[1], &(side_dof_indices_vb_[0]), &(local_matrix_[0]));
980 velocity.resize(point_list.
size());
981 model_->velocity_field_ptr()->value_list(point_list, cell, velocity);
984 shared_ptr<FiniteElement<dim>>
fe_;
1040 double comm_flux[2][2];
1045 template <
template<
Dim...>
class DimAssembly>
1054 template <
unsigned int dim,
class Model>
1062 :
AssemblyBase<dim>(data->dg_order), model_(nullptr), data_(data) {}
1069 this->model_ = &model;
1071 fe_ = std::make_shared< FE_P_disc<dim> >(data_->dg_order);
1073 ndofs_ = fe_->n_dofs();
1074 qsize_ = this->quad_->size();
1075 dof_indices_.resize(ndofs_);
1076 loc_dof_indices_.resize(ndofs_);
1077 local_rhs_.resize(ndofs_);
1078 local_source_balance_vector_.resize(ndofs_);
1079 local_source_balance_rhs_.resize(ndofs_);
1093 fe_values_.reinit(elm);
1096 model_->compute_source_coefficients(fe_values_.point_list(), elm, sources_conc_, sources_density_, sources_sigma_);
1099 for (
unsigned int sbi=0; sbi<model_->n_substances(); sbi++)
1101 fill_n( &(local_rhs_[0]), ndofs_, 0 );
1102 local_source_balance_vector_.assign(ndofs_, 0);
1103 local_source_balance_rhs_.assign(ndofs_, 0);
1106 for (
unsigned int k=0; k<qsize_; k++)
1108 source = (sources_density_[sbi][k] + sources_conc_[sbi][k]*sources_sigma_[sbi][k])*fe_values_.JxW(k);
1110 for (
unsigned int i=0; i<ndofs_; i++)
1111 local_rhs_[i] += source*fe_values_.shape_value(i,k);
1113 data_->ls[sbi]->rhs_set_values(ndofs_, &(dof_indices_[0]), &(local_rhs_[0]));
1115 for (
unsigned int i=0; i<ndofs_; i++)
1117 for (
unsigned int k=0; k<qsize_; k++)
1118 local_source_balance_vector_[i] -= sources_sigma_[sbi][k]*fe_values_.shape_value(i,k)*fe_values_.JxW(k);
1120 local_source_balance_rhs_[i] += local_rhs_[i];
1122 model_->balance()->add_source_values(model_->get_subst_idx()[sbi], elm.
region().
bulk_idx(),
1124 local_source_balance_vector_, local_source_balance_rhs_);
1131 model_->balance()->start_source_assembly( model_->subst_idx() );
1137 model_->balance()->finish_source_assembly( model_->subst_idx() );
1152 velocity.resize(point_list.
size());
1153 model_->velocity_field_ptr()->value_list(point_list, cell, velocity);
1156 shared_ptr<FiniteElement<dim>>
fe_;
1185 template <
template<
Dim...>
class DimAssembly>
1194 template <
unsigned int dim,
class Model>
1202 :
AssemblyBase<dim>(data->dg_order), fe_rt_(nullptr), model_(nullptr), data_(data) {}
1206 if (fe_rt_==
nullptr)
return;
1213 this->model_ = &model;
1215 fe_ = std::make_shared< FE_P_disc<dim> >(data_->dg_order);
1220 qsize_ = this->quad_->size();
1221 qsize_lower_dim_ = this->quad_low_->size();
1222 dof_indices_.resize(ndofs_);
1223 local_rhs_.resize(ndofs_);
1224 local_flux_balance_vector_.resize(ndofs_);
1225 velocity_.resize(qsize_);
1226 sigma_.resize(qsize_lower_dim_);
1227 csection_.resize(qsize_lower_dim_);
1228 bc_values_.resize(qsize_lower_dim_);
1229 bc_fluxes_.resize(qsize_lower_dim_);
1230 bc_ref_values_.resize(qsize_lower_dim_);
1242 if (dh_side.n_edge_sides() > 1)
continue;
1244 if (! dh_side.side().is_boundary())
continue;
1246 const unsigned int cond_idx = dh_side.
side().cond_idx();
1251 model_->get_bc_type(bc_elm, bc_type);
1253 fe_values_side_.reinit(dh_side.side());
1254 fsv_rt_.reinit(dh_side.side());
1255 calculate_velocity(elm, velocity_, fsv_rt_.point_list());
1259 model_->compute_advection_diffusion_coefficients(fe_values_side_.point_list(), velocity_, elm, data_->ad_coef, data_->dif_coef);
1260 data_->cross_section.value_list(fe_values_side_.point_list(), elm, csection_);
1262 for (
unsigned int sbi=0; sbi<model_->n_substances(); sbi++)
1264 fill_n(&(local_rhs_[0]), ndofs_, 0);
1265 local_flux_balance_vector_.assign(ndofs_, 0);
1266 local_flux_balance_rhs_ = 0;
1270 data_->bc_dirichlet_value[sbi].value_list(fe_values_side_.point_list(), bc_elm, bc_values_);
1272 double side_flux = 0;
1273 for (
unsigned int k=0; k<qsize_lower_dim_; k++)
1274 side_flux += arma::dot(data_->ad_coef[sbi][k], fe_values_side_.normal_vector(k))*fe_values_side_.JxW(k);
1275 double transport_flux = side_flux/dh_side.measure();
1279 for (
unsigned int k=0; k<qsize_lower_dim_; k++)
1281 double bc_term = -transport_flux*bc_values_[k]*fe_values_side_.JxW(k);
1282 for (
unsigned int i=0; i<ndofs_; i++)
1283 local_rhs_[i] += bc_term*fe_values_side_.shape_value(i,k);
1285 for (
unsigned int i=0; i<ndofs_; i++)
1286 local_flux_balance_rhs_ -= local_rhs_[i];
1290 for (
unsigned int k=0; k<qsize_lower_dim_; k++)
1292 double bc_term = data_->gamma[sbi][cond_idx]*bc_values_[k]*fe_values_side_.JxW(k);
1293 arma::vec3 bc_grad = -bc_values_[k]*fe_values_side_.JxW(k)*data_->dg_variant*(arma::trans(data_->dif_coef[sbi][k])*fe_values_side_.normal_vector(k));
1294 for (
unsigned int i=0; i<ndofs_; i++)
1295 local_rhs_[i] += bc_term*fe_values_side_.shape_value(i,k)
1296 + arma::dot(bc_grad,fe_values_side_.shape_grad(i,k));
1298 for (
unsigned int k=0; k<qsize_lower_dim_; k++)
1300 for (
unsigned int i=0; i<ndofs_; i++)
1302 local_flux_balance_vector_[i] += (arma::dot(data_->ad_coef[sbi][k], fe_values_side_.normal_vector(k))*fe_values_side_.shape_value(i,k)
1303 - arma::dot(data_->dif_coef[sbi][k]*fe_values_side_.shape_grad(i,k),fe_values_side_.normal_vector(k))
1304 + data_->gamma[sbi][cond_idx]*fe_values_side_.shape_value(i,k))*fe_values_side_.JxW(k);
1307 if (model_->time().tlevel() > 0)
1308 for (
unsigned int i=0; i<ndofs_; i++)
1309 local_flux_balance_rhs_ -= local_rhs_[i];
1313 model_->get_flux_bc_data(sbi, fe_values_side_.point_list(), bc_elm, bc_fluxes_, sigma_, bc_ref_values_);
1314 for (
unsigned int k=0; k<qsize_lower_dim_; k++)
1316 double bc_term = csection_[k]*(sigma_[k]*bc_ref_values_[k]+bc_fluxes_[k])*fe_values_side_.JxW(k);
1317 for (
unsigned int i=0; i<ndofs_; i++)
1318 local_rhs_[i] += bc_term*fe_values_side_.shape_value(i,k);
1321 for (
unsigned int i=0; i<ndofs_; i++)
1323 for (
unsigned int k=0; k<qsize_lower_dim_; k++)
1324 local_flux_balance_vector_[i] += csection_[k]*sigma_[k]*fe_values_side_.JxW(k)*fe_values_side_.shape_value(i,k);
1325 local_flux_balance_rhs_ -= local_rhs_[i];
1330 model_->get_flux_bc_data(sbi, fe_values_side_.point_list(), bc_elm, bc_fluxes_, sigma_, bc_ref_values_);
1331 for (
unsigned int k=0; k<qsize_lower_dim_; k++)
1333 double bc_term = csection_[k]*(sigma_[k]*bc_ref_values_[k]+bc_fluxes_[k])*fe_values_side_.JxW(k);
1334 for (
unsigned int i=0; i<ndofs_; i++)
1335 local_rhs_[i] += bc_term*fe_values_side_.shape_value(i,k);
1338 for (
unsigned int i=0; i<ndofs_; i++)
1340 for (
unsigned int k=0; k<qsize_lower_dim_; k++)
1341 local_flux_balance_vector_[i] += csection_[k]*(arma::dot(data_->ad_coef[sbi][k], fe_values_side_.normal_vector(k)) + sigma_[k])*fe_values_side_.JxW(k)*fe_values_side_.shape_value(i,k);
1342 local_flux_balance_rhs_ -= local_rhs_[i];
1347 for (
unsigned int k=0; k<qsize_lower_dim_; k++)
1349 for (
unsigned int i=0; i<ndofs_; i++)
1350 local_flux_balance_vector_[i] += arma::dot(data_->ad_coef[sbi][k], fe_values_side_.normal_vector(k))*fe_values_side_.JxW(k)*fe_values_side_.shape_value(i,k);
1353 data_->ls[sbi]->rhs_set_values(ndofs_, &(dof_indices_[0]), &(local_rhs_[0]));
1355 model_->balance()->add_flux_values(model_->get_subst_idx()[sbi], dh_side,
1357 local_flux_balance_vector_, local_flux_balance_rhs_);
1365 model_->balance()->start_flux_assembly( model_->subst_idx() );
1371 model_->balance()->finish_flux_assembly( model_->subst_idx() );
1386 velocity.resize(point_list.
size());
1387 model_->velocity_field_ptr()->value_list(point_list, cell, velocity);
1390 shared_ptr<FiniteElement<dim>>
fe_;
1417 template <
template<
Dim...>
class DimAssembly>
1426 template <
unsigned int dim,
class Model>
1434 :
AssemblyBase<dim>(data->dg_order), model_(nullptr), data_(data) {}
1441 this->model_ = &model;
1443 fe_ = std::make_shared< FE_P_disc<dim> >(data_->dg_order);
1445 ndofs_ = fe_->n_dofs();
1446 qsize_ = this->quad_->size();
1447 dof_indices_.resize(ndofs_);
1448 local_matrix_.resize(4*ndofs_*ndofs_);
1449 local_rhs_.resize(ndofs_);
1461 fe_values_.reinit(elem);
1462 model_->compute_init_cond(fe_values_.point_list(), elem, init_values_);
1464 for (
unsigned int sbi=0; sbi<model_->n_substances(); sbi++)
1466 for (
unsigned int i=0; i<ndofs_; i++)
1469 for (
unsigned int j=0; j<ndofs_; j++)
1470 local_matrix_[i*ndofs_+j] = 0;
1473 for (
unsigned int k=0; k<qsize_; k++)
1475 double rhs_term = init_values_[sbi][k]*fe_values_.JxW(k);
1477 for (
unsigned int i=0; i<ndofs_; i++)
1479 for (
unsigned int j=0; j<ndofs_; j++)
1480 local_matrix_[i*ndofs_+j] += fe_values_.shape_value(i,k)*fe_values_.shape_value(j,k)*fe_values_.JxW(k);
1482 local_rhs_[i] += fe_values_.shape_value(i,k)*rhs_term;
1485 data_->ls[sbi]->set_values(ndofs_, &(dof_indices_[0]), ndofs_, &(dof_indices_[0]), &(local_matrix_[0]), &(local_rhs_[0]));
1501 velocity.resize(point_list.
size());
1502 model_->velocity_field_ptr()->value_list(point_list, cell, velocity);
1505 shared_ptr<FiniteElement<dim>>
fe_;
1523 template <
template<
Dim...>
class DimAssembly>
TransportDG< Model >::EqData EqDataDG
unsigned int ndofs_
Number of dofs.
vector< vector< double > > ret_coef_
Retardation coefficient due to sorption.
Class MappingP1 implements the affine transformation of the unit cell onto the actual cell...
virtual void assemble_fluxes_element_side(FMT_UNUSED DHCellAccessor cell_lower_dim, FMT_UNUSED DHCellSide neighb_side)
Assembles the fluxes between elements of different dimensions.
vector< PetscScalar > local_mass_balance_vector_
Same as previous.
std::array< CouplingIntegralData, 6 > coupling_integral_data_
Holds data for computing couplings integrals.
std::array< EdgeIntegralData, 4 > edge_integral_data_
Holds data for computing edge integrals.
vector< double > csection_
Auxiliary vector for assemble boundary fluxes, element-side fluxes and set boundary conditions...
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
Range< DHCellSide > side_range() const
Returns range of cell sides.
TransportDG< Model > * model_
Pointer to model (we must use common ancestor of concentration and heat model)
unsigned int n_dofs() const
Returns the number of degrees of freedom needed by the finite element.
vector< PetscScalar > local_matrix_
Auxiliary vector for assemble methods.
vector< vector< double > > ret_coef_
Retardation coefficient due to sorption.
FEValues< 3 > fe_values_
FEValues of object (of P disc finite element type)
unsigned int qsize_
Size of quadrature of actual dim.
unsigned int size() const
Transformed quadrature weight for cell sides.
#define ASSERT_EQ_DBG(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
unsigned int elm_idx() const
Return serial idx to element of loc_ele_idx_.
Quadrature * quad_low_
Quadrature used in assembling methods (dim-1).
vector< arma::vec3 > velocity_
Auxiliary results.
std::shared_ptr< EvalPoints > eval_points() const
unsigned int subset_index
unsigned int * boundary_idx_
std::array< unsigned int, 4 > integrals_size_
Holds used sizes of previous integral data types.
vector< LongIdx > dof_indices_
Vector of global DOF indices.
vector< double > sigma_
Auxiliary vector for assemble boundary fluxes (robin sigma), element-side fluxes (frac sigma) and set...
unsigned int qsize_
Size of quadrature of actual dim.
virtual void assemble_fluxes_boundary(FMT_UNUSED DHCellSide cell_side)
Assembles the fluxes on the boundary.
unsigned int dim() const
Return dimension of element appropriate to the side.
GenericAssembly(typename DimAssembly< 1 >::EqDataDG *eq_data, int active_integrals)
Constructor.
Transport with dispersion implemented using discontinuous Galerkin method.
#define AVERAGE(i, k, side_id)
unsigned int get_dof_indices(std::vector< LongIdx > &indices) const
Fill vector of the global indices of dofs associated to the cell.
void initialize(TransportDG< Model > &model)
Initialize auxiliary vectors and other data members.
unsigned int ndofs_
Number of dofs.
unsigned int side_subset_index
unsigned int subset_index
FEValues< 3 > fe_values_
FEValues of object (of P disc finite element type)
std::vector< std::vector< double > > init_values_
Auxiliary vectors for prepare initial condition.
~InitConditionAssemblyDG()
Destructor.
int active_integrals_
Holds mask of active integrals.
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
FEValues< 3 > fv_rt_vb_
FEValues of dim-1 object (of RT0 finite element type)
std::array< std::shared_ptr< CouplingIntegral >, 2 > coupling_
Coupling integrals between elements of dimensions 1-2, 2-3.
void assemble(std::shared_ptr< DOFHandlerMultiDim > dh)
General assemble methods.
ActiveIntegrals
Allow set mask of active integrals.
vector< double > csection_
Auxiliary vector for assemble boundary fluxes, element-side fluxes and set boundary conditions...
vector< vector< LongIdx > > side_dof_indices_
Vector of vectors of side DOF indices.
unsigned int dim() const
Return dimension of element appropriate to cell.
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)
void assemble_fluxes_boundary(DHCellSide cell_side) override
Assembles the fluxes on the boundary.
unsigned int qsize_lower_dim_
Size of quadrature of dim-1.
#define WAVERAGE(i, k, side_id)
MixedPtr< DimAssembly, 1 > multidim_assembly() const
StiffnessAssemblyDG(EqDataDG *data)
Constructor.
Directing class of FieldValueCache.
Iter< Object > make_iter(Object obj)
vector< PetscScalar > local_matrix_
Auxiliary vector for assemble methods.
Cell accessor allow iterate over DOF handler cells.
vector< arma::vec3 > velocity_
Auxiliary results.
Class FEValues calculates finite element data on the actual cells such as shape function values...
void add_edge_integral(RangeConvert< DHEdgeSide, DHCellSide > edge_side_range)
Add data of edge integral to appropriate data structure.
vector< LongIdx > dof_indices_
Vector of global DOF indices.
vector< PetscScalar > local_source_balance_rhs_
Auxiliary vector for set_sources method.
virtual void begin()
Method prepares object before assemblation (e.g. balance, ...).
LocDofVec get_loc_dof_indices() const
Returns the local indices of dofs associated to the cell on the local process.
SideIter side(const unsigned int loc_index)
~SourcesAssemblyDG()
Destructor.
unsigned int bulk_subset_index
#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.
EqDataDG * data_
Data object shared with TransportDG.
void assemble_volume_integrals(DHCellAccessor cell) override
Assemble integral over element.
virtual void end()
Method finishes object after assemblation (e.g. balance, ...).
IterConvert< ObjectIn, ObjectOut > begin()
Iterator to begin item of range.
EqDataDG * data_
Data object shared with TransportDG.
bool is_own() const
Return true if accessor represents own element (false for ghost element)
std::array< BoundaryIntegralData, 4 > boundary_integral_data_
Holds data for computing boundary integrals.
FEValues< 3 > fsv_rt_
FEValues of object (of RT0 finite element type)
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.
TransportDG< Model > * model_
Pointer to model (we must use common ancestor of concentration and heat model)
void end() override
Implements AssemblyBase::end.
void begin() override
Implements AssemblyBase::begin.
void assemble_volume_integrals(DHCellAccessor cell) override
Assemble integral over element.
vector< PetscScalar > local_mass_balance_vector_
Same as previous.
void begin() override
Implements AssemblyBase::begin.
vector< double > bc_fluxes_
Same as previous.
Base class for quadrature rules on simplices in arbitrary dimensions.
Symmetric Gauss-Legendre quadrature formulae on simplices.
arma::vec::fixed< spacedim > centre() const
Computes the barycenter.
vector< double > sigma_
Auxiliary vector for assemble boundary fluxes (robin sigma), element-side fluxes (frac sigma) and set...
void assemble_fluxes_element_element(RangeConvert< DHEdgeSide, DHCellSide > edge_side_range) override
Assembles the fluxes between elements of the same dimension.
MassAssemblyDG(EqDataDG *data)
Constructor.
void initialize() override
std::array< std::shared_ptr< EdgeIntegral >, 3 > edge_
Edge integrals between elements of dimensions 1, 2, 3.
Discontinuous Lagrangean finite element on dim dimensional simplex.
Transformed quadrature points.
const ElementAccessor< 3 > elm() const
Return ElementAccessor to element of loc_ele_idx_.
FEValues< 3 > fv_rt_
FEValues of object (of RT0 finite element type)
unsigned int ndofs_
Number of dofs.
void initialize(TransportDG< Model > &model)
Initialize auxiliary vectors and other data members.
FEValues< 3 > fe_values_
FEValues of object (of P disc finite element type)
void calculate_velocity(const ElementAccessor< 3 > &cell, vector< arma::vec3 > &velocity, const Armor::array &point_list)
Calculates the velocity field on a given cell.
FEValues< 3 > fe_values_side_
FEValues of object (of P disc finite element type)
InitConditionAssemblyDG(EqDataDG *data)
Constructor.
void end() override
Implements AssemblyBase::end.
void assemble_fluxes_element_side(DHCellAccessor cell_lower_dim, DHCellSide neighb_side) override
Assembles the fluxes between elements of different dimensions.
TransportDG< Model > * model_
Pointer to model (we must use common ancestor of concentration and heat model)
TransportDG< Model >::EqData EqDataDG
vector< vector< double > > sources_conc_
Auxiliary vectors for set_sources method.
void calculate_velocity(const ElementAccessor< 3 > &cell, vector< arma::vec3 > &velocity, const Armor::array &point_list)
Calculates the velocity field on a given cell.
TransportDG< Model > * model_
Pointer to model (we must use common ancestor of concentration and heat model)
RangeConvert< DHEdgeSide, DHCellSide > edge_sides() const
Returns range of all sides looped over common Edge.
#define JUMP(i, k, side_id)
vector< FEValues< 3 > * > fv_sb_
Auxiliary vector, holds FEValues objects for assemble element-side.
Raviart-Thomas element of order 0.
Definitions of basic Lagrangean finite elements with polynomial shape functions.
FEValues< 3 > fe_values_
FEValues of object (of P disc finite element type)
void add_boundary_integral(const DHCellSide &bdr_side)
Add data of boundary integral to appropriate data structure.
void calculate_velocity(const ElementAccessor< 3 > &cell, vector< arma::vec3 > &velocity, const Armor::array &point_list)
Calculates the velocity field on a given cell.
RangeConvert< DHEdgeSide, DHCellSide > edge_side_range
ElementAccessor< 3 > element() const
RangeConvert< DHNeighbSide, DHCellSide > neighb_sides() const
Returns range of neighbour cell of lower dimension corresponding to cell of higher dimension...
vector< PetscScalar > local_rhs_
Auxiliary vector for set_sources method.
#define START_TIMER(tag)
Starts a timer with specified tag.
void calculate_velocity(const ElementAccessor< 3 > &cell, vector< arma::vec3 > &velocity, const Armor::array &point_list)
Calculates the velocity field on a given cell.
void initialize(TransportDG< Model > &model)
Initialize auxiliary vectors and other data members.
BdrConditionAssemblyDG(EqDataDG *data)
Constructor.
unsigned int qsize_
Size of quadrature of actual dim.
vector< double > bc_values_
Auxiliary vector for set boundary conditions method.
vector< LongIdx > loc_dof_indices_
Vector of local DOF indices.
vector< PetscScalar > local_rhs_
Auxiliary vector for set_sources method.
vector< PetscScalar > local_matrix_
Auxiliary vector for assemble methods.
vector< double > bc_ref_values_
Same as previous.
TransportDG< Model >::EqData EqDataDG
vector< double > mm_coef_
Mass matrix coefficients.
FiniteElement< dim > * fe_rt_
Finite element for the water velocity field.
unsigned int ndofs_
Number of dofs.
ElementCacheMap element_cache_map_
ElementCacheMap according to EvalPoints.
Shape function gradients.
vector< LongIdx > dof_indices_
Vector of global DOF indices.
vector< double > mm_coef_
Mass matrix coefficients.
double measure() const
Calculate metrics of the side.
void assemble_volume_integrals(DHCellAccessor cell) override
Assemble integral over element.
unsigned int qsize_lower_dim_
Size of quadrature of dim-1.
std::array< std::shared_ptr< BulkIntegral >, 3 > bulk_
Bulk integrals of elements of dimensions 1, 2, 3.
vector< LongIdx > dof_indices_
Vector of global DOF indices.
vector< arma::vec3 > velocity_higher_
Velocity results of higher dim element (element-side computation).
Discontinuous Galerkin method for equation of transport with dispersion.
void assemble_volume_integrals(DHCellAccessor cell) override
Assemble integral over element.
vector< vector< arma::vec3 > > side_velocity_vec_
Vector of velocities results.
PetscScalar local_flux_balance_rhs_
Auxiliary variable for set_boundary_conditions method.
vector< double > csection_higher_
Auxiliary vector for assemble element-side fluxes.
const DHCellAccessor & cell() const
Return DHCellAccessor appropriate to the side.
vector< vector< double > > sources_sigma_
Auxiliary vectors for assemble volume integrals and set_sources method.
TransportDG< Model >::EqData EqDataDG
void assemble_volume_integrals(DHCellAccessor cell) override
Assembles the volume integrals into the stiffness matrix.
MixedPtr< DimAssembly, 1 > multidim_assembly_
Assembly object.
vector< vector< double > > dg_penalty_
Auxiliary vectors for assemble element-element fluxes.
unsigned int cond_idx() const
Returns global index of the prescribed boundary condition.
void create_integrals(std::shared_ptr< EvalPoints > eval_points, AssemblyIntegrals &integrals, int active_integrals)
Create integrals according to dim of assembly object.
unsigned int qsize_
Size of quadrature of actual dim.
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.
EqDataDG * data_
Data object shared with TransportDG.
void add_coupling_integral(const DHCellAccessor &cell, const DHCellSide &ngh_side)
Add data of coupling integral to appropriate data structure.
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.
std::array< std::shared_ptr< BoundaryIntegral >, 3 > boundary_
Boundary integrals betwwen elements of dimensions 1, 2, 3 and boundaries.
TransportDG< Model >::EqData EqDataDG
FiniteElement< dim > * fe_rt_
Finite element for the water velocity field.
AssemblyBase(unsigned int quad_order)
Constructor.
vector< vector< double > > sources_density_
Auxiliary vectors for set_sources method.
unsigned int bulk_idx() const
Returns index of the region in the bulk set.
Definitions of particular quadrature rules on simplices.
void add_integrals_of_computing_step(DHCellAccessor cell)
vector< PetscScalar > local_rhs_
Auxiliary vector for set_sources method.
void initialize(TransportDG< Model > &model)
Initialize auxiliary vectors and other data members.
shared_ptr< FiniteElement< dim > > fe_
Finite element for the solution of the advection-diffusion equation.
#define END_TIMER(tag)
Ends a timer with specified tag.
shared_ptr< FiniteElement< dim-1 > > fe_low_
Finite element for the solution of the advection-diffusion equation (dim-1).
std::shared_ptr< EvalPoints > eval_points_
EvalPoints object shared by all integrals.
unsigned int qsize_
Size of quadrature of actual dim.
std::array< BulkIntegralData, 1 > bulk_integral_data_
Holds data for computing bulk integrals.
EqDataDG * data_
Data object shared with TransportDG.
void add_volume_integral(const DHCellAccessor &cell)
Add data of volume integral to appropriate data structure.
virtual void assemble_volume_integrals(FMT_UNUSED DHCellAccessor cell)
Assembles the volume integrals on cell.
EqDataDG * data_
Data object shared with TransportDG.
virtual void assemble_fluxes_element_element(FMT_UNUSED RangeConvert< DHEdgeSide, DHCellSide > edge_side_range)
Assembles the fluxes between sides on the edge.
SourcesAssemblyDG(EqDataDG *data)
Constructor.
void insert_eval_points_from_integral_data()
Mark eval points in table of Element cache map.
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...
TransportDG< Model > * model_
Pointer to model (we must use common ancestor of concentration and heat model)
vector< vector< double > > sources_sigma_
Auxiliary vectors for assemble volume integrals and set_sources method.
~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.
unsigned int subset_index
FiniteElement< dim-1 > * fe_rt_low_
Finite element for the water velocity field (dim-1).
unsigned int idx() const
Return local idx of element in boundary / bulk part of element vector.
~MassAssemblyDG()
Destructor.
void initialize(TransportDG< Model > &model)
Initialize auxiliary vectors and other data members.
FEValues< 3 > fsv_rt_
FEValues of object (of RT0 finite element type)
Quadrature * quad_
Quadrature used in assembling methods.
vector< PetscScalar > local_retardation_balance_vector_
Auxiliary vector for assemble mass matrix.
Definitions of Raviart-Thomas finite elements.
Side accessor allows to iterate over sides of DOF handler cell.
void begin() override
Implements AssemblyBase::begin.
void calculate_velocity(const ElementAccessor< 3 > &cell, vector< arma::vec3 > &velocity, const Armor::array &point_list)
Calculates the velocity field on a given cell.
ElementAccessor< 3 > element_accessor()
Set of all used integral necessary in assemblation.
Transformed quadrature weights.
Class allows to iterate over sides of edge.
AssemblyIntegrals integrals_
Holds integral objects.