OGS
ComponentTransportFEM.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <numeric>
14#include <vector>
15
36
37namespace ProcessLib
38{
39namespace ComponentTransport
40{
41template <typename GlobalDimNodalMatrixType>
43{
44 IntegrationPointData(GlobalDimNodalMatrixType const& dNdx_,
45 double const& integration_weight_)
46 : dNdx(dNdx_), integration_weight(integration_weight_)
47 {
48 }
49
51 GlobalDimNodalMatrixType const dNdx;
52 double const integration_weight;
53
54 // -1 indicates that no chemical reaction takes place in the element to
55 // which the integration point belongs.
57
58 double porosity = std::numeric_limits<double>::quiet_NaN();
59 double porosity_prev = std::numeric_limits<double>::quiet_NaN();
61};
62
66{
67public:
69
70 virtual void setChemicalSystemID(std::size_t const /*mesh_item_id*/) = 0;
71
73 std::size_t const mesh_item_id,
74 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_tables,
75 std::vector<GlobalVector*> const& x, double const t)
76 {
77 std::vector<double> local_x_vec;
78
79 auto const n_processes = x.size();
80 for (std::size_t process_id = 0; process_id < n_processes; ++process_id)
81 {
82 auto const indices =
83 NumLib::getIndices(mesh_item_id, *dof_tables[process_id]);
84 assert(!indices.empty());
85 auto const local_solution = x[process_id]->get(indices);
86 local_x_vec.insert(std::end(local_x_vec),
87 std::begin(local_solution),
88 std::end(local_solution));
89 }
90 auto const local_x = MathLib::toVector(local_x_vec);
91
93 }
94
96 std::size_t const mesh_item_id,
97 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_tables,
98 std::vector<GlobalVector*> const& x, double const t, double const dt)
99 {
100 std::vector<double> local_x_vec;
101
102 auto const n_processes = x.size();
103 for (std::size_t process_id = 0; process_id < n_processes; ++process_id)
104 {
105 auto const indices =
106 NumLib::getIndices(mesh_item_id, *dof_tables[process_id]);
107 assert(!indices.empty());
108 auto const local_solution = x[process_id]->get(indices);
109 local_x_vec.insert(std::end(local_x_vec),
110 std::begin(local_solution),
111 std::end(local_solution));
112 }
113 auto const local_x = MathLib::toVector(local_x_vec);
114
115 setChemicalSystemConcrete(local_x, t, dt);
116 }
117
119 std::size_t const mesh_item_id,
120 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_tables,
121 std::vector<GlobalVector*> const& x, double const t, double const dt,
122 GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, int const process_id)
123 {
124 std::vector<double> local_x_vec;
125
126 auto const n_processes = x.size();
127 for (std::size_t pcs_id = 0; pcs_id < n_processes; ++pcs_id)
128 {
129 auto const indices =
130 NumLib::getIndices(mesh_item_id, *dof_tables[pcs_id]);
131 assert(!indices.empty());
132 auto const local_solution = x[pcs_id]->get(indices);
133 local_x_vec.insert(std::end(local_x_vec),
134 std::begin(local_solution),
135 std::end(local_solution));
136 }
137 auto const local_x = MathLib::toVector(local_x_vec);
138
139 auto const indices =
140 NumLib::getIndices(mesh_item_id, *dof_tables[process_id]);
141 auto const num_r_c = indices.size();
142
143 std::vector<double> local_M_data;
144 local_M_data.reserve(num_r_c * num_r_c);
145 std::vector<double> local_K_data;
146 local_K_data.reserve(num_r_c * num_r_c);
147 std::vector<double> local_b_data;
148 local_b_data.reserve(num_r_c);
149
150 assembleReactionEquationConcrete(t, dt, local_x, local_M_data,
151 local_K_data, local_b_data,
152 process_id);
153
154 auto const r_c_indices =
156 if (!local_M_data.empty())
157 {
158 auto const local_M =
159 MathLib::toMatrix(local_M_data, num_r_c, num_r_c);
160 M.add(r_c_indices, local_M);
161 }
162 if (!local_K_data.empty())
163 {
164 auto const local_K =
165 MathLib::toMatrix(local_K_data, num_r_c, num_r_c);
166 K.add(r_c_indices, local_K);
167 }
168 if (!local_b_data.empty())
169 {
170 b.add(indices, local_b_data);
171 }
172 }
173
174 virtual void postSpeciationCalculation(std::size_t const ele_id,
175 double const t, double const dt) = 0;
176
178 std::size_t const ele_id) = 0;
179
180 virtual std::vector<double> const& getIntPtDarcyVelocity(
181 const double t,
182 std::vector<GlobalVector*> const& x,
183 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
184 std::vector<double>& cache) const = 0;
185
186 virtual std::vector<double> const& getIntPtMolarFlux(
187 const double t, std::vector<GlobalVector*> const& x,
188 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
189 std::vector<double>& cache, int const component_id) const = 0;
190
191private:
193 Eigen::VectorXd const& /*local_x*/, double const /*t*/) = 0;
194
195 virtual void setChemicalSystemConcrete(Eigen::VectorXd const& /*local_x*/,
196 double const /*t*/,
197 double const /*dt*/) = 0;
198
200 double const t, double const dt, Eigen::VectorXd const& local_x,
201 std::vector<double>& local_M_data, std::vector<double>& local_K_data,
202 std::vector<double>& local_b_data, int const transport_process_id) = 0;
203};
204
205template <typename ShapeFunction, int GlobalDim>
207{
208 // When monolithic scheme is adopted, nodal pressure and nodal concentration
209 // are accessed by vector index.
210 static const int pressure_index = 0;
211 const int temperature_index = -1;
213
214 static const int pressure_size = ShapeFunction::NPOINTS;
215 static const int temperature_size = ShapeFunction::NPOINTS;
216 static const int concentration_size =
217 ShapeFunction::NPOINTS; // per component
218
221
223 typename ShapeMatricesType::template MatrixType<pressure_size,
226 typename ShapeMatricesType::template VectorType<pressure_size>;
227
229 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;
230 using LocalVectorType = Eigen::Matrix<double, Eigen::Dynamic, 1>;
231
234
239
240public:
242 MeshLib::Element const& element,
243 std::size_t const local_matrix_size,
244 NumLib::GenericIntegrationMethod const& integration_method,
245 bool is_axially_symmetric,
246 ComponentTransportProcessData const& process_data,
247 std::vector<std::reference_wrapper<ProcessVariable>> const&
248 transport_process_variables)
249 : temperature_index(process_data.isothermal ? -1
250 : ShapeFunction::NPOINTS),
251 first_concentration_index(process_data.isothermal
252 ? ShapeFunction::NPOINTS
253 : 2 * ShapeFunction::NPOINTS),
254 _element(element),
255 _process_data(process_data),
256 _integration_method(integration_method),
257 _transport_process_variables(transport_process_variables)
258 {
259 (void)local_matrix_size;
260
261 unsigned const n_integration_points =
263 _ip_data.reserve(n_integration_points);
264
267
268 double const aperture_size = _process_data.aperture_size(0.0, pos)[0];
269
270 auto const shape_matrices =
272 GlobalDim>(element, is_axially_symmetric,
274 auto const& medium =
276 for (unsigned ip = 0; ip < n_integration_points; ip++)
277 {
278 _ip_data.emplace_back(
279 shape_matrices[ip].dNdx,
281 shape_matrices[ip].integralMeasure *
282 shape_matrices[ip].detJ * aperture_size);
283
284 _ip_data[ip].porosity =
286 .template initialValue<double>(
287 pos, std::numeric_limits<double>::quiet_NaN() /*t*/);
288
289 _ip_data[ip].pushBackState();
290 }
291 }
292
293 void setChemicalSystemID(std::size_t const /*mesh_item_id*/) override
294 {
296 // chemical system index map
297 auto& chemical_system_index_map =
299
300 unsigned const n_integration_points =
302 for (unsigned ip = 0; ip < n_integration_points; ip++)
303 {
304 _ip_data[ip].chemical_system_id =
305 chemical_system_index_map.empty()
306 ? 0
307 : chemical_system_index_map.back() + 1;
308 chemical_system_index_map.push_back(
309 _ip_data[ip].chemical_system_id);
310 }
311 }
312
313 void initializeChemicalSystemConcrete(Eigen::VectorXd const& local_x,
314 double const t) override
315 {
317
318 auto const& medium =
320
323
324 auto const& Ns =
326 .NsHigherOrder<typename ShapeFunction::MeshElement>();
327
328 unsigned const n_integration_points =
330
331 for (unsigned ip = 0; ip < n_integration_points; ip++)
332 {
333 auto& ip_data = _ip_data[ip];
334 auto const& N = Ns[ip];
335 auto const& chemical_system_id = ip_data.chemical_system_id;
336
337 // set position with N as the shape matrix at the current
338 // integration point
342 N)));
343
344 auto const n_component = _transport_process_variables.size();
345 std::vector<double> C_int_pt(n_component);
346 for (unsigned component_id = 0; component_id < n_component;
347 ++component_id)
348 {
349 auto const concentration_index =
351 component_id * concentration_size;
352 auto const local_C =
353 local_x.template segment<concentration_size>(
354 concentration_index);
355
357 C_int_pt[component_id]);
358 }
359
361 ->initializeChemicalSystemConcrete(C_int_pt, chemical_system_id,
362 medium, pos, t);
363 }
364 }
365
366 void setChemicalSystemConcrete(Eigen::VectorXd const& local_x,
367 double const t, double dt) override
368 {
370
371 auto const& medium =
373
376
379
380 auto const& Ns =
382 .NsHigherOrder<typename ShapeFunction::MeshElement>();
383
384 unsigned const n_integration_points =
386
387 for (unsigned ip = 0; ip < n_integration_points; ip++)
388 {
389 auto& ip_data = _ip_data[ip];
390 auto const& N = Ns[ip];
391 auto& porosity = ip_data.porosity;
392 auto const& porosity_prev = ip_data.porosity_prev;
393 auto const& chemical_system_id = ip_data.chemical_system_id;
394
395 auto const n_component = _transport_process_variables.size();
396 std::vector<double> C_int_pt(n_component);
397 for (unsigned component_id = 0; component_id < n_component;
398 ++component_id)
399 {
400 auto const concentration_index =
402 component_id * concentration_size;
403 auto const local_C =
404 local_x.template segment<concentration_size>(
405 concentration_index);
406
408 C_int_pt[component_id]);
409 }
410
411 {
412 vars_prev.porosity = porosity_prev;
413
414 porosity =
416 ? porosity_prev
417 : medium
418 ->property(
420 .template value<double>(vars, vars_prev, pos, t,
421 dt);
422
423 vars.porosity = porosity;
424 }
425
427 C_int_pt, chemical_system_id, medium, vars, pos, t, dt);
428 }
429 }
430
431 void postSpeciationCalculation(std::size_t const ele_id, double const t,
432 double const dt) override
433 {
435 {
436 return;
437 }
438
439 auto const& medium = *_process_data.media_map.getMedium(ele_id);
440
442 pos.setElementID(ele_id);
443
444 for (auto& ip_data : _ip_data)
445 {
446 ip_data.porosity = ip_data.porosity_prev;
447
449 ->updateVolumeFractionPostReaction(ip_data.chemical_system_id,
450 medium, pos,
451 ip_data.porosity, t, dt);
452
454 ip_data.chemical_system_id, medium, ip_data.porosity);
455 }
456 }
457
458 void assemble(double const t, double const dt,
459 std::vector<double> const& local_x,
460 std::vector<double> const& /*local_x_prev*/,
461 std::vector<double>& local_M_data,
462 std::vector<double>& local_K_data,
463 std::vector<double>& local_b_data) override
464 {
465 auto const local_matrix_size = local_x.size();
466 // Nodal DOFs include pressure
467 int const num_nodal_dof = 1 + _transport_process_variables.size();
468 // This assertion is valid only if all nodal d.o.f. use the same shape
469 // matrices.
470 assert(local_matrix_size == ShapeFunction::NPOINTS * num_nodal_dof);
471
473 local_M_data, local_matrix_size, local_matrix_size);
475 local_K_data, local_matrix_size, local_matrix_size);
477 local_b_data, local_matrix_size);
478
479 // Get block matrices
480 auto Kpp = local_K.template block<pressure_size, pressure_size>(
482 auto Mpp = local_M.template block<pressure_size, pressure_size>(
484 auto Bp = local_b.template segment<pressure_size>(pressure_index);
485
486 auto local_p = Eigen::Map<const NodalVectorType>(
487 &local_x[pressure_index], pressure_size);
488
489 auto const& b =
492
493 auto const number_of_components = num_nodal_dof - 1;
494 for (int component_id = 0; component_id < number_of_components;
495 ++component_id)
496 {
497 /* Partitioned assembler matrix
498 * | pp | pc1 | pc2 | pc3 |
499 * |-----|-----|-----|-----|
500 * | c1p | c1c1| 0 | 0 |
501 * |-----|-----|-----|-----|
502 * | c2p | 0 | c2c2| 0 |
503 * |-----|-----|-----|-----|
504 * | c3p | 0 | 0 | c3c3|
505 */
506 auto concentration_index =
507 pressure_size + component_id * concentration_size;
508
509 auto KCC =
510 local_K.template block<concentration_size, concentration_size>(
511 concentration_index, concentration_index);
512 auto MCC =
513 local_M.template block<concentration_size, concentration_size>(
514 concentration_index, concentration_index);
515 auto MCp =
516 local_M.template block<concentration_size, pressure_size>(
517 concentration_index, pressure_index);
518 auto MpC =
519 local_M.template block<pressure_size, concentration_size>(
520 pressure_index, concentration_index);
521
522 auto local_C = Eigen::Map<const NodalVectorType>(
523 &local_x[concentration_index], concentration_size);
524
525 assembleBlockMatrices(b, component_id, t, dt, local_C, local_p, KCC,
526 MCC, MCp, MpC, Kpp, Mpp, Bp);
527
529 {
530 auto const stoichiometric_matrix =
533
534 assert(stoichiometric_matrix);
535
536 for (Eigen::SparseMatrix<double>::InnerIterator it(
537 *stoichiometric_matrix, component_id);
538 it;
539 ++it)
540 {
541 auto const stoichiometric_coefficient = it.value();
542 auto const coupled_component_id = it.row();
543 auto const kinetic_prefactor =
545 ->getKineticPrefactor(coupled_component_id);
546
547 auto const concentration_index =
548 pressure_size + component_id * concentration_size;
549 auto const coupled_concentration_index =
551 coupled_component_id * concentration_size;
552 auto KCmCn = local_K.template block<concentration_size,
554 concentration_index, coupled_concentration_index);
555
556 // account for the coupling between components
557 assembleKCmCn(component_id, t, dt, KCmCn,
558 stoichiometric_coefficient,
559 kinetic_prefactor);
560 }
561 }
562 }
563 }
564
566 GlobalDimVectorType const& b, int const component_id, double const t,
567 double const dt,
568 Eigen::Ref<const NodalVectorType> const& C_nodal_values,
569 Eigen::Ref<const NodalVectorType> const& p_nodal_values,
570 Eigen::Ref<LocalBlockMatrixType> KCC,
571 Eigen::Ref<LocalBlockMatrixType> MCC,
572 Eigen::Ref<LocalBlockMatrixType> MCp,
573 Eigen::Ref<LocalBlockMatrixType> MpC,
574 Eigen::Ref<LocalBlockMatrixType> Kpp,
575 Eigen::Ref<LocalBlockMatrixType> Mpp,
576 Eigen::Ref<LocalSegmentVectorType> Bp)
577 {
578 unsigned const n_integration_points =
580
583
585
586 // Get material properties
587 auto const& medium =
589 // Select the only valid for component transport liquid phase.
590 auto const& phase = medium.phase("AqueousLiquid");
591
592 // Assume that the component name is the same as the process variable
593 // name. Components are shifted by one because the first one is always
594 // pressure.
595 auto const& component = phase.component(
596 _transport_process_variables[component_id].get().getName());
597
598 LocalBlockMatrixType KCC_Laplacian =
599 LocalBlockMatrixType::Zero(concentration_size, concentration_size);
600
601 std::vector<GlobalDimVectorType> ip_flux_vector;
602 double average_velocity_norm = 0.0;
604 {
605 ip_flux_vector.reserve(n_integration_points);
606 }
607
608 auto const& Ns =
610 .NsHigherOrder<typename ShapeFunction::MeshElement>();
611
612 for (unsigned ip(0); ip < n_integration_points; ++ip)
613 {
614 auto& ip_data = _ip_data[ip];
615 auto const& dNdx = ip_data.dNdx;
616 auto const& N = Ns[ip];
617 auto const& w = ip_data.integration_weight;
618 auto& porosity = ip_data.porosity;
619
620 double C_int_pt = 0.0;
621 double p_int_pt = 0.0;
622
623 NumLib::shapeFunctionInterpolate(C_nodal_values, N, C_int_pt);
624 NumLib::shapeFunctionInterpolate(p_nodal_values, N, p_int_pt);
625
626 // set position with N as the shape matrix at the current
627 // integration point
631 N)));
632
633 vars.concentration = C_int_pt;
634 vars.liquid_phase_pressure = p_int_pt;
635
636 // update according to a particular porosity model
638 .template value<double>(vars, pos, t, dt);
639 vars.porosity = porosity;
640
641 auto const& retardation_factor =
643 .template value<double>(vars, pos, t, dt);
644
645 auto const& solute_dispersivity_transverse = medium.template value<
646 double>(
648
649 auto const& solute_dispersivity_longitudinal =
650 medium.template value<double>(
652 longitudinal_dispersivity);
653
654 // Use the fluid density model to compute the density
655 // TODO (renchao): concentration of which component as the argument
656 // for calculation of fluid density
657 auto const density =
659 .template value<double>(vars, pos, t, dt);
660
661 auto const decay_rate =
663 .template value<double>(vars, pos, t, dt);
664
665 auto const& pore_diffusion_coefficient =
668 .value(vars, pos, t, dt));
669
672 vars, pos, t, dt));
673
674 // Use the viscosity model to compute the viscosity
676 .template value<double>(vars, pos, t, dt);
677
678 GlobalDimMatrixType const K_over_mu = K / mu;
679 GlobalDimVectorType const velocity =
681 ? GlobalDimVectorType(-K_over_mu *
682 (dNdx * p_nodal_values - density * b))
683 : GlobalDimVectorType(-K_over_mu * dNdx * p_nodal_values);
684
685 const double drho_dp =
687 .template dValue<double>(
688 vars,
690 pos, t, dt);
691
692 const double drho_dC =
694 .template dValue<double>(
696 t, dt);
697
698 GlobalDimMatrixType const hydrodynamic_dispersion =
701 pore_diffusion_coefficient, velocity, porosity,
702 solute_dispersivity_transverse,
703 solute_dispersivity_longitudinal);
704
705 const double R_times_phi(retardation_factor * porosity);
706 GlobalDimVectorType const mass_density_flow = velocity * density;
707 auto const N_t_N = (N.transpose() * N).eval();
708
710 {
711 MCp.noalias() += N_t_N * (C_int_pt * R_times_phi * drho_dp * w);
712 MCC.noalias() += N_t_N * (C_int_pt * R_times_phi * drho_dC * w);
713 KCC.noalias() -= dNdx.transpose() * mass_density_flow * N * w;
714 }
715 else
716 {
717 ip_flux_vector.emplace_back(mass_density_flow);
718 average_velocity_norm += velocity.norm();
719 }
720 MCC.noalias() += N_t_N * (R_times_phi * density * w);
721 KCC.noalias() += N_t_N * (decay_rate * R_times_phi * density * w);
722 KCC_Laplacian.noalias() +=
723 dNdx.transpose() * hydrodynamic_dispersion * dNdx * density * w;
724
725 MpC.noalias() += N_t_N * (porosity * drho_dC * w);
726
727 // Calculate Mpp, Kpp, and bp in the first loop over components
728 if (component_id == 0)
729 {
730 Mpp.noalias() += N_t_N * (porosity * drho_dp * w);
731 Kpp.noalias() +=
732 dNdx.transpose() * K_over_mu * dNdx * (density * w);
733
735 {
736 Bp.noalias() += dNdx.transpose() * K_over_mu * b *
737 (density * density * w);
738 }
739 }
740 }
741
743 {
745 typename ShapeFunction::MeshElement>(
747 _ip_data,
749 ip_flux_vector,
750 average_velocity_norm /
751 static_cast<double>(n_integration_points),
752 KCC_Laplacian);
753 }
754
755 KCC.noalias() += KCC_Laplacian;
756 }
757
758 void assembleKCmCn(int const component_id, double const t, double const dt,
759 Eigen::Ref<LocalBlockMatrixType> KCmCn,
760 double const stoichiometric_coefficient,
761 double const kinetic_prefactor)
762 {
763 unsigned const n_integration_points =
765
768
770
771 auto const& medium =
773 auto const& phase = medium.phase("AqueousLiquid");
774 auto const& component = phase.component(
775 _transport_process_variables[component_id].get().getName());
776
777 auto const& Ns =
779 .NsHigherOrder<typename ShapeFunction::MeshElement>();
780
781 for (unsigned ip(0); ip < n_integration_points; ++ip)
782 {
783 auto& ip_data = _ip_data[ip];
784 auto const& w = ip_data.integration_weight;
785 auto const& N = Ns[ip];
786 auto& porosity = ip_data.porosity;
787
788 // set position with N as the shape matrix at the current
789 // integration point
793 N)));
794
795 auto const retardation_factor =
797 .template value<double>(vars, pos, t, dt);
798
800 .template value<double>(vars, pos, t, dt);
801
802 auto const density =
804 .template value<double>(vars, pos, t, dt);
805
806 KCmCn.noalias() -= w * N.transpose() * stoichiometric_coefficient *
807 kinetic_prefactor * retardation_factor *
808 porosity * density * N;
809 }
810 }
811
812 void assembleForStaggeredScheme(double const t, double const dt,
813 Eigen::VectorXd const& local_x,
814 Eigen::VectorXd const& local_x_prev,
815 int const process_id,
816 std::vector<double>& local_M_data,
817 std::vector<double>& local_K_data,
818 std::vector<double>& local_b_data) override
819 {
820 if (process_id == _process_data.hydraulic_process_id)
821 {
822 assembleHydraulicEquation(t, dt, local_x, local_x_prev,
823 local_M_data, local_K_data, local_b_data);
824 }
825 else if (process_id == _process_data.thermal_process_id)
826 {
827 assembleHeatTransportEquation(t, dt, local_x, local_x_prev,
828 local_M_data, local_K_data,
829 local_b_data);
830 }
831 else
832 {
833 // Go for assembling in an order of transport process id.
834 assembleComponentTransportEquation(t, dt, local_x, local_x_prev,
835 local_M_data, local_K_data,
836 local_b_data, process_id);
837 }
838 }
839
840 void assembleHydraulicEquation(double const t,
841 double const dt,
842 Eigen::VectorXd const& local_x,
843 Eigen::VectorXd const& local_x_prev,
844 std::vector<double>& local_M_data,
845 std::vector<double>& local_K_data,
846 std::vector<double>& local_b_data)
847 {
848 auto const local_p =
849 local_x.template segment<pressure_size>(pressure_index);
850 auto const local_C = local_x.template segment<concentration_size>(
852 auto const local_C_prev =
853 local_x_prev.segment<concentration_size>(first_concentration_index);
854
855 NodalVectorType local_T = getLocalTemperature(t, local_x);
856
858 local_M_data, pressure_size, pressure_size);
860 local_K_data, pressure_size, pressure_size);
862 local_b_data, pressure_size);
863
864 unsigned const n_integration_points =
866
869
870 auto const& b =
873
874 auto const& medium =
876 auto const& phase = medium.phase("AqueousLiquid");
877
880
881 auto const& Ns =
883 .NsHigherOrder<typename ShapeFunction::MeshElement>();
884
885 for (unsigned ip(0); ip < n_integration_points; ++ip)
886 {
887 auto& ip_data = _ip_data[ip];
888 auto const& dNdx = ip_data.dNdx;
889 auto const& w = ip_data.integration_weight;
890 auto const& N = Ns[ip];
891 auto& porosity = ip_data.porosity;
892 auto const& porosity_prev = ip_data.porosity_prev;
893
894 double const C_int_pt = N.dot(local_C);
895 double const p_int_pt = N.dot(local_p);
896 double const T_int_pt = N.dot(local_T);
897
898 vars.concentration = C_int_pt;
899 vars.liquid_phase_pressure = p_int_pt;
900 vars.temperature = T_int_pt;
901
902 // porosity
903 {
904 vars_prev.porosity = porosity_prev;
905
906 porosity =
908 ? porosity_prev
910 .template value<double>(vars, vars_prev, pos, t,
911 dt);
912
913 vars.porosity = porosity;
914 }
915
916 // Use the fluid density model to compute the density
917 // TODO: Concentration of which component as one of arguments for
918 // calculation of fluid density
919 auto const density =
921 .template value<double>(vars, pos, t, dt);
922
925 vars, pos, t, dt));
926
927 // Use the viscosity model to compute the viscosity
929 .template value<double>(vars, pos, t, dt);
930
931 GlobalDimMatrixType const K_over_mu = K / mu;
932
933 const double drho_dp =
935 .template dValue<double>(
936 vars,
938 pos, t, dt);
939 const double drho_dC =
941 .template dValue<double>(
943 t, dt);
944
945 // matrix assembly
946 local_M.noalias() += w * N.transpose() * porosity * drho_dp * N;
947 local_K.noalias() +=
948 w * dNdx.transpose() * density * K_over_mu * dNdx;
949
951 {
952 local_b.noalias() +=
953 w * density * density * dNdx.transpose() * K_over_mu * b;
954 }
955
956 // coupling term
957 {
958 double const C_dot = (C_int_pt - N.dot(local_C_prev)) / dt;
959
960 local_b.noalias() -=
961 w * N.transpose() * porosity * drho_dC * C_dot;
962 }
963 }
964 }
965
966 void assembleHeatTransportEquation(double const t, double const dt,
967 Eigen::VectorXd const& local_x,
968 Eigen::VectorXd const& /*local_x_prev*/,
969 std::vector<double>& local_M_data,
970 std::vector<double>& local_K_data,
971 std::vector<double>& /*local_b_data*/)
972 {
973 // In the staggered HTC process, number of components might be non-zero.
974 assert(local_x.size() ==
977 static_cast<int>(_transport_process_variables.size()));
978
979 auto const local_p =
980 local_x.template segment<pressure_size>(pressure_index);
981 auto const local_T = getLocalTemperature(t, local_x);
982
984 local_M_data, temperature_size, temperature_size);
986 local_K_data, temperature_size, temperature_size);
987
989 pos.setElementID(this->_element.getID());
990
991 auto const& process_data = this->_process_data;
992 auto const& medium =
993 *process_data.media_map.getMedium(this->_element.getID());
994 auto const& liquid_phase = medium.phase("AqueousLiquid");
995
996 auto const& b =
999
1001
1002 unsigned const n_integration_points =
1004
1005 std::vector<GlobalDimVectorType> ip_flux_vector;
1006 double average_velocity_norm = 0.0;
1007 ip_flux_vector.reserve(n_integration_points);
1008
1009 auto const& Ns =
1011 .NsHigherOrder<typename ShapeFunction::MeshElement>();
1012
1013 for (unsigned ip(0); ip < n_integration_points; ip++)
1014 {
1015 auto const& ip_data = this->_ip_data[ip];
1016 auto const& dNdx = ip_data.dNdx;
1017 auto const& w = ip_data.integration_weight;
1018 auto const& N = Ns[ip];
1019
1021 {}, this->_element.getID(),
1025 N)));
1026
1027 double p_at_xi = 0.;
1028 NumLib::shapeFunctionInterpolate(local_p, N, p_at_xi);
1029 double T_at_xi = 0.;
1030 NumLib::shapeFunctionInterpolate(local_T, N, T_at_xi);
1031
1032 vars.temperature = T_at_xi;
1033 vars.liquid_phase_pressure = p_at_xi;
1034
1035 vars.liquid_saturation = 1.0;
1036
1037 auto const porosity =
1039 .template value<double>(vars, pos, t, dt);
1040 vars.porosity = porosity;
1041
1042 // Use the fluid density model to compute the density
1043 auto const fluid_density =
1044 liquid_phase
1046 .template value<double>(vars, pos, t, dt);
1047 vars.density = fluid_density;
1048 auto const specific_heat_capacity_fluid =
1049 liquid_phase
1051 .template value<double>(vars, pos, t, dt);
1052
1053 // Assemble mass matrix
1054 local_M.noalias() += w *
1056 vars, porosity, fluid_density,
1057 specific_heat_capacity_fluid, pos, t, dt) *
1058 N.transpose() * N;
1059
1060 // Assemble Laplace matrix
1061 auto const viscosity =
1062 liquid_phase
1064 .template value<double>(vars, pos, t, dt);
1065
1066 auto const intrinsic_permeability =
1068 medium
1069 .property(
1071 .value(vars, pos, t, dt));
1072
1073 GlobalDimMatrixType const K_over_mu =
1074 intrinsic_permeability / viscosity;
1075 GlobalDimVectorType const velocity =
1076 process_data.has_gravity
1077 ? GlobalDimVectorType(-K_over_mu *
1078 (dNdx * local_p - fluid_density * b))
1079 : GlobalDimVectorType(-K_over_mu * dNdx * local_p);
1080
1081 GlobalDimMatrixType const thermal_conductivity_dispersivity =
1083 vars, fluid_density, specific_heat_capacity_fluid, velocity,
1084 pos, t, dt);
1085
1086 local_K.noalias() +=
1087 w * dNdx.transpose() * thermal_conductivity_dispersivity * dNdx;
1088
1089 ip_flux_vector.emplace_back(velocity * fluid_density *
1090 specific_heat_capacity_fluid);
1091 average_velocity_norm += velocity.norm();
1092 }
1093
1095 process_data.stabilizer, this->_ip_data,
1096 _process_data.shape_matrix_cache, ip_flux_vector,
1097 average_velocity_norm / static_cast<double>(n_integration_points),
1098 local_K);
1099 }
1100
1102 double const t, double const dt, Eigen::VectorXd const& local_x,
1103 Eigen::VectorXd const& local_x_prev, std::vector<double>& local_M_data,
1104 std::vector<double>& local_K_data,
1105 std::vector<double>& /*local_b_data*/, int const transport_process_id)
1106 {
1107 assert(static_cast<int>(local_x.size()) ==
1110 static_cast<int>(_transport_process_variables.size()) +
1112
1113 auto const local_p =
1114 local_x.template segment<pressure_size>(pressure_index);
1115
1116 NodalVectorType local_T = getLocalTemperature(t, local_x);
1117
1118 auto const local_C = local_x.template segment<concentration_size>(
1120 (transport_process_id - (_process_data.isothermal ? 1 : 2)) *
1122 auto const local_p_prev =
1123 local_x_prev.segment<pressure_size>(pressure_index);
1124
1126 local_M_data, concentration_size, concentration_size);
1128 local_K_data, concentration_size, concentration_size);
1129
1130 LocalBlockMatrixType KCC_Laplacian =
1131 LocalBlockMatrixType::Zero(concentration_size, concentration_size);
1132
1133 unsigned const n_integration_points =
1135
1136 std::vector<GlobalDimVectorType> ip_flux_vector;
1137 double average_velocity_norm = 0.0;
1139 {
1140 ip_flux_vector.reserve(n_integration_points);
1141 }
1142
1145
1146 auto const& b =
1149
1152
1153 auto const& medium =
1155 auto const& phase = medium.phase("AqueousLiquid");
1156 auto const component_id =
1157 transport_process_id - (_process_data.isothermal ? 1 : 2);
1158 auto const& component = phase.component(
1159 _transport_process_variables[component_id].get().getName());
1160
1161 auto const& Ns =
1163 .NsHigherOrder<typename ShapeFunction::MeshElement>();
1164
1165 for (unsigned ip(0); ip < n_integration_points; ++ip)
1166 {
1167 auto& ip_data = _ip_data[ip];
1168 auto const& dNdx = ip_data.dNdx;
1169 auto const& w = ip_data.integration_weight;
1170 auto const& N = Ns[ip];
1171 auto& porosity = ip_data.porosity;
1172 auto const& porosity_prev = ip_data.porosity_prev;
1173
1174 double const C_int_pt = N.dot(local_C);
1175 double const p_int_pt = N.dot(local_p);
1176 double const T_int_pt = N.dot(local_T);
1177
1178 vars.concentration = C_int_pt;
1179 vars.liquid_phase_pressure = p_int_pt;
1180 vars.temperature = T_int_pt;
1181
1183 {
1184 vars.temperature = N.dot(local_T);
1185 }
1186
1187 // porosity
1188 {
1189 vars_prev.porosity = porosity_prev;
1190
1191 porosity =
1193 ? porosity_prev
1195 .template value<double>(vars, vars_prev, pos, t,
1196 dt);
1197
1198 vars.porosity = porosity;
1199 }
1200
1201 auto const& retardation_factor =
1203 .template value<double>(vars, pos, t, dt);
1204
1205 auto const& solute_dispersivity_transverse = medium.template value<
1206 double>(
1208 auto const& solute_dispersivity_longitudinal =
1209 medium.template value<double>(
1211 longitudinal_dispersivity);
1212
1213 // Use the fluid density model to compute the density
1214 auto const density =
1216 .template value<double>(vars, pos, t, dt);
1217 auto const decay_rate =
1219 .template value<double>(vars, pos, t, dt);
1220
1221 auto const& pore_diffusion_coefficient =
1224 .value(vars, pos, t, dt));
1225
1228 vars, pos, t, dt));
1229 // Use the viscosity model to compute the viscosity
1231 .template value<double>(vars, pos, t, dt);
1232
1233 GlobalDimMatrixType const K_over_mu = K / mu;
1234 GlobalDimVectorType const velocity =
1236 ? GlobalDimVectorType(-K_over_mu *
1237 (dNdx * local_p - density * b))
1238 : GlobalDimVectorType(-K_over_mu * dNdx * local_p);
1239
1240 GlobalDimMatrixType const hydrodynamic_dispersion =
1243 pore_diffusion_coefficient, velocity, porosity,
1244 solute_dispersivity_transverse,
1245 solute_dispersivity_longitudinal);
1246
1247 double const R_times_phi = retardation_factor * porosity;
1248 auto const N_t_N = (N.transpose() * N).eval();
1249
1251 {
1252 const double drho_dC =
1254 .template dValue<double>(
1256 pos, t, dt);
1257 local_M.noalias() +=
1258 N_t_N * (R_times_phi * C_int_pt * drho_dC * w);
1259 }
1260
1261 local_M.noalias() += N_t_N * (R_times_phi * density * w);
1262
1263 // coupling term
1265 {
1266 double const p_dot = (p_int_pt - N.dot(local_p_prev)) / dt;
1267
1268 const double drho_dp =
1270 .template dValue<double>(vars,
1272 liquid_phase_pressure,
1273 pos, t, dt);
1274
1275 local_K.noalias() +=
1276 N_t_N * ((R_times_phi * drho_dp * p_dot) * w) -
1277 dNdx.transpose() * velocity * N * (density * w);
1278 }
1279 else
1280 {
1281 ip_flux_vector.emplace_back(velocity * density);
1282 average_velocity_norm += velocity.norm();
1283 }
1284 local_K.noalias() +=
1285 N_t_N * (decay_rate * R_times_phi * density * w);
1286
1287 KCC_Laplacian.noalias() += dNdx.transpose() *
1288 hydrodynamic_dispersion * dNdx *
1289 (density * w);
1290 }
1291
1293 {
1295 typename ShapeFunction::MeshElement>(
1297 _process_data.shape_matrix_cache, ip_flux_vector,
1298 average_velocity_norm /
1299 static_cast<double>(n_integration_points),
1300 KCC_Laplacian);
1301 }
1302 local_K.noalias() += KCC_Laplacian;
1303 }
1304
1306 double const t, double const dt, Eigen::VectorXd const& local_x,
1307 Eigen::VectorXd const& local_x_prev, int const process_id,
1308 std::vector<double>& local_b_data,
1309 std::vector<double>& local_Jac_data) override
1310 {
1311 if (process_id == _process_data.hydraulic_process_id)
1312 {
1313 assembleWithJacobianHydraulicEquation(t, dt, local_x, local_x_prev,
1314 local_b_data, local_Jac_data);
1315 }
1316 else
1317 {
1318 int const component_id = process_id - 1;
1320 t, dt, local_x, local_x_prev, local_b_data, local_Jac_data,
1321 component_id);
1322 }
1323 }
1324
1326 double const t, double const dt, Eigen::VectorXd const& local_x,
1327 Eigen::VectorXd const& local_x_prev, std::vector<double>& local_b_data,
1328 std::vector<double>& local_Jac_data)
1329 {
1330 auto const p = local_x.template segment<pressure_size>(pressure_index);
1331 auto const c = local_x.template segment<concentration_size>(
1333
1334 auto const p_prev = local_x_prev.segment<pressure_size>(pressure_index);
1335 auto const c_prev =
1336 local_x_prev.segment<concentration_size>(first_concentration_index);
1337
1339 local_Jac_data, pressure_size, pressure_size);
1341 local_b_data, pressure_size);
1342
1343 unsigned const n_integration_points =
1345
1348 auto const& b =
1351
1352 auto const& medium =
1354 auto const& phase = medium.phase("AqueousLiquid");
1355
1358
1359 auto const& Ns =
1361 .NsHigherOrder<typename ShapeFunction::MeshElement>();
1362
1363 for (unsigned ip(0); ip < n_integration_points; ++ip)
1364 {
1365 auto& ip_data = _ip_data[ip];
1366 auto const& dNdx = ip_data.dNdx;
1367 auto const& w = ip_data.integration_weight;
1368 auto const& N = Ns[ip];
1369 auto& phi = ip_data.porosity;
1370 auto const& phi_prev = ip_data.porosity_prev;
1371
1372 double const p_ip = N.dot(p);
1373 double const c_ip = N.dot(c);
1374
1375 double const cdot_ip = (c_ip - N.dot(c_prev)) / dt;
1376
1377 vars.liquid_phase_pressure = p_ip;
1378 vars.concentration = c_ip;
1379
1380 // porosity
1381 {
1382 vars_prev.porosity = phi_prev;
1383
1385 ? phi_prev
1387 .template value<double>(vars, vars_prev, pos, t,
1388 dt);
1389
1390 vars.porosity = phi;
1391 }
1392
1393 auto const rho = phase[MaterialPropertyLib::PropertyType::density]
1394 .template value<double>(vars, pos, t, dt);
1395
1398 vars, pos, t, dt));
1399
1401 .template value<double>(vars, pos, t, dt);
1402
1403 auto const drho_dp =
1405 .template dValue<double>(
1406 vars,
1408 pos, t, dt);
1409 auto const drho_dc =
1411 .template dValue<double>(
1413 t, dt);
1414
1415 // matrix assembly
1416 local_Jac.noalias() += w * N.transpose() * phi * drho_dp / dt * N +
1417 w * dNdx.transpose() * rho * k / mu * dNdx;
1418
1419 local_rhs.noalias() -=
1420 w * N.transpose() * phi *
1421 (drho_dp * N * p_prev + drho_dc * cdot_ip) +
1422 w * rho * dNdx.transpose() * k / mu * dNdx * p;
1423
1425 {
1426 local_rhs.noalias() +=
1427 w * rho * dNdx.transpose() * k / mu * rho * b;
1428 }
1429 }
1430 }
1431
1433 double const t, double const dt, Eigen::VectorXd const& local_x,
1434 Eigen::VectorXd const& local_x_prev, std::vector<double>& local_b_data,
1435 std::vector<double>& local_Jac_data, int const component_id)
1436 {
1437 auto const concentration_index =
1439
1440 auto const p = local_x.template segment<pressure_size>(pressure_index);
1441 auto const c =
1442 local_x.template segment<concentration_size>(concentration_index);
1443 auto const c_prev =
1444 local_x_prev.segment<concentration_size>(concentration_index);
1445
1448 {
1450 }
1451
1453 local_Jac_data, concentration_size, concentration_size);
1455 local_b_data, concentration_size);
1456
1457 LocalBlockMatrixType KCC_Laplacian =
1458 LocalBlockMatrixType::Zero(concentration_size, concentration_size);
1459
1460 unsigned const n_integration_points =
1462
1463 std::vector<GlobalDimVectorType> ip_flux_vector;
1464 double average_velocity_norm = 0.0;
1465 ip_flux_vector.reserve(n_integration_points);
1466
1469
1470 auto const& b =
1473
1476
1477 auto const& medium =
1479 auto const& phase = medium.phase("AqueousLiquid");
1480 auto const& component = phase.component(
1481 _transport_process_variables[component_id].get().getName());
1482
1483 auto const& Ns =
1485 .NsHigherOrder<typename ShapeFunction::MeshElement>();
1486
1487 for (unsigned ip(0); ip < n_integration_points; ++ip)
1488 {
1489 auto& ip_data = _ip_data[ip];
1490 auto const& dNdx = ip_data.dNdx;
1491 auto const& w = ip_data.integration_weight;
1492 auto const& N = Ns[ip];
1493 auto& phi = ip_data.porosity;
1494 auto const& phi_prev = ip_data.porosity_prev;
1495
1496 double const p_ip = N.dot(p);
1497 double const c_ip = N.dot(c);
1498
1499 vars.liquid_phase_pressure = p_ip;
1500 vars.concentration = c_ip;
1501
1503 {
1504 vars.temperature = N.dot(T);
1505 }
1506
1507 // porosity
1508 {
1509 vars_prev.porosity = phi_prev;
1510
1512 ? phi_prev
1514 .template value<double>(vars, vars_prev, pos, t,
1515 dt);
1516
1517 vars.porosity = phi;
1518 }
1519
1520 auto const R =
1522 .template value<double>(vars, pos, t, dt);
1523
1524 auto const alpha_T = medium.template value<double>(
1526 auto const alpha_L = medium.template value<double>(
1528
1529 auto const rho = phase[MaterialPropertyLib::PropertyType::density]
1530 .template value<double>(vars, pos, t, dt);
1531 // first-order decay constant
1532 auto const alpha =
1534 .template value<double>(vars, pos, t, dt);
1535
1538 .value(vars, pos, t, dt));
1539
1542 vars, pos, t, dt));
1544 .template value<double>(vars, pos, t, dt);
1545 // Darcy flux
1546 GlobalDimVectorType const q =
1548 ? GlobalDimVectorType(-k / mu * (dNdx * p - rho * b))
1549 : GlobalDimVectorType(-k / mu * dNdx * p);
1550
1552 _process_data.stabilizer, _element.getID(), Dp, q, phi, alpha_T,
1553 alpha_L);
1554
1555 // matrix assembly
1556 local_Jac.noalias() +=
1557 w * rho * N.transpose() * phi * R * (alpha + 1 / dt) * N;
1558
1559 KCC_Laplacian.noalias() += w * rho * dNdx.transpose() * D * dNdx;
1560
1561 auto const cdot = (c - c_prev) / dt;
1562 local_rhs.noalias() -=
1563 w * rho * N.transpose() * phi * R * N * (cdot + alpha * c);
1564
1565 ip_flux_vector.emplace_back(q * rho);
1566 average_velocity_norm += q.norm();
1567 }
1568
1571 _process_data.shape_matrix_cache, ip_flux_vector,
1572 average_velocity_norm / static_cast<double>(n_integration_points),
1573 KCC_Laplacian);
1574
1575 local_rhs.noalias() -= KCC_Laplacian * c;
1576
1577 local_Jac.noalias() += KCC_Laplacian;
1578 }
1579
1581 double const t, double const dt, Eigen::VectorXd const& local_x,
1582 std::vector<double>& local_M_data, std::vector<double>& local_K_data,
1583 std::vector<double>& local_b_data,
1584 int const transport_process_id) override
1585 {
1586 auto const local_C = local_x.template segment<concentration_size>(
1588 (transport_process_id - 1) * concentration_size);
1589
1591 local_M_data, concentration_size, concentration_size);
1593 local_K_data, concentration_size, concentration_size);
1595 local_b_data, concentration_size);
1596
1597 unsigned const n_integration_points =
1599
1602
1605
1606 auto const& medium =
1608 auto const component_id = transport_process_id - 1;
1609
1610 auto const& Ns =
1612 .NsHigherOrder<typename ShapeFunction::MeshElement>();
1613
1614 for (unsigned ip(0); ip < n_integration_points; ++ip)
1615 {
1616 auto& ip_data = _ip_data[ip];
1617 auto const w = ip_data.integration_weight;
1618 auto const& N = Ns[ip];
1619 auto& porosity = ip_data.porosity;
1620 auto const& porosity_prev = ip_data.porosity_prev;
1621 auto const chemical_system_id = ip_data.chemical_system_id;
1622
1623 double C_int_pt = 0.0;
1624 NumLib::shapeFunctionInterpolate(local_C, N, C_int_pt);
1625
1626 vars.concentration = C_int_pt;
1627
1628 auto const porosity_dot = (porosity - porosity_prev) / dt;
1629
1630 // porosity
1631 {
1632 vars_prev.porosity = porosity_prev;
1633
1634 porosity =
1636 ? porosity_prev
1638 .template value<double>(vars, vars_prev, pos, t,
1639 dt);
1640 }
1641
1642 local_M.noalias() += w * N.transpose() * porosity * N;
1643
1644 local_K.noalias() += w * N.transpose() * porosity_dot * N;
1645
1646 if (chemical_system_id == -1)
1647 {
1648 continue;
1649 }
1650
1651 auto const C_post_int_pt =
1653 component_id, chemical_system_id);
1654
1655 local_b.noalias() +=
1656 w * N.transpose() * porosity * (C_post_int_pt - C_int_pt) / dt;
1657 }
1658 }
1659
1660 std::vector<double> const& getIntPtDarcyVelocity(
1661 const double t,
1662 std::vector<GlobalVector*> const& x,
1663 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
1664 std::vector<double>& cache) const override
1665 {
1666 assert(x.size() == dof_table.size());
1667
1668 auto const n_processes = x.size();
1669 std::vector<std::vector<double>> local_x;
1670 local_x.reserve(n_processes);
1671
1672 for (std::size_t process_id = 0; process_id < n_processes; ++process_id)
1673 {
1674 auto const indices =
1675 NumLib::getIndices(_element.getID(), *dof_table[process_id]);
1676 assert(!indices.empty());
1677 local_x.push_back(x[process_id]->get(indices));
1678 }
1679
1680 // only one process, must be monolithic.
1681 if (n_processes == 1)
1682 {
1683 auto const local_p = Eigen::Map<const NodalVectorType>(
1684 &local_x[0][pressure_index], pressure_size);
1685 auto const local_C = Eigen::Map<const NodalVectorType>(
1687 NodalVectorType local_T;
1688 local_T.setConstant(ShapeFunction::NPOINTS,
1689 std::numeric_limits<double>::quiet_NaN());
1690 int const temperature_index =
1691 _process_data.isothermal ? -1 : ShapeFunction::NPOINTS;
1692 if (temperature_index != -1)
1693 {
1694 local_T = Eigen::Map<const NodalVectorType>(
1695 &local_x[0][temperature_index], temperature_size);
1696 }
1697 return calculateIntPtDarcyVelocity(t, local_p, local_C, local_T,
1698 cache);
1699 }
1700
1701 // multiple processes, must be staggered.
1702 {
1703 constexpr int pressure_process_id = 0;
1704 int concentration_process_id = 1;
1705 // Normally temperature process is not there,
1706 // hence set the default temperature index to -1
1707 int temperature_process_id = -1;
1708
1709 // check whether temperature process exists
1711 {
1712 // if temperature process exists, its id is 1
1713 temperature_process_id = 1;
1714 // then the concentration index shifts to 2
1715 concentration_process_id = 2;
1716 }
1717
1718 auto const local_p = Eigen::Map<const NodalVectorType>(
1719 &local_x[pressure_process_id][0], pressure_size);
1720 auto const local_C = Eigen::Map<const NodalVectorType>(
1721 &local_x[concentration_process_id][0], concentration_size);
1722 NodalVectorType local_T;
1723 local_T.setConstant(ShapeFunction::NPOINTS,
1724 std::numeric_limits<double>::quiet_NaN());
1725 if (temperature_process_id != -1)
1726 {
1727 local_T = Eigen::Map<const NodalVectorType>(
1728 &local_x[temperature_process_id][0], temperature_size);
1729 }
1730 return calculateIntPtDarcyVelocity(t, local_p, local_C, local_T,
1731 cache);
1732 }
1733 }
1734
1735 std::vector<double> const& calculateIntPtDarcyVelocity(
1736 const double t,
1737 Eigen::Ref<const NodalVectorType> const& p_nodal_values,
1738 Eigen::Ref<const NodalVectorType> const& C_nodal_values,
1739 Eigen::Ref<const NodalVectorType> const& T_nodal_values,
1740 std::vector<double>& cache) const
1741 {
1742 auto const n_integration_points =
1744
1745 cache.clear();
1746 auto cache_mat = MathLib::createZeroedMatrix<
1747 Eigen::Matrix<double, GlobalDim, Eigen::Dynamic, Eigen::RowMajor>>(
1748 cache, GlobalDim, n_integration_points);
1749
1752
1753 auto const& b =
1756
1758
1759 auto const& medium =
1761 auto const& phase = medium.phase("AqueousLiquid");
1762
1763 auto const& Ns =
1765 .NsHigherOrder<typename ShapeFunction::MeshElement>();
1766
1767 for (unsigned ip = 0; ip < n_integration_points; ++ip)
1768 {
1769 auto const& ip_data = _ip_data[ip];
1770 auto const& dNdx = ip_data.dNdx;
1771 auto const& N = Ns[ip];
1772 auto const& porosity = ip_data.porosity;
1773
1774 double C_int_pt = 0.0;
1775 double p_int_pt = 0.0;
1776 double T_int_pt = 0.0;
1777
1778 NumLib::shapeFunctionInterpolate(C_nodal_values, N, C_int_pt);
1779 NumLib::shapeFunctionInterpolate(p_nodal_values, N, p_int_pt);
1780 NumLib::shapeFunctionInterpolate(T_nodal_values, N, T_int_pt);
1781
1782 vars.concentration = C_int_pt;
1783 vars.liquid_phase_pressure = p_int_pt;
1784 vars.porosity = porosity;
1785 vars.temperature = T_int_pt;
1786
1787 // TODO (naumov) Temporary value not used by current material
1788 // models. Need extension of secondary variables interface.
1789 double const dt = std::numeric_limits<double>::quiet_NaN();
1792 vars, pos, t, dt));
1794 .template value<double>(vars, pos, t, dt);
1795 GlobalDimMatrixType const K_over_mu = K / mu;
1796
1797 cache_mat.col(ip).noalias() = -K_over_mu * dNdx * p_nodal_values;
1799 {
1800 auto const rho_w =
1802 .template value<double>(vars, pos, t, dt);
1803 // here it is assumed that the vector b is directed 'downwards'
1804 cache_mat.col(ip).noalias() += K_over_mu * rho_w * b;
1805 }
1806 }
1807
1808 return cache;
1809 }
1810
1811 Eigen::Map<const Eigen::RowVectorXd> getShapeMatrix(
1812 const unsigned integration_point) const override
1813 {
1815 typename ShapeFunction::MeshElement>()[integration_point];
1816
1817 // assumes N is stored contiguously in memory
1818 return Eigen::Map<const Eigen::RowVectorXd>(N.data(), N.size());
1819 }
1820
1821 Eigen::Vector3d getFlux(MathLib::Point3d const& pnt_local_coords,
1822 double const t,
1823 std::vector<double> const& local_x) const override
1824 {
1825 auto const local_p = Eigen::Map<const NodalVectorType>(
1826 &local_x[pressure_index], pressure_size);
1827 auto const local_C = Eigen::Map<const NodalVectorType>(
1829
1830 // Eval shape matrices at given point
1831 // Note: Axial symmetry is set to false here, because we only need dNdx
1832 // here, which is not affected by axial symmetry.
1833 auto const shape_matrices =
1835 GlobalDim>(
1836 _element, false /*is_axially_symmetric*/,
1837 std::array{pnt_local_coords})[0];
1838
1841 auto const& b =
1844
1846
1847 auto const& medium =
1849 auto const& phase = medium.phase("AqueousLiquid");
1850
1851 // local_x contains the local concentration and pressure values
1852 double c_int_pt;
1853 NumLib::shapeFunctionInterpolate(local_C, shape_matrices.N, c_int_pt);
1854 vars.concentration = c_int_pt;
1855
1856 double p_int_pt;
1857 NumLib::shapeFunctionInterpolate(local_p, shape_matrices.N, p_int_pt);
1858 vars.liquid_phase_pressure = p_int_pt;
1859
1860 // TODO (naumov) Temporary value not used by current material models.
1861 // Need extension of secondary variables interface.
1862 double const dt = std::numeric_limits<double>::quiet_NaN();
1865 vars, pos, t, dt));
1866
1868 .template value<double>(vars, pos, t, dt);
1869 GlobalDimMatrixType const K_over_mu = K / mu;
1870
1871 GlobalDimVectorType q = -K_over_mu * shape_matrices.dNdx * local_p;
1872 auto const rho_w = phase[MaterialPropertyLib::PropertyType::density]
1873 .template value<double>(vars, pos, t, dt);
1875 {
1876 q += K_over_mu * rho_w * b;
1877 }
1878 Eigen::Vector3d flux(0.0, 0.0, 0.0);
1879 flux.head<GlobalDim>() = rho_w * q;
1880 return flux;
1881 }
1882
1884 double const t,
1885 double const /*dt*/,
1886 Eigen::VectorXd const& local_x,
1887 Eigen::VectorXd const& /*local_x_prev*/) override
1888 {
1889 auto const local_p =
1890 local_x.template segment<pressure_size>(pressure_index);
1891 auto const local_C = local_x.template segment<concentration_size>(
1893 auto const local_T = getLocalTemperature(t, local_x);
1894
1895 std::vector<double> ele_velocity;
1896 calculateIntPtDarcyVelocity(t, local_p, local_C, local_T, ele_velocity);
1897
1898 auto const n_integration_points =
1900 auto const ele_velocity_mat =
1901 MathLib::toMatrix(ele_velocity, GlobalDim, n_integration_points);
1902
1903 auto const ele_id = _element.getID();
1904 Eigen::Map<LocalVectorType>(
1905 &(*_process_data.mesh_prop_velocity)[ele_id * GlobalDim],
1906 GlobalDim) =
1907 ele_velocity_mat.rowwise().sum() / n_integration_points;
1908 }
1909
1911 std::size_t const ele_id) override
1912 {
1913 auto const n_integration_points =
1915
1917 {
1918 auto const& medium = *_process_data.media_map.getMedium(ele_id);
1919
1920 for (auto& ip_data : _ip_data)
1921 {
1922 ip_data.porosity = ip_data.porosity_prev;
1923
1925 ->updatePorosityPostReaction(ip_data.chemical_system_id,
1926 medium, ip_data.porosity);
1927 }
1928
1930 std::accumulate(_ip_data.begin(), _ip_data.end(), 0.,
1931 [](double const s, auto const& ip)
1932 { return s + ip.porosity; }) /
1933 n_integration_points;
1934 }
1935
1936 std::vector<GlobalIndexType> chemical_system_indices;
1937 chemical_system_indices.reserve(n_integration_points);
1938 std::transform(_ip_data.begin(), _ip_data.end(),
1939 std::back_inserter(chemical_system_indices),
1940 [](auto const& ip_data)
1941 { return ip_data.chemical_system_id; });
1942
1944 ele_id, chemical_system_indices);
1945 }
1946
1947 std::vector<double> const& getIntPtMolarFlux(
1948 const double t, std::vector<GlobalVector*> const& x,
1949 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_tables,
1950 std::vector<double>& cache, int const component_id) const override
1951 {
1952 std::vector<double> local_x_vec;
1953
1954 auto const n_processes = x.size();
1955 for (std::size_t process_id = 0; process_id < n_processes; ++process_id)
1956 {
1957 auto const indices =
1958 NumLib::getIndices(_element.getID(), *dof_tables[process_id]);
1959 assert(!indices.empty());
1960 auto const local_solution = x[process_id]->get(indices);
1961 local_x_vec.insert(std::end(local_x_vec),
1962 std::begin(local_solution),
1963 std::end(local_solution));
1964 }
1965 auto const local_x = MathLib::toVector(local_x_vec);
1966
1967 auto const p = local_x.template segment<pressure_size>(pressure_index);
1968 auto const c = local_x.template segment<concentration_size>(
1970
1971 auto const n_integration_points =
1973
1974 cache.clear();
1975 auto cache_mat = MathLib::createZeroedMatrix<
1976 Eigen::Matrix<double, GlobalDim, Eigen::Dynamic, Eigen::RowMajor>>(
1977 cache, GlobalDim, n_integration_points);
1978
1981
1982 auto const& b =
1985
1987
1988 auto const& medium =
1990 auto const& phase = medium.phase("AqueousLiquid");
1991
1992 auto const& component = phase.component(
1993 _transport_process_variables[component_id].get().getName());
1994
1995 auto const& Ns =
1997 .NsHigherOrder<typename ShapeFunction::MeshElement>();
1998
1999 for (unsigned ip = 0; ip < n_integration_points; ++ip)
2000 {
2001 auto const& ip_data = _ip_data[ip];
2002 auto const& dNdx = ip_data.dNdx;
2003 auto const& N = Ns[ip];
2004 auto const& phi = ip_data.porosity;
2005
2006 double const p_ip = N.dot(p);
2007 double const c_ip = N.dot(c);
2008
2009 vars.concentration = c_ip;
2010 vars.liquid_phase_pressure = p_ip;
2011 vars.porosity = phi;
2012
2013 double const dt = std::numeric_limits<double>::quiet_NaN();
2014
2017 vars, pos, t, dt));
2019 .template value<double>(vars, pos, t, dt);
2020 auto const rho = phase[MaterialPropertyLib::PropertyType::density]
2021 .template value<double>(vars, pos, t, dt);
2022
2023 // Darcy flux
2024 GlobalDimVectorType const q =
2026 ? GlobalDimVectorType(-k / mu * (dNdx * p - rho * b))
2027 : GlobalDimVectorType(-k / mu * dNdx * p);
2028
2029 auto const alpha_T = medium.template value<double>(
2031 auto const alpha_L = medium.template value<double>(
2035 .value(vars, pos, t, dt));
2036
2037 // Hydrodynamic dispersion
2039 _process_data.stabilizer, _element.getID(), Dp, q, phi, alpha_T,
2040 alpha_L);
2041
2042 cache_mat.col(ip).noalias() = q * c_ip - D * dNdx * c;
2043 }
2044
2045 return cache;
2046 }
2047
2048 void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/,
2049 Eigen::VectorXd const& /*local_x_prev*/,
2050 double const /*t*/, double const /*dt*/,
2051 int const /*process_id*/) override
2052 {
2053 unsigned const n_integration_points =
2055
2056 for (unsigned ip = 0; ip < n_integration_points; ip++)
2057 {
2058 _ip_data[ip].pushBackState();
2059 }
2060 }
2061
2062private:
2065
2067 std::vector<std::reference_wrapper<ProcessVariable>> const
2069
2070 std::vector<IntegrationPointData<GlobalDimNodalMatrixType>> _ip_data;
2071
2073 MaterialPropertyLib::VariableArray const& vars, const double porosity,
2074 const double fluid_density, const double specific_heat_capacity_fluid,
2075 ParameterLib::SpatialPosition const& pos, double const t,
2076 double const dt)
2077 {
2078 auto const& medium =
2079 *_process_data.media_map.getMedium(this->_element.getID());
2080 auto const& solid_phase = medium.phase("Solid");
2081
2082 auto const specific_heat_capacity_solid =
2083 solid_phase
2084 .property(
2086 .template value<double>(vars, pos, t, dt);
2087
2088 auto const solid_density =
2089 solid_phase.property(MaterialPropertyLib::PropertyType::density)
2090 .template value<double>(vars, pos, t, dt);
2091
2092 return solid_density * specific_heat_capacity_solid * (1 - porosity) +
2093 fluid_density * specific_heat_capacity_fluid * porosity;
2094 }
2095
2098 const double fluid_density, const double specific_heat_capacity_fluid,
2099 const GlobalDimVectorType& velocity,
2100 ParameterLib::SpatialPosition const& pos, double const t,
2101 double const dt)
2102 {
2103 auto const& medium =
2105
2106 auto thermal_conductivity =
2108 medium
2109 .property(
2111 .value(vars, pos, t, dt));
2112
2113 auto const thermal_dispersivity_transversal =
2114 medium
2116 thermal_transversal_dispersivity)
2117 .template value<double>();
2118
2119 auto const thermal_dispersivity_longitudinal =
2120 medium
2122 thermal_longitudinal_dispersivity)
2123 .template value<double>();
2124
2125 // Thermal conductivity is moved outside and zero matrix is passed
2126 // instead due to multiplication with fluid's density times specific
2127 // heat capacity.
2128 return thermal_conductivity +
2129 fluid_density * specific_heat_capacity_fluid *
2132 GlobalDimMatrixType::Zero(GlobalDim, GlobalDim),
2133 velocity, 0 /* phi */, thermal_dispersivity_transversal,
2134 thermal_dispersivity_longitudinal);
2135 }
2136
2138 Eigen::VectorXd const& local_x) const
2139 {
2140 NodalVectorType local_T;
2142 {
2144 {
2146 _element, t);
2147 }
2148 else
2149 {
2150 local_T = NodalVectorType::Zero(temperature_size);
2151 }
2152 }
2153 else
2154 {
2155 local_T =
2156 local_x.template segment<temperature_size>(temperature_index);
2157 }
2158 return local_T;
2159 }
2160};
2161
2162} // namespace ComponentTransport
2163} // namespace ProcessLib
GlobalMatrix::IndexType GlobalIndexType
std::string getName(std::string const &line)
Returns the name/title from the "Zone"-description.
virtual void updatePorosityPostReaction(GlobalIndexType const &, MaterialPropertyLib::Medium const &, double &)
virtual double getKineticPrefactor(std::size_t reaction_id) const
virtual void computeSecondaryVariable(std::size_t const, std::vector< GlobalIndexType > const &)
virtual void setChemicalSystemConcrete(std::vector< double > const &, GlobalIndexType const &, MaterialPropertyLib::Medium const *, MaterialPropertyLib::VariableArray const &, ParameterLib::SpatialPosition const &, double const, double const)
virtual void updateVolumeFractionPostReaction(GlobalIndexType const &, MaterialPropertyLib::Medium const &, ParameterLib::SpatialPosition const &, double const, double const, double const)
std::vector< GlobalIndexType > chemical_system_index_map
virtual Eigen::SparseMatrix< double > const * getStoichiometricMatrix() const
virtual double getConcentration(int const, GlobalIndexType const) const
virtual void initializeChemicalSystemConcrete(std::vector< double > const &, GlobalIndexType const &, MaterialPropertyLib::Medium const &, ParameterLib::SpatialPosition const &, double const)
Phase const & phase(std::size_t index) const
Definition Medium.cpp:33
Property const & property(PropertyType const &p) const
Definition Phase.cpp:53
Component const & component(std::size_t const &index) const
Definition Phase.cpp:33
int add(IndexType row, IndexType col, double val)
Definition EigenMatrix.h:87
Global vector based on Eigen vector.
Definition EigenVector.h:26
void add(IndexType rowId, double v)
add entry
Definition EigenVector.h:77
constexpr double getWeight() const
std::size_t getID() const
Returns the ID of the element.
Definition Element.h:91
MathLib::WeightedPoint const & getWeightedPoint(unsigned const igp) const
MathLib::RowColumnIndices< GlobalIndexType > RowColumnIndices
auto const & NsHigherOrder() const
void setCoordinates(MathLib::Point3d const &coordinates)
void setElementID(std::size_t element_id)
virtual std::vector< double > const & getIntPtDarcyVelocity(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const =0
virtual void setChemicalSystemConcrete(Eigen::VectorXd const &, double const, double const)=0
virtual void postSpeciationCalculation(std::size_t const ele_id, double const t, double const dt)=0
virtual void computeReactionRelatedSecondaryVariable(std::size_t const ele_id)=0
void initializeChemicalSystem(std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, double const t)
void setChemicalSystem(std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, double const t, double const dt)
virtual void assembleReactionEquationConcrete(double const t, double const dt, Eigen::VectorXd const &local_x, std::vector< double > &local_M_data, std::vector< double > &local_K_data, std::vector< double > &local_b_data, int const transport_process_id)=0
void assembleReactionEquation(std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, double const t, double const dt, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b, int const process_id)
virtual void initializeChemicalSystemConcrete(Eigen::VectorXd const &, double const)=0
virtual std::vector< double > const & getIntPtMolarFlux(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache, int const component_id) const =0
NodalVectorType getLocalTemperature(double const t, Eigen::VectorXd const &local_x) const
typename ShapeMatricesType::GlobalDimVectorType GlobalDimVectorType
void assembleForStaggeredScheme(double const t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, int const process_id, std::vector< double > &local_M_data, std::vector< double > &local_K_data, std::vector< double > &local_b_data) override
typename ShapeMatricesType::ShapeMatrices ShapeMatrices
void assembleWithJacobianHydraulicEquation(double const t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data)
void assembleHeatTransportEquation(double const t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &, std::vector< double > &local_M_data, std::vector< double > &local_K_data, std::vector< double > &)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > LocalMatrixType
void postTimestepConcrete(Eigen::VectorXd const &, Eigen::VectorXd const &, double const, double const, int const) override
std::vector< double > const & getIntPtMolarFlux(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< double > &cache, int const component_id) const override
void postSpeciationCalculation(std::size_t const ele_id, double const t, double const dt) override
NumLib::GenericIntegrationMethod const & _integration_method
std::vector< double > const & calculateIntPtDarcyVelocity(const double t, Eigen::Ref< const NodalVectorType > const &p_nodal_values, Eigen::Ref< const NodalVectorType > const &C_nodal_values, Eigen::Ref< const NodalVectorType > const &T_nodal_values, std::vector< double > &cache) const
void initializeChemicalSystemConcrete(Eigen::VectorXd const &local_x, double const t) override
void computeReactionRelatedSecondaryVariable(std::size_t const ele_id) override
void assembleBlockMatrices(GlobalDimVectorType const &b, int const component_id, double const t, double const dt, Eigen::Ref< const NodalVectorType > const &C_nodal_values, Eigen::Ref< const NodalVectorType > const &p_nodal_values, Eigen::Ref< LocalBlockMatrixType > KCC, Eigen::Ref< LocalBlockMatrixType > MCC, Eigen::Ref< LocalBlockMatrixType > MCp, Eigen::Ref< LocalBlockMatrixType > MpC, Eigen::Ref< LocalBlockMatrixType > Kpp, Eigen::Ref< LocalBlockMatrixType > Mpp, Eigen::Ref< LocalSegmentVectorType > Bp)
typename ShapeMatricesType::template MatrixType< pressure_size, pressure_size > LocalBlockMatrixType
typename ShapeMatricesType::GlobalDimMatrixType GlobalDimMatrixType
void assembleWithJacobianForStaggeredScheme(double const t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, int const process_id, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data) override
std::vector< IntegrationPointData< GlobalDimNodalMatrixType > > _ip_data
ComponentTransportProcessData const & _process_data
Eigen::Map< const Eigen::RowVectorXd > getShapeMatrix(const unsigned integration_point) const override
Provides the shape matrix at the given integration point.
ShapeMatrixPolicyType< ShapeFunction, GlobalDim > ShapeMatricesType
void computeSecondaryVariableConcrete(double const t, double const, Eigen::VectorXd const &local_x, Eigen::VectorXd const &) override
std::vector< std::reference_wrapper< ProcessVariable > > const _transport_process_variables
void assembleHydraulicEquation(double const t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, std::vector< double > &local_M_data, std::vector< double > &local_K_data, std::vector< double > &local_b_data)
typename ShapeMatricesType::GlobalDimNodalMatrixType GlobalDimNodalMatrixType
typename ShapeMatricesType::NodalRowVectorType NodalRowVectorType
std::vector< double > const & getIntPtDarcyVelocity(const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const override
void assembleComponentTransportEquation(double const t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, std::vector< double > &local_M_data, std::vector< double > &local_K_data, std::vector< double > &, int const transport_process_id)
Eigen::Vector3d getFlux(MathLib::Point3d const &pnt_local_coords, double const t, std::vector< double > const &local_x) const override
GlobalDimMatrixType getThermalConductivityDispersivity(MaterialPropertyLib::VariableArray const &vars, const double fluid_density, const double specific_heat_capacity_fluid, const GlobalDimVectorType &velocity, ParameterLib::SpatialPosition const &pos, double const t, double const dt)
void assemble(double const t, double const dt, std::vector< double > const &local_x, std::vector< double > const &, std::vector< double > &local_M_data, std::vector< double > &local_K_data, std::vector< double > &local_b_data) override
void assembleWithJacobianComponentTransportEquation(double const t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data, int const component_id)
Eigen::Matrix< double, Eigen::Dynamic, 1 > LocalVectorType
double getHeatEnergyCoefficient(MaterialPropertyLib::VariableArray const &vars, const double porosity, const double fluid_density, const double specific_heat_capacity_fluid, ParameterLib::SpatialPosition const &pos, double const t, double const dt)
void assembleReactionEquationConcrete(double const t, double const dt, Eigen::VectorXd const &local_x, std::vector< double > &local_M_data, std::vector< double > &local_K_data, std::vector< double > &local_b_data, int const transport_process_id) override
LocalAssemblerData(MeshLib::Element const &element, std::size_t const local_matrix_size, NumLib::GenericIntegrationMethod const &integration_method, bool is_axially_symmetric, ComponentTransportProcessData const &process_data, std::vector< std::reference_wrapper< ProcessVariable > > const &transport_process_variables)
typename ShapeMatricesType::template VectorType< pressure_size > LocalSegmentVectorType
void assembleKCmCn(int const component_id, double const t, double const dt, Eigen::Ref< LocalBlockMatrixType > KCmCn, double const stoichiometric_coefficient, double const kinetic_prefactor)
void setChemicalSystemConcrete(Eigen::VectorXd const &local_x, double const t, double dt) override
typename ShapeMatricesType::NodalVectorType NodalVectorType
Eigen::Matrix< double, GlobalDim, GlobalDim > formEigenTensor(MaterialPropertyLib::PropertyDataType const &values)
@ longitudinal_dispersivity
used to compute the hydrodynamic dispersion tensor.
@ transversal_dispersivity
used to compute the hydrodynamic dispersion tensor.
@ retardation_factor
specify retardation factor used in component transport process.
Eigen::Map< Vector > createZeroedVector(std::vector< double > &data, Eigen::VectorXd::Index size)
Eigen::Map< const Vector > toVector(std::vector< double > const &data, Eigen::VectorXd::Index size)
Creates an Eigen mapped vector from the given data vector.
Eigen::Map< Matrix > createZeroedMatrix(std::vector< double > &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
Eigen::Map< const Matrix > toMatrix(std::vector< double > const &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
void shapeFunctionInterpolate(const NodalValues &, const ShapeMatrix &)
void assembleAdvectionMatrix(IPData const &ip_data_vector, NumLib::ShapeMatrixCache const &shape_matrix_cache, std::vector< FluxVectorType > const &ip_flux_vector, Eigen::MatrixBase< Derived > &laplacian_matrix)
std::vector< GlobalIndexType > getIndices(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table)
std::vector< typename ShapeMatricesType::ShapeMatrices, Eigen::aligned_allocator< typename ShapeMatricesType::ShapeMatrices > > initShapeMatrices(MeshLib::Element const &e, bool const is_axially_symmetric, IntegrationMethod const &integration_method)
std::vector< typename ShapeMatricesType::ShapeMatrices, Eigen::aligned_allocator< typename ShapeMatricesType::ShapeMatrices > > computeShapeMatrices(MeshLib::Element const &e, bool const is_axially_symmetric, PointContainer const &points)
Eigen::MatrixXd computeHydrodynamicDispersion(NumericalStabilization const &stabilizer, std::size_t const element_id, Eigen::MatrixXd const &pore_diffusion_coefficient, Eigen::VectorXd const &velocity, double const porosity, double const solute_dispersivity_transverse, double const solute_dispersivity_longitudinal)
std::array< double, 3 > interpolateCoordinates(MeshLib::Element const &e, typename ShapeMatricesType::ShapeMatrices::ShapeType const &N)
NumLib::ShapeMatrices< NodalRowVectorType, DimNodalMatrixType, DimMatrixType, GlobalDimNodalMatrixType > ShapeMatrices
MatrixType< GlobalDim, ShapeFunction::NPOINTS > GlobalDimNodalMatrixType
MatrixType< GlobalDim, GlobalDim > GlobalDimMatrixType
VectorType< GlobalDim > GlobalDimVectorType
VectorType< ShapeFunction::NPOINTS > NodalVectorType
RowVectorType< ShapeFunction::NPOINTS > NodalRowVectorType
virtual Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > getNodalValuesOnElement(MeshLib::Element const &element, double const t) const
Returns a matrix of values for all nodes of the given element.
Definition Parameter.h:164
std::vector< Eigen::VectorXd > const projected_specific_body_force_vectors
Projected specific body force vector: R * R^T * b.
MaterialPropertyLib::MaterialSpatialDistributionMap media_map
NumLib::ShapeMatrixCache shape_matrix_cache
caches for each mesh element type the shape matrix
IntegrationPointData(GlobalDimNodalMatrixType const &dNdx_, double const &integration_weight_)