OGS
ComponentTransportProcess.cpp
Go to the documentation of this file.
1
12
13#include <cassert>
14#include <range/v3/algorithm/copy.hpp>
15#include <range/v3/view/drop.hpp>
16
17#include "BaseLib/RunTime.h"
35
36namespace ProcessLib
37{
38namespace ComponentTransport
39{
41 std::string name,
42 MeshLib::Mesh& mesh,
43 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
44 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
45 unsigned const integration_order,
46 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>&&
47 process_variables,
48 ComponentTransportProcessData&& process_data,
49 SecondaryVariableCollection&& secondary_variables,
50 bool const use_monolithic_scheme,
51 std::unique_ptr<ProcessLib::SurfaceFluxData>&& surfaceflux,
52 std::unique_ptr<ChemistryLib::ChemicalSolverInterface>&&
53 chemical_solver_interface,
54 bool const is_linear,
55 bool const ls_compute_only_upon_timestep_change)
56 : Process(std::move(name), mesh, std::move(jacobian_assembler), parameters,
57 integration_order, std::move(process_variables),
58 std::move(secondary_variables), use_monolithic_scheme),
59 _process_data(std::move(process_data)),
60 _surfaceflux(std::move(surfaceflux)),
61 _chemical_solver_interface(std::move(chemical_solver_interface)),
62 _asm_mat_cache{is_linear, use_monolithic_scheme},
63 _ls_compute_only_upon_timestep_change{
64 ls_compute_only_upon_timestep_change}
65{
66 if (ls_compute_only_upon_timestep_change)
67 {
68 // TODO move this feature to some common location for all processes.
69 if (!is_linear)
70 {
72 "Using the linear solver compute() method only upon timestep "
73 "change only makes sense for linear model equations.");
74 }
75
76 WARN(
77 "You specified that the ComponentTransport linear solver will do "
78 "the compute() step only upon timestep change. This is an expert "
79 "option. It is your responsibility to ensure that "
80 "the conditions for the correct use of this feature are met! "
81 "Otherwise OGS might compute garbage without being recognized. "
82 "There is no safety net!");
83
84 WARN(
85 "You specified that the ComponentTransport linear solver will do "
86 "the compute() step only upon timestep change. This option will "
87 "only be used by the Picard non-linear solver. The Newton-Raphson "
88 "non-linear solver will silently ignore this setting, i.e., it "
89 "won't do any harm, there, but you won't observe the speedup you "
90 "probably expect.");
91 }
92
93 auto residuum_name = [&](auto const& pv) -> std::string
94 {
95 std::string const& pv_name = pv.getName();
96 if (pv_name == "pressure")
97 {
98 return "LiquidMassFlowRate";
99 }
100 if (pv_name == "temperature")
101 {
102 return "HeatFlowRate";
103 }
104 return pv_name + "FlowRate";
105 };
106
108 {
109 int const process_id = 0;
110 for (auto const& pv : _process_variables[process_id])
111 {
112 _residua.push_back(MeshLib::getOrCreateMeshProperty<double>(
113 mesh, residuum_name(pv.get()), MeshLib::MeshItemType::Node, 1));
114 }
115 }
116 else
117 {
118 for (auto const& pv : _process_variables)
119 {
120 _residua.push_back(MeshLib::getOrCreateMeshProperty<double>(
121 mesh, residuum_name(pv[0].get()), MeshLib::MeshItemType::Node,
122 1));
123 }
124 }
125}
126
128 NumLib::LocalToGlobalIndexMap const& dof_table,
129 MeshLib::Mesh const& mesh,
130 unsigned const integration_order)
131{
132 int const mesh_space_dimension = _process_data.mesh_space_dimension;
133
134 _process_data.mesh_prop_velocity = MeshLib::getOrCreateMeshProperty<double>(
135 const_cast<MeshLib::Mesh&>(mesh), "velocity",
136 MeshLib::MeshItemType::Cell, mesh_space_dimension);
137
138 _process_data.mesh_prop_porosity = MeshLib::getOrCreateMeshProperty<double>(
139 const_cast<MeshLib::Mesh&>(mesh), "porosity_avg",
141
142 std::vector<std::reference_wrapper<ProcessLib::ProcessVariable>>
143 transport_process_variables;
145 {
146 const int process_id = 0;
147 for (auto pv_iter = std::next(_process_variables[process_id].begin());
148 pv_iter != _process_variables[process_id].end();
149 ++pv_iter)
150 {
151 transport_process_variables.push_back(*pv_iter);
152 }
153 }
154 else
155 {
156 // All process variables but the pressure and optionally the temperature
157 // are transport variables.
158 for (auto const& pv :
160 ranges::views::drop(_process_data.isothermal ? 1 : 2))
161 {
162 transport_process_variables.push_back(pv[0]);
163 }
164 }
165
166 ProcessLib::createLocalAssemblers<LocalAssemblerData>(
167 mesh_space_dimension, mesh.getElements(), dof_table, _local_assemblers,
168 NumLib::IntegrationOrder{integration_order}, mesh.isAxiallySymmetric(),
169 _process_data, transport_process_variables);
170
172 {
176
177 _chemical_solver_interface->initialize();
178 }
179
181 "darcy_velocity",
183 mesh_space_dimension, getExtrapolator(), _local_assemblers,
185
187 "molar_flux",
189 mesh_space_dimension, getExtrapolator(), _local_assemblers,
191}
192
194 std::vector<GlobalVector*>& x, double const t, int const process_id)
195{
197 {
198 return;
199 }
200
201 if (process_id != static_cast<int>(x.size() - 1))
202 {
203 return;
204 }
205
206 std::for_each(
207 x.begin(), x.end(),
208 [](auto const process_solution)
209 { MathLib::LinAlg::setLocalAccessibleVector(*process_solution); });
210
211 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
212 dof_tables.reserve(x.size());
213 std::generate_n(std::back_inserter(dof_tables), x.size(),
214 [&]() { return _local_to_global_index_map.get(); });
215
219 dof_tables, x, t);
220}
221
223 const double t, double const dt, std::vector<GlobalVector*> const& x,
224 std::vector<GlobalVector*> const& x_prev, int const process_id,
226{
227 DBUG("Assemble ComponentTransportProcess.");
228
229 ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
230
231 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
233 {
234 dof_tables.push_back(_local_to_global_index_map.get());
235 }
236 else
237 {
238 std::generate_n(std::back_inserter(dof_tables),
239 _process_variables.size(),
240 [&]() { return _local_to_global_index_map.get(); });
241 }
242
243 _asm_mat_cache.assemble(t, dt, x, x_prev, process_id, M, K, b, dof_tables,
246
247 // TODO (naumov) What about temperature? A test with FCT would reveal any
248 // problems.
249 if (process_id == _process_data.hydraulic_process_id)
250 {
251 return;
252 }
253 auto const matrix_specification = getMatrixSpecifications(process_id);
254
256 x_prev, process_id,
257 matrix_specification, M, K, b);
258}
259
261 const double t, double const dt, std::vector<GlobalVector*> const& x,
262 std::vector<GlobalVector*> const& x_prev, int const process_id,
264{
265 DBUG("AssembleWithJacobian ComponentTransportProcess.");
266
268 {
269 OGS_FATAL(
270 "The AssembleWithJacobian() for ComponentTransportProcess is "
271 "implemented only for staggered scheme.");
272 }
273
274 ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
275
276 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
277
278 std::generate_n(std::back_inserter(dof_tables), _process_variables.size(),
279 [&]() { return _local_to_global_index_map.get(); });
280
281 // Call global assembler for each local assembly item.
284 _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x,
285 x_prev, process_id, M, K, b, Jac);
286
287 // b is the negated residumm used in the Newton's method.
288 // Here negating b is to recover the primitive residuum.
289 transformVariableFromGlobalVector(b, 0, *_local_to_global_index_map,
290 *_residua[process_id],
291 std::negate<double>());
292}
293
295 std::size_t const element_id,
296 MathLib::Point3d const& p,
297 double const t,
298 std::vector<GlobalVector*> const& x) const
299{
300 std::vector<GlobalIndexType> indices_cache;
301 auto const r_c_indices = NumLib::getRowColumnIndices(
302 element_id, *_local_to_global_index_map, indices_cache);
303
304 std::vector<std::vector<GlobalIndexType>> indices_of_all_coupled_processes{
305 x.size(), r_c_indices.rows};
306 auto const local_xs =
307 getCoupledLocalSolutions(x, indices_of_all_coupled_processes);
308
309 return _local_assemblers[element_id]->getFlux(p, t, local_xs);
310}
311
313 std::vector<GlobalVector*>& x, std::vector<GlobalVector*> const& x_prev,
314 double const t, double const dt, NumLib::EquationSystem& ode_sys,
315 int const process_id)
316{
317 // todo (renchao): move chemical calculation to elsewhere.
318 if (_process_data.lookup_table && process_id == 0)
319 {
320 INFO("Update process solutions via the look-up table approach");
321 _process_data.lookup_table->lookup(x, x_prev, _mesh.getNumberOfNodes());
322
323 return;
324 }
325
327 {
328 return;
329 }
330
331 // Sequential non-iterative approach applied here to split the reactive
332 // transport process into the transport stage followed by the reaction
333 // stage.
334 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
335 dof_tables.reserve(x.size());
336 std::generate_n(std::back_inserter(dof_tables), x.size(),
337 [&]() { return _local_to_global_index_map.get(); });
338
339 if (process_id == 0)
340 {
344 dof_tables, x, t, dt);
345
346 BaseLib::RunTime time_phreeqc;
347 time_phreeqc.start();
348
349 _chemical_solver_interface->setAqueousSolutionsPrevFromDumpFile();
350
351 _chemical_solver_interface->executeSpeciationCalculation(dt);
352
353 INFO("[time] Phreeqc took {:g} s.", time_phreeqc.elapsed());
354
357 postSpeciationCalculation,
359 dt);
360
361 return;
362 }
363
364 auto const matrix_specification = getMatrixSpecifications(process_id);
365
366 std::size_t matrix_id = 0u;
368 matrix_specification, matrix_id);
370 matrix_specification, matrix_id);
371 auto& b =
373
374 M.setZero();
375 K.setZero();
376 b.setZero();
377
378 ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
381 _local_assemblers, pv.getActiveElementIDs(), dof_tables, x, t, dt, M, K,
382 b, process_id);
383
384 // todo (renchao): incorporate Neumann boundary condition
388
390 matrix_specification, matrix_id);
391 auto& rhs =
393
394 A.setZero();
395 rhs.setZero();
396
399
400 // compute A
402 MathLib::LinAlg::aypx(A, 1.0 / dt, K);
403
404 // compute rhs
405 MathLib::LinAlg::matMult(M, *x[process_id], rhs);
406 MathLib::LinAlg::aypx(rhs, 1.0 / dt, b);
407
408 using Tag = NumLib::NonlinearSolverTag;
410 auto& equation_system = static_cast<EqSys&>(ode_sys);
411 equation_system.applyKnownSolutionsPicard(A, rhs, *x[process_id]);
412
413 auto& linear_solver =
416 linear_solver.solve(A, rhs, *x[process_id]);
417
423}
424
426 double const t,
427 double const dt,
428 std::vector<GlobalVector*> const& x,
429 GlobalVector const& x_prev,
430 int const process_id)
431{
432 if (process_id != 0)
433 {
434 return;
435 }
436
437 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
438 dof_tables.reserve(x.size());
439 std::generate_n(std::back_inserter(dof_tables), x.size(),
440 [&]() { return _local_to_global_index_map.get(); });
441
442 ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
445 _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x,
446 x_prev, process_id);
447
449 {
450 return;
451 }
452
455 computeReactionRelatedSecondaryVariable,
457}
458
460 std::vector<GlobalVector*> const& x,
461 std::vector<GlobalVector*> const& x_prev,
462 const double t,
463 const double dt,
464 int const process_id)
465{
466 if (process_id != 0)
467 {
468 return;
469 }
470
471 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
472 dof_tables.reserve(x.size());
473 std::generate_n(std::back_inserter(dof_tables), x.size(),
474 [&]() { return _local_to_global_index_map.get(); });
475
476 ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
479 _local_assemblers, pv.getActiveElementIDs(), dof_tables, x, x_prev, t,
480 dt, process_id);
481
482 if (!_surfaceflux) // computing the surfaceflux is optional
483 {
484 return;
485 }
486 _surfaceflux->integrate(x, t, *this, process_id, _integration_order, _mesh,
488}
489
491 const double t,
492 double const dt,
493 std::vector<GlobalVector*> const& x,
494 std::vector<GlobalVector*> const& x_prev,
495 int const process_id)
496{
497 auto const matrix_specification = getMatrixSpecifications(process_id);
498
500 matrix_specification);
502 matrix_specification);
504 matrix_specification);
505
506 M->setZero();
507 K->setZero();
508 b->setZero();
509
510 assembleConcreteProcess(t, dt, x, x_prev, process_id, *M, *K, *b);
511
512 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
514 {
515 dof_tables.push_back(_local_to_global_index_map.get());
516 }
517 else
518 {
519 std::generate_n(std::back_inserter(dof_tables),
520 _process_variables.size(),
521 [&]() { return _local_to_global_index_map.get(); });
522 }
523
524 BaseLib::RunTime time_residuum;
525 time_residuum.start();
526
528 {
529 auto const residuum =
530 computeResiduum(dt, *x[0], *x_prev[0], *M, *K, *b);
531 for (std::size_t variable_id = 0; variable_id < _residua.size();
532 ++variable_id)
533 {
534 transformVariableFromGlobalVector(
535 residuum, variable_id, *dof_tables[0], *_residua[variable_id],
536 std::negate<double>());
537 }
538 }
539 else
540 {
541 auto const residuum = computeResiduum(dt, *x[process_id],
542 *x_prev[process_id], *M, *K, *b);
543 transformVariableFromGlobalVector(residuum, 0, *dof_tables[process_id],
544 *_residua[process_id],
545 std::negate<double>());
546 }
547
548 INFO("[time] Computing residuum flow rates took {:g} s",
549 time_residuum.elapsed());
550}
551} // namespace ComponentTransport
552} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:26
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:35
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40
Definition of the RunTime class.
Count the running time.
Definition RunTime.h:29
double elapsed() const
Get the elapsed time in seconds.
Definition RunTime.h:42
void start()
Start the timer.
Definition RunTime.h:32
Global vector based on Eigen vector.
Definition EigenVector.h:25
bool isAxiallySymmetric() const
Definition Mesh.h:137
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition Mesh.h:109
std::size_t getNumberOfNodes() const
Get the number of nodes.
Definition Mesh.h:100
virtual void releaseMatrix(GlobalMatrix const &A)=0
virtual GlobalMatrix & getMatrix(std::size_t &id)=0
Get an uninitialized matrix with the given id.
virtual GlobalVector & getVector(std::size_t &id)=0
Get an uninitialized vector with the given id.
virtual void releaseVector(GlobalVector const &x)=0
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 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) const =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)
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)
void setInitialConditionsConcreteProcess(std::vector< GlobalVector * > &x, double const t, int const process_id) override
void preOutputConcreteProcess(const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id) override
void assembleConcreteProcess(const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b) override
void initializeConcreteProcess(NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, unsigned const integration_order) override
Process specific initialization called by initialize().
std::unique_ptr< ChemistryLib::ChemicalSolverInterface > _chemical_solver_interface
std::vector< MeshLib::PropertyVector< double > * > _residua
void assembleWithJacobianConcreteProcess(const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b, GlobalMatrix &Jac) override
void computeSecondaryVariableConcrete(double const, double const, std::vector< GlobalVector * > const &x, GlobalVector const &, int const) override
void solveReactionEquation(std::vector< GlobalVector * > &x, std::vector< GlobalVector * > const &x_prev, double const t, double const dt, NumLib::EquationSystem &ode_sys, int const process_id) override
void postTimestepConcreteProcess(std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, const double t, const double dt, int const process_id) override
std::vector< std::unique_ptr< ComponentTransportLocalAssemblerInterface > > _local_assemblers
std::unique_ptr< ProcessLib::SurfaceFluxData > _surfaceflux
ComponentTransportProcess(std::string name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, unsigned const integration_order, std::vector< std::vector< std::reference_wrapper< ProcessVariable > > > &&process_variables, ComponentTransportProcessData &&process_data, SecondaryVariableCollection &&secondary_variables, bool const use_monolithic_scheme, std::unique_ptr< ProcessLib::SurfaceFluxData > &&surfaceflux, std::unique_ptr< ChemistryLib::ChemicalSolverInterface > &&chemical_solver_interface, bool const is_linear, bool const ls_compute_only_upon_timestep_change)
Eigen::Vector3d getFlux(std::size_t const element_id, MathLib::Point3d const &p, double const t, std::vector< GlobalVector * > const &x) const override
virtual void postTimestep(std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, double const t, double const dt, int const process_id)
virtual void computeSecondaryVariable(std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, double const t, double const dt, std::vector< GlobalVector * > const &x, GlobalVector const &x_prev, int const process_id)
std::vector< std::size_t > const & getActiveElementIDs() const
MeshLib::Mesh & _mesh
Definition Process.h:357
std::vector< std::vector< std::reference_wrapper< ProcessVariable > > > _process_variables
Definition Process.h:390
SecondaryVariableCollection _secondary_variables
Definition Process.h:362
std::vector< std::reference_wrapper< ProcessVariable > > const & getProcessVariables(const int process_id) const
Definition Process.h:155
VectorMatrixAssembler _global_assembler
Definition Process.h:367
unsigned const _integration_order
Definition Process.h:374
std::unique_ptr< NumLib::LocalToGlobalIndexMap > _local_to_global_index_map
Definition Process.h:360
MathLib::MatrixSpecifications getMatrixSpecifications(const int process_id) const override
Definition Process.cpp:210
NumLib::Extrapolator & getExtrapolator() const
Definition Process.h:199
const bool _use_monolithic_scheme
Definition Process.h:369
Handles configuration of several secondary variables from the project file.
void addSecondaryVariable(std::string const &internal_name, SecondaryVariableFunctions &&fcts)
void assembleWithJacobian(std::size_t const mesh_item_id, LocalAssemblerInterface &local_assembler, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b, GlobalMatrix &Jac)
NonlinearSolverTag
Tag used to specify which nonlinear solver will be used.
Definition Types.h:20
void copy(PETScVector const &x, PETScVector &y)
Definition LinAlg.cpp:37
void setLocalAccessibleVector(PETScVector const &x)
Definition LinAlg.cpp:27
void matMult(PETScMatrix const &A, PETScVector const &x, PETScVector &y)
Definition LinAlg.cpp:149
void aypx(PETScVector &y, PetscScalar const a, PETScVector const &x)
Definition LinAlg.cpp:50
void finalizeVectorAssembly(VEC_T &)
General function to finalize the vector assembly.
bool finalizeMatrixAssembly(MAT_T &)
void computeFluxCorrectedTransport(NumericalStabilization const &stabilizer, const double t, const double dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, const MathLib::MatrixSpecifications &matrix_specification, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b)
NumLib::LocalToGlobalIndexMap::RowColumnIndices getRowColumnIndices(std::size_t const id, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< GlobalIndexType > &indices)
GlobalVector computeResiduum(double const dt, GlobalVector const &x, GlobalVector const &x_prev, GlobalMatrix const &M, GlobalMatrix const &K, GlobalVector const &b)
std::vector< double > getCoupledLocalSolutions(std::vector< GlobalVector * > const &global_solutions, std::vector< std::vector< GlobalIndexType > > const &indices)
SecondaryVariableFunctions makeExtrapolator(const unsigned num_components, NumLib::Extrapolator &extrapolator, LocalAssemblerCollection const &local_assemblers, typename NumLib::ExtrapolatableLocalAssemblerCollection< LocalAssemblerCollection >::IntegrationPointValuesMethod integration_point_values_method)
static NUMLIB_EXPORT MatrixProvider & provider
static NUMLIB_EXPORT VectorProvider & provider
static void executeSelectedMemberOnDereferenced(Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)
static void executeSelectedMemberDereferenced(Object &object, Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)
void assemble(const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, VectorMatrixAssembler &global_assembler, VectorOfLocalAssemblers const &local_assemblers, std::vector< std::size_t > const &active_element_ids)