OGS
HeatTransportBHEProcess.cpp
Go to the documentation of this file.
1
12
13#include <cassert>
14
24
25namespace ProcessLib
26{
27namespace HeatTransportBHE
28{
30 std::string name,
31 MeshLib::Mesh& mesh,
32 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
33 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
34 unsigned const integration_order,
35 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>&&
36 process_variables,
37 HeatTransportBHEProcessData&& process_data,
38 SecondaryVariableCollection&& secondary_variables,
39 BHEMeshData&& bhe_mesh_data)
40 : Process(std::move(name), mesh, std::move(jacobian_assembler), parameters,
41 integration_order, std::move(process_variables),
42 std::move(secondary_variables)),
43 _process_data(std::move(process_data)),
44 _bheMeshData(std::move(bhe_mesh_data)),
45 _asm_mat_cache{_process_data._is_linear, true /*use_monolithic_scheme*/}
46{
47 if (_bheMeshData.BHE_mat_IDs.size() !=
49 {
50 OGS_FATAL(
51 "The number of the given BHE properties ({:d}) are not consistent "
52 "with the number of BHE groups in the mesh ({:d}).",
53 _process_data._vec_BHE_property.size(),
54 _bheMeshData.BHE_mat_IDs.size());
55 }
56
57 auto material_ids = MeshLib::materialIDs(mesh);
58 if (material_ids == nullptr)
59 {
60 OGS_FATAL("Not able to get material IDs! ");
61 }
62
64
65 // create a map from a material ID to a BHE ID
66 for (int i = 0; i < static_cast<int>(_bheMeshData.BHE_mat_IDs.size()); i++)
67 {
68 // fill in the map structure
70 i;
71 }
72}
73
75{
76 // Create single component dof in every of the mesh's nodes.
78 std::make_unique<MeshLib::MeshSubset>(_mesh, _mesh.getNodes());
79
80 //
81 // Soil temperature variable defined on the whole mesh.
82 //
84 std::make_unique<MeshLib::MeshSubset>(_mesh, _mesh.getNodes());
85 std::vector<MeshLib::MeshSubset> all_mesh_subsets{*_mesh_subset_soil_nodes};
86
87 std::vector<std::vector<MeshLib::Element*> const*> vec_var_elements;
88 vec_var_elements.push_back(&(_mesh.getElements()));
89
90 std::vector<int> vec_n_components{
91 1}; // one component for the soil temperature variable.
92
93 //
94 // BHE nodes with BHE type dependent number of variables.
95 //
96 int const n_BHEs = _process_data._vec_BHE_property.size();
97 assert(n_BHEs == static_cast<int>(_bheMeshData.BHE_mat_IDs.size()));
98 assert(n_BHEs == static_cast<int>(_bheMeshData.BHE_nodes.size()));
99 assert(n_BHEs == static_cast<int>(_bheMeshData.BHE_elements.size()));
100
101 // the BHE nodes need to be cherry-picked from the vector
102 for (int i = 0; i < n_BHEs; i++)
103 {
104 auto const number_of_unknowns =
105 visit([](auto const& bhe) { return bhe.number_of_unknowns; },
107 auto const& bhe_nodes = _bheMeshData.BHE_nodes[i];
108 auto const& bhe_elements = _bheMeshData.BHE_elements[i];
109
110 // All the BHE nodes have additional variables.
111 _mesh_subset_BHE_nodes.push_back(
112 std::make_unique<MeshLib::MeshSubset const>(_mesh, bhe_nodes));
113
114 std::generate_n(std::back_inserter(all_mesh_subsets),
115 // Here the number of components equals to the
116 // number of unknowns on the BHE
117 number_of_unknowns,
118 [&ms = _mesh_subset_BHE_nodes.back()]()
119 { return *ms; });
120
121 vec_n_components.push_back(number_of_unknowns);
122 vec_var_elements.push_back(&bhe_elements);
123 }
124
126 std::make_unique<NumLib::LocalToGlobalIndexMap>(
127 std::move(all_mesh_subsets),
128 vec_n_components,
129 vec_var_elements,
131
132 // in case of debugging the dof table, activate the following line
133 // std::cout << *_local_to_global_index_map << "\n";
134}
135
137 NumLib::LocalToGlobalIndexMap const& dof_table,
138 MeshLib::Mesh const& mesh,
139 unsigned const integration_order)
140{
141 // Quick access map to BHE's through element ids.
142 std::unordered_map<std::size_t, BHE::BHETypes*> element_to_bhe_map;
143 int const n_BHEs = _process_data._vec_BHE_property.size();
144 for (int i = 0; i < n_BHEs; i++)
145 {
146 auto const& bhe_elements = _bheMeshData.BHE_elements[i];
147 for (auto const& e : bhe_elements)
148 {
149 element_to_bhe_map[e->getID()] =
151 }
152 }
153
154 assert(mesh.getDimension() == 3);
157 mesh.getElements(), dof_table, _local_assemblers,
158 NumLib::IntegrationOrder{integration_order}, element_to_bhe_map,
160
161 // Create BHE boundary conditions for each of the BHEs
163
164 // Store BHE and soil elements to split the assembly and use the matrix
165 // cache in the linear case only for soil elements
167 {
168 _bhes_element_ids = _bheMeshData.BHE_elements | ranges::views::join |
169 MeshLib::views::ids | ranges::to<std::vector>;
170
171 // sort bhe elements if needed
172 if (!std::is_sorted(_bhes_element_ids.begin(), _bhes_element_ids.end()))
173 {
174 std::sort(_bhes_element_ids.begin(), _bhes_element_ids.end());
175 }
176
178 ranges::to<std::vector>();
179
180 // sort soil elements if needed
181 if (!std::is_sorted(_soil_element_ids.begin(), _soil_element_ids.end()))
182 {
183 std::sort(_soil_element_ids.begin(), _soil_element_ids.end());
184 }
185
186 _soil_element_ids = ranges::views::set_difference(_soil_element_ids,
188 ranges::to<std::vector>();
189 }
190
192 {
193 std::vector<std::size_t> const bhes_node_ids =
194 _bheMeshData.BHE_nodes | ranges::views::join |
195 ranges::views::transform([](auto const* const node)
196 { return node->getID(); }) |
197 ranges::to<std::vector>;
198
199 // all connected soil elements and also the BHE elements.
200 MeshLib::ElementSearch es{mesh};
201 es.searchByNodeIDs(bhes_node_ids);
202
205 mesh.getNumberOfElements(), false);
206 for (auto const id : es.getSearchedElementIDs())
207 {
209 }
210 }
211}
212
214 const double t, double const dt, std::vector<GlobalVector*> const& x,
215 std::vector<GlobalVector*> const& x_prev, int const process_id,
217{
218 DBUG("Assemble HeatTransportBHE process.");
219
220 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_table = {
222
224 {
225 if (!getActiveElementIDs().empty())
226 {
227 OGS_FATAL(
228 "Domain Deactivation is currently not implemnted with "
229 "linear optimization.");
230 }
231
232 auto const& spec = getMatrixSpecifications(process_id);
233
234 // use matrix cache for soil elements
235 _asm_mat_cache.assemble(t, dt, x, x_prev, process_id, &M, &K, &b,
238
239 // reset the sparsity pattern for better performance in the BHE assembly
240 MathLib::setMatrixSparsity(M, *spec.sparsity_pattern);
241 MathLib::setMatrixSparsity(K, *spec.sparsity_pattern);
242
243 // Call global assembler for each local BHE assembly item.
246 _local_assemblers, _bhes_element_ids, dof_table, t, dt, x, x_prev,
247 process_id, &M, &K, &b);
248 }
249 else
250 {
251 // Call global assembler for each local assembly item.
254 _local_assemblers, getActiveElementIDs(), dof_table, t, dt, x,
255 x_prev, process_id, &M, &K, &b);
256 }
257
258 // Algebraic BC procedure.
260 {
261 algebraicBcConcreteProcess(t, dt, x, x_prev, process_id, M, K, b);
262 }
263
264 //_global_output(t, process_id, M, K, b);
265}
266
268 const double t, double const dt, std::vector<GlobalVector*> const& x,
269 std::vector<GlobalVector*> const& x_prev, int const process_id,
270 GlobalVector& b, GlobalMatrix& Jac)
271{
272 DBUG("AssembleWithJacobian HeatTransportBHE process.");
273
274 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_table = {
276
277 // Call global assembler for each local assembly item.
280 _local_assemblers, getActiveElementIDs(), dof_table, t, dt, x, x_prev,
281 process_id, &b, &Jac);
282}
283
285 double const t, double const dt, std::vector<GlobalVector*> const& x,
286 GlobalVector const& x_prev, int const process_id)
287{
288 DBUG("Compute heat flux for HeatTransportBHE process.");
289
290 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
291 dof_tables.reserve(x.size());
292 std::generate_n(std::back_inserter(dof_tables), x.size(),
293 [&]() { return _local_to_global_index_map.get(); });
294
297 _local_assemblers, getActiveElementIDs(), dof_tables, t, dt, x, x_prev,
298 process_id);
299}
300
302 GlobalVector const& x)
303{
304 // if the process use python boundary condition
307
308 // Here the task is to get current time flowrate and flow temperature from
309 // TESPy and determine whether it converges.
310 auto const Tout_nodes_id =
312 const std::size_t n_bc_nodes = Tout_nodes_id.size();
313
314 for (std::size_t i = 0; i < n_bc_nodes; i++)
315 {
316 // read the T_out and store them in dataframe
318 x[Tout_nodes_id[i]];
319 }
320 // Transfer Tin and Tout to TESPy and return the results
321 auto const tespy_result = _process_data.py_bc_object->tespySolver(
323 std::get<1>(_process_data.py_bc_object->dataframe_network), // T_in
324 std::get<2>(_process_data.py_bc_object->dataframe_network)); // T_out
326 {
327 DBUG("Method `tespySolver' not overridden in Python script.");
328 }
329
330 // update the Tin and flow rate
331 for (std::size_t i = 0; i < n_bc_nodes; i++)
332 {
334 std::get<2>(tespy_result)[i];
336 std::get<3>(tespy_result)[i];
337 }
338 auto const tespy_has_converged = std::get<1>(tespy_result);
339 if (tespy_has_converged == true)
341
343}
344
346 std::vector<GlobalVector*> const& x, const double t, const double dt,
347 int const process_id)
348{
349 if (_process_data.py_bc_object == nullptr ||
351 {
352 return;
353 }
354
355 auto& [time, Tin_value, Tout_value, Tout_nodes_ids, flowrate] =
357
358 // We found the problem that time != t, but it always equals the last
359 // step. The following line is to correct this, although we do not use
360 // it for server communication.
361 time = t;
362
363 auto const& solution = *x[process_id];
364
365 // Iterate through each BHE
366 const std::size_t n_bc_nodes = Tout_nodes_ids.size();
367 for (std::size_t i = 0; i < n_bc_nodes; i++)
368 {
369 // read the T_out and store them in dataframe
370 Tout_value[i] = solution[Tout_nodes_ids[i]];
371 }
372
373 // Transfer T_out to server_Communication and get back T_in and flowrate
374 auto const server_communication_result =
376 t, dt, Tin_value, Tout_value, flowrate);
379 {
380 DBUG("Method `serverCommunication' not overridden in Python script.");
381 }
382
383 auto const& [server_communication_Tin_value,
384 server_communication_flowrate] = server_communication_result;
385
386 std::copy(begin(server_communication_Tin_value),
387 end(server_communication_Tin_value),
388 begin(Tin_value));
389 std::copy(begin(server_communication_flowrate),
390 end(server_communication_flowrate),
391 begin(flowrate));
392}
393
395 std::vector<GlobalVector*> const& x,
396 std::vector<GlobalVector*> const& /*x_prev*/, const double t,
397 const double dt, int const process_id)
398{
399 if (_process_data.py_bc_object == nullptr ||
401 {
402 return;
403 }
404
405 auto& [time, Tin_value, Tout_value, Tout_nodes_ids, flowrate] =
407
408 // We found the problem that time != t, but it always equals the last
409 // step. The following line is to correct this, although we do not use
410 // it for server communication.
411 time = t;
412
413 auto const& solution = *x[process_id];
414
415 // Iterate through each BHE
416 const std::size_t n_bc_nodes = Tout_nodes_ids.size();
417 for (std::size_t i = 0; i < n_bc_nodes; i++)
418 {
419 // read the T_out and store them in dataframe
420 Tout_value[i] = solution[Tout_nodes_ids[i]];
421 }
422
423 // Transfer T_out to server_Communication
425 t, dt, Tin_value, Tout_value, flowrate);
428 {
429 DBUG("Method `serverCommunication' not overridden in Python script.");
430 }
431}
432
434 [[maybe_unused]] const double t, double const /*dt*/,
435 [[maybe_unused]] std::vector<GlobalVector*> const& x,
436 std::vector<GlobalVector*> const& /*xprev*/, int const /*process_id*/,
437 [[maybe_unused]] GlobalMatrix& M, [[maybe_unused]] GlobalMatrix& K,
438 [[maybe_unused]] GlobalVector& b)
439{
440#ifndef USE_PETSC
441 auto M_normal = M.getRawMatrix();
442 auto K_normal = K.getRawMatrix();
443 auto n_original_rows = K_normal.rows();
444 auto const n_BHE_bottom_pairs = _vec_bottom_BHE_node_indices.size();
445 auto const n_BHE_top_pairs = _vec_top_BHE_node_indices.size();
446
447 // apply weighting factor based on the max value from column wise inner
448 // product and scale it with user defined value
450
451 M_normal.conservativeResize(
452 M_normal.rows() + n_BHE_bottom_pairs + n_BHE_top_pairs,
453 M_normal.cols());
454 K_normal.conservativeResize(
455 K_normal.rows() + n_BHE_bottom_pairs + n_BHE_top_pairs,
456 K_normal.cols());
457
458 for (std::size_t i = 0; i < n_BHE_bottom_pairs; i++)
459 {
460 Eigen::SparseVector<double> M_Plus(M_normal.cols());
461 M_Plus.setZero();
462 M_normal.row(n_original_rows + i) = M_Plus;
463
464 Eigen::SparseVector<double> K_Plus(K_normal.cols());
465 K_Plus.setZero();
466
467 auto const [bhe_idx, first_BHE_bottom_index, second_BHE_bottom_index] =
469
470 K_Plus.insert(first_BHE_bottom_index) = w_val;
471 K_Plus.insert(second_BHE_bottom_index) = -w_val;
472
473 K_normal.row(n_original_rows + i) = K_Plus;
474 }
475
476 auto b_normal = b.getRawVector();
477 Eigen::SparseVector<double> b_Plus(b_normal.rows() + n_BHE_bottom_pairs +
478 n_BHE_top_pairs);
479 b_Plus.setZero();
480
481 // Copy values from the original column vector to the modified one
482 for (int i = 0; i < b_normal.innerSize(); ++i)
483 {
484 b_Plus.insert(i) = b_normal.coeff(i);
485 }
486
487 for (std::size_t i = 0; i < n_BHE_top_pairs; i++)
488 {
489 Eigen::SparseVector<double> M_Plus(M_normal.cols());
490 M_Plus.setZero();
491 M_normal.row(n_original_rows + n_BHE_bottom_pairs + i) = M_Plus;
492
493 Eigen::SparseVector<double> K_Plus(K_normal.cols());
494 K_Plus.setZero();
495
496 auto const [bhe_idx, first_BHE_top_index, second_BHE_top_index] =
498
499 auto first_BHE_top_index_pair = first_BHE_top_index;
500 auto second_BHE_top_index_pair = second_BHE_top_index;
501
502 K_Plus.insert(first_BHE_top_index_pair) =
503 w_val; // for power BC, the inflow node must be positive
504 K_Plus.insert(second_BHE_top_index_pair) =
505 -w_val; // for power BC, the outflow node must be negative
506
507 K_normal.row(n_original_rows + n_BHE_bottom_pairs + i) = K_Plus;
508
509 // get the delta_T value here
510 double const T_out = (*x[0])[second_BHE_top_index_pair];
511
512 auto calculate_delta_T = [&](auto& bhe)
513 {
514 auto const T_in = bhe.updateFlowRateAndTemperature(T_out, t);
515 return T_in - T_out;
516 };
517 auto delta_T = std::visit(calculate_delta_T,
519
520 b_Plus.insert(n_original_rows + n_BHE_bottom_pairs + i) =
521 delta_T * w_val;
522 }
523
524 M.getRawMatrix() = M_normal;
525 K.getRawMatrix() = K_normal;
526 b.getRawVector() = b_Plus;
527#else
528 OGS_FATAL(
529 "The Algebraic Boundary Condition is not implemented for use with "
530 "PETsc Library! Simulation will be terminated.");
531#endif
532}
533
535 std::vector<std::vector<MeshLib::Node*>> const& all_bhe_nodes)
536{
537 const int process_id = 0;
538 auto& bcs = _boundary_conditions[process_id];
539
540 std::size_t const n_BHEs = _process_data._vec_BHE_property.size();
541
542 // for each BHE
543 for (std::size_t bhe_i = 0; bhe_i < n_BHEs; bhe_i++)
544 {
545 auto const& bhe_nodes = all_bhe_nodes[bhe_i];
546 // find the variable ID
547 // the soil temperature is 0-th variable
548 // the BHE temperature is therefore bhe_i + 1
549 const int variable_id = bhe_i + 1;
550
551 std::vector<MeshLib::Node*> bhe_boundary_nodes;
552
553 // cherry-pick the boundary nodes according to
554 // the number of connected line elements.
555 for (auto const& bhe_node : bhe_nodes)
556 {
557 // Count number of 1d elements connected with every BHE node.
558 auto const& connected_elements =
560 const std::size_t n_line_elements = std::count_if(
561 connected_elements.begin(), connected_elements.end(),
562 [](MeshLib::Element const* elem)
563 { return (elem->getDimension() == 1); });
564
565 if (n_line_elements == 1)
566 {
567 bhe_boundary_nodes.push_back(bhe_node);
568 }
569 }
570
571 if (bhe_boundary_nodes.size() != 2)
572 {
573 OGS_FATAL(
574 "Error!!! The BHE boundary nodes are not correctly found, "
575 "for every single BHE, there should be 2 boundary nodes.");
576 }
577
578 // For 1U, 2U, CXC, CXA type BHE, the node order in the boundary nodes
579 // vector should be rearranged according to its z coordinate in
580 // descending order. In these BHE types, the z coordinate on the top and
581 // bottom node is different. The BHE top node with a higher z coordinate
582 // should be placed at the first, while the BHE bottom node with a lower
583 // z coordinate should be placed at the second. For other horizontal BHE
584 // types e.g. 1P-type BHE, the z coordinate on the top and bottom node
585 // is identical. Thus the node order in the boundary nodes vector can
586 // not be rearranged according to its z coordinate. For these BHE types,
587 // the boundary node order is according to the default node id order in
588 // the model mesh.
589 // for 1P-type BHE
590 if ((*bhe_boundary_nodes[0])[2] == (*bhe_boundary_nodes[1])[2])
591 {
592 INFO(
593 "For 1P-type BHE, the BHE inflow and outflow "
594 "nodes are identified according to their mesh node id in "
595 "ascending order");
596 }
597 // for 1U, 2U, CXC, CXA type BHE
598 else
599 {
600 // swap the boundary nodes if the z coordinate of the
601 // first node is lower than it on the second node
602 if ((*bhe_boundary_nodes[0])[2] < (*bhe_boundary_nodes[1])[2])
603 {
604 std::swap(bhe_boundary_nodes[0], bhe_boundary_nodes[1]);
605 }
606 }
607
608 auto get_global_index =
609 [&](std::size_t const node_id, int const component)
610 {
611 return _local_to_global_index_map->getGlobalIndex(
613 variable_id, component);
614 };
615
616 auto get_global_bhe_bc_indices =
617 [&](std::array<
618 std::pair<std::size_t /*node_id*/, int /*component*/>, 2>
619 nodes_and_components)
620 {
621 return std::make_pair(
622 get_global_index(nodes_and_components[0].first,
623 nodes_and_components[0].second),
624 get_global_index(nodes_and_components[1].first,
625 nodes_and_components[1].second));
626 };
627
628 auto get_global_bhe_bc_indices_with_bhe_idx =
629 [&](std::size_t bhe_idx,
630 std::array<
631 std::pair<std::size_t /*node_id*/, int /*component*/>, 2>
632 nodes_and_components)
633 {
634 return std::make_tuple(
635 bhe_idx,
636 get_global_index(nodes_and_components[0].first,
637 nodes_and_components[0].second),
638 get_global_index(nodes_and_components[1].first,
639 nodes_and_components[1].second));
640 };
641
642 auto createBCs =
643 [&, bc_top_node_id = bhe_boundary_nodes[0]->getID(),
644 bc_bottom_node_id = bhe_boundary_nodes[1]->getID()](auto& bhe)
645 {
646 for (auto const& in_out_component_id :
647 bhe.inflow_outflow_bc_component_ids)
648 {
649 if (bhe.use_python_bcs ||
650 this->_process_data._use_server_communication)
651 // call BHEPythonBoundarycondition
652 {
653 if (this->_process_data
654 .py_bc_object) // the bc object exist
655 {
656 // apply the customized top, inflow BC.
657 bcs.addBoundaryCondition(
659 get_global_bhe_bc_indices(
660 bhe.getBHEInflowDirichletBCNodesAndComponents(
661 bc_top_node_id, bc_bottom_node_id,
662 in_out_component_id.first)),
663 bhe,
665 }
666 else
667 {
668 OGS_FATAL(
669 "The Python Boundary Condition was switched on, "
670 "but the data object does not exist! ");
671 }
672 }
673 else
674 {
677 bhe.isPowerBC())
678 {
679 // for algebraic_bc method, record the pair of indices
680 // in a separate vector
682 get_global_bhe_bc_indices_with_bhe_idx(
683 bhe_i,
684 {{{bc_top_node_id, in_out_component_id.first},
685 {bc_top_node_id,
686 in_out_component_id.second}}}));
687 }
688 else
689 {
690 // Top, inflow, normal case
691 bcs.addBoundaryCondition(
693 get_global_bhe_bc_indices(
694 bhe.getBHEInflowDirichletBCNodesAndComponents(
695 bc_top_node_id, bc_bottom_node_id,
696 in_out_component_id.first)),
697 [&bhe](double const T, double const t) {
698 return bhe.updateFlowRateAndTemperature(T,
699 t);
700 }));
701 }
702 }
703
704 auto const bottom_nodes_and_components =
705 bhe.getBHEBottomDirichletBCNodesAndComponents(
706 bc_bottom_node_id,
707 in_out_component_id.first,
708 in_out_component_id.second);
709
710 if (bottom_nodes_and_components &&
713 {
714 // Bottom, outflow, all cases | not needed for algebraic_bc
715 // method
716 bcs.addBoundaryCondition(
718 get_global_bhe_bc_indices(
719 {{{bc_bottom_node_id,
720 in_out_component_id.first},
721 {bc_bottom_node_id,
722 in_out_component_id.second}}})));
723 }
724 else if (bottom_nodes_and_components &&
727 {
728 // for algebraic_bc method, record the pair of indices in a
729 // separate vector
731 get_global_bhe_bc_indices_with_bhe_idx(
732 bhe_i,
733 {{{bc_bottom_node_id, in_out_component_id.first},
734 {bc_bottom_node_id,
735 in_out_component_id.second}}}));
736 }
737 }
738 };
739 visit(createBCs, _process_data._vec_BHE_property[bhe_i]);
740 }
741}
742} // namespace HeatTransportBHE
743} // 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
Global vector based on Eigen vector.
Definition EigenVector.h:25
Element search class.
std::size_t searchByNodeIDs(const std::vector< std::size_t > &nodes)
Marks all elements connecting to any of the given nodes.
bool isAxiallySymmetric() const
Definition Mesh.h:137
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition Mesh.h:106
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition Mesh.h:109
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition Mesh.h:88
std::size_t getID() const
Get id of the mesh.
Definition Mesh.h:121
std::vector< Element const * > const & getElementsConnectedToNode(std::size_t node_id) const
Definition Mesh.cpp:256
std::size_t getNumberOfElements() const
Get the number of elements.
Definition Mesh.h:97
std::tuple< double, std::vector< double >, std::vector< double >, std::vector< int >, std::vector< double > > dataframe_network
virtual std::tuple< bool, bool, std::vector< double >, std::vector< double > > tespySolver(double, std::vector< double > const &, std::vector< double > const &) const
virtual void serverCommunicationPostTimestep(double, double, std::vector< double > const &, std::vector< double > const &, std::vector< double > const &) const
virtual std::tuple< std::vector< double >, std::vector< double > > serverCommunicationPreTimestep(double, double, std::vector< double > const &, std::vector< double > const &, std::vector< double > const &) const
std::unique_ptr< MeshLib::MeshSubset const > _mesh_subset_soil_nodes
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
std::vector< std::unique_ptr< MeshLib::MeshSubset const > > _mesh_subset_BHE_nodes
std::vector< std::tuple< std::size_t, GlobalIndexType, GlobalIndexType > > _vec_bottom_BHE_node_indices
void computeSecondaryVariableConcrete(double const t, double const dt, std::vector< GlobalVector * > const &x, GlobalVector const &x_prev, int const process_id) override
std::vector< std::unique_ptr< HeatTransportBHELocalAssemblerInterface > > _local_assemblers
HeatTransportBHEProcess(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, HeatTransportBHEProcessData &&process_data, SecondaryVariableCollection &&secondary_variables, BHEMeshData &&bhe_mesh_data)
NumLib::IterationResult postIterationConcreteProcess(GlobalVector const &x) override
void preTimestepConcreteProcess(std::vector< GlobalVector * > const &x, const double t, const double dt, int const process_id) override
std::vector< std::tuple< std::size_t, GlobalIndexType, GlobalIndexType > > _vec_top_BHE_node_indices
void initializeConcreteProcess(NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, unsigned const integration_order) override
Process specific initialization called by initialize().
void algebraicBcConcreteProcess(const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &xdot, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b)
void assembleWithJacobianConcreteProcess(const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalVector &b, GlobalMatrix &Jac) 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
void createBHEBoundaryConditionTopBottom(std::vector< std::vector< MeshLib::Node * > > const &all_bhe_nodes)
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< BoundaryConditionCollection > _boundary_conditions
Definition Process.h:405
std::unique_ptr< MeshLib::MeshSubset const > _mesh_subset_all_nodes
Definition Process.h:366
MeshLib::Mesh & _mesh
Definition Process.h:365
std::vector< std::size_t > const & getActiveElementIDs() const
Definition Process.h:167
VectorMatrixAssembler _global_assembler
Definition Process.h:377
std::unique_ptr< NumLib::LocalToGlobalIndexMap > _local_to_global_index_map
Definition Process.h:368
MathLib::MatrixSpecifications getMatrixSpecifications(const int process_id) const override
Definition Process.cpp:210
Handles configuration of several secondary variables from the project file.
void assemble(std::size_t const mesh_item_id, LocalAssemblerInterface &local_assembler, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, double const 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)
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, GlobalVector *b, GlobalMatrix *Jac)
IterationResult
Status flags telling the NonlinearSolver if an iteration succeeded.
void setMatrixSparsity(MATRIX &matrix, SPARSITY_PATTERN const &sparsity_pattern)
constexpr ranges::views::view_closure ids
For an element of a range view return its id.
Definition Mesh.h:225
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition Mesh.cpp:268
@ BY_COMPONENT
Ordering data by component type.
std::unique_ptr< BHEInflowDirichletBoundaryCondition< BHEUpdateCallback > > createBHEInflowDirichletBoundaryCondition(std::pair< GlobalIndexType, GlobalIndexType > &&in_out_global_indices, BHEUpdateCallback bhe_update_callback)
std::unique_ptr< BHEBottomDirichletBoundaryCondition > createBHEBottomDirichletBoundaryCondition(std::pair< GlobalIndexType, GlobalIndexType > &&in_out_global_indices)
void createLocalAssemblers(std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface > > &local_assemblers, NumLib::IntegrationOrder const integration_order, ExtraCtorArgs &&... extra_ctor_args)
std::unique_ptr< BHEInflowPythonBoundaryCondition< BHEType > > createBHEInflowPythonBoundaryCondition(std::pair< GlobalIndexType, GlobalIndexType > &&in_out_global_indices, BHEType &bhe, BHEInflowPythonBoundaryConditionPythonSideInterface &py_bc_object)
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 *const M, GlobalMatrix *const K, GlobalVector *const 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)
std::vector< std::vector< MeshLib::Node * > > BHE_nodes
Definition MeshUtils.h:38
std::vector< std::vector< MeshLib::Element * > > BHE_elements
Definition MeshUtils.h:37
BHEInflowPythonBoundaryConditionPythonSideInterface * py_bc_object
Python object computing BC values.