OGS 6.2.0-244-g47b8a9a9d
ProcessLib::HeatTransportBHE Namespace Reference

Namespaces

 BHE
 
 detail
 

Classes

class  BHEBottomDirichletBoundaryCondition
 
class  BHEInflowDirichletBoundaryCondition
 
struct  BHEMeshData
 
class  HeatTransportBHELocalAssemblerBHE
 
class  HeatTransportBHELocalAssemblerInterface
 
class  HeatTransportBHELocalAssemblerSoil
 
class  HeatTransportBHEProcess
 
struct  HeatTransportBHEProcessData
 
struct  IntegrationPointDataBHE
 
struct  IntegrationPointDataSoil
 
class  LocalDataInitializer
 
struct  SecondaryData
 

Functions

BHEMeshData getBHEDataInMesh (MeshLib::Mesh const &mesh)
 
std::unique_ptr< BHEBottomDirichletBoundaryConditioncreateBHEBottomDirichletBoundaryCondition (std::pair< GlobalIndexType, GlobalIndexType > &&in_out_global_indices)
 
template<typename BHEUpdateCallback >
std::unique_ptr< BHEInflowDirichletBoundaryCondition< BHEUpdateCallback > > createBHEInflowDirichletBoundaryCondition (std::pair< GlobalIndexType, GlobalIndexType > &&in_out_global_indices, BHEUpdateCallback bhe_update_callback)
 
std::unique_ptr< ProcesscreateHeatTransportBHEProcess (MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, unsigned const integration_order, BaseLib::ConfigTree const &config, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation >> const &curves)
 
template<template< typename, typename > class LocalAssemblerSoilImplementation, template< typename, typename, typename > class LocalAssemblerBHEImplementation, typename LocalAssemblerInterface , typename... ExtraCtorArgs>
void createLocalAssemblers (std::vector< MeshLib::Element *> const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface >> &local_assemblers, ExtraCtorArgs &&... extra_ctor_args)
 

Function Documentation

◆ createBHEBottomDirichletBoundaryCondition()

std::unique_ptr< BHEBottomDirichletBoundaryCondition > ProcessLib::HeatTransportBHE::createBHEBottomDirichletBoundaryCondition ( std::pair< GlobalIndexType, GlobalIndexType > &&  in_out_global_indices)

Definition at line 31 of file BHEBottomDirichletBoundaryCondition.cpp.

References OGS_FATAL.

Referenced by ProcessLib::HeatTransportBHE::HeatTransportBHEProcess::createBHEBoundaryConditionTopBottom().

33 {
34  DBUG("Constructing BHEBottomDirichletBoundaryCondition.");
35 
36  // In case of partitioned mesh the boundary could be empty, i.e. there is no
37  // boundary condition.
38 #ifdef USE_PETSC
39  // For this special boundary condition the boundary condition is not empty
40  // if the global indices are non-negative.
41  if (in_out_global_indices.first < 0 && in_out_global_indices.second < 0)
42  {
43  return nullptr;
44  }
45  // If only one of the global indices (in or out) is negative the
46  // implementation is not valid.
47  if (in_out_global_indices.first < 0 || in_out_global_indices.second < 0)
48  {
49  OGS_FATAL(
50  "The partition cuts the BHE into two independent parts. This "
51  "behaviour is not implemented.");
52  }
53 #endif // USE_PETSC
54 
55  return std::make_unique<BHEBottomDirichletBoundaryCondition>(
56  std::move(in_out_global_indices));
57 }
#define OGS_FATAL(fmt,...)
Definition: Error.h:63

◆ createBHEInflowDirichletBoundaryCondition()

template<typename BHEUpdateCallback >
std::unique_ptr<BHEInflowDirichletBoundaryCondition<BHEUpdateCallback> > ProcessLib::HeatTransportBHE::createBHEInflowDirichletBoundaryCondition ( std::pair< GlobalIndexType, GlobalIndexType > &&  in_out_global_indices,
BHEUpdateCallback  bhe_update_callback 
)

Definition at line 50 of file BHEInflowDirichletBoundaryCondition.h.

References OGS_FATAL.

Referenced by ProcessLib::HeatTransportBHE::HeatTransportBHEProcess::createBHEBoundaryConditionTopBottom().

53 {
54  DBUG("Constructing BHEInflowDirichletBoundaryCondition.");
55 
56  // In case of partitioned mesh the boundary could be empty, i.e. there is no
57  // boundary condition.
58 #ifdef USE_PETSC
59  // For this special boundary condition the boundary condition is not empty
60  // if the global indices are non-negative.
61  if (in_out_global_indices.first < 0 && in_out_global_indices.second < 0)
62  {
63  return nullptr;
64  }
65  // If only one of the global indices (in or out) is negative the
66  // implementation is not valid.
67  if (in_out_global_indices.first < 0 || in_out_global_indices.second < 0)
68  {
69  OGS_FATAL(
70  "The partition cuts the BHE into two independent parts. This "
71  "behaviour is not implemented.");
72  }
73 #endif // USE_PETSC
74 
75  return std::make_unique<
76  BHEInflowDirichletBoundaryCondition<BHEUpdateCallback>>(
77  std::move(in_out_global_indices), bhe_update_callback);
78 }
#define OGS_FATAL(fmt,...)
Definition: Error.h:63

◆ createHeatTransportBHEProcess()

std::unique_ptr< Process > ProcessLib::HeatTransportBHE::createHeatTransportBHEProcess ( MeshLib::Mesh mesh,
std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&  jacobian_assembler,
std::vector< ProcessVariable > const &  variables,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters,
unsigned const  integration_order,
BaseLib::ConfigTree const &  config,
std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation >> const &  curves 
)
Input File Parameter:
prj__processes__process__type
Input File Parameter:
prj__processes__process__HEAT_TRANSPORT_BHE__process_variables
Input File Parameter:
prj__processes__process__HEAT_TRANSPORT_BHE__process_variables__process_variable
Input File Parameter:
prj__processes__process__HEAT_TRANSPORT_BHE__thermal_conductivity_solid
Input File Parameter:
prj__processes__process__HEAT_TRANSPORT_BHE__thermal_conductivity_fluid
Input File Parameter:
prj__processes__process__HEAT_TRANSPORT_BHE__thermal_conductivity_gas
Input File Parameter:
prj__processes__process__HEAT_TRANSPORT_BHE__heat_capacity_solid
Input File Parameter:
prj__processes__process__HEAT_TRANSPORT_BHE__heat_capacity_fluid
Input File Parameter:
prj__processes__process__HEAT_TRANSPORT_BHE__heat_capacity_gas
Input File Parameter:
prj__processes__process__HEAT_TRANSPORT_BHE__density_solid
Input File Parameter:
prj__processes__process__HEAT_TRANSPORT_BHE__density_fluid
Input File Parameter:
prj__processes__process__HEAT_TRANSPORT_BHE__density_gas
Input File Parameter:
prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers
Input File Parameter:
prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger
Input File Parameter:
prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__type

Definition at line 27 of file CreateHeatTransportBHEProcess.cpp.

References BaseLib::ConfigTree::checkConfigParameter(), ProcessLib::HeatTransportBHE::BHE::createBHE1U(), ProcessLib::createSecondaryVariables(), BaseLib::ConfigTree::getConfigParameterList(), BaseLib::ConfigTree::getConfigSubtree(), and OGS_FATAL.

Referenced by ProjectData::parseProcesses().

37 {
39  config.checkConfigParameter("type", "HEAT_TRANSPORT_BHE");
40 
41  DBUG("Create HeatTransportBHE Process.");
42 
43  // Process variable.
44 
46  auto const pv_config = config.getConfigSubtree("process_variables");
47  std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
48  process_variables;
49 
50  // reading primary variables for each
51  // BHE----------------------------------------------------------
52  auto range =
54  pv_config.getConfigParameterList<std::string>("process_variable");
55  std::vector<std::reference_wrapper<ProcessVariable>> per_process_variables;
56 
57  for (std::string const& pv_name : range)
58  {
59  if (pv_name != "temperature_soil" &&
60  pv_name.find("temperature_BHE") == std::string::npos)
61  {
62  OGS_FATAL(
63  "Found a process variable name '%s'. It should be "
64  "'temperature_soil' or 'temperature_BHE_X'");
65  }
66  auto variable = std::find_if(variables.cbegin(), variables.cend(),
67  [&pv_name](ProcessVariable const& v) {
68  return v.getName() == pv_name;
69  });
70 
71  if (variable == variables.end())
72  {
73  OGS_FATAL(
74  "Could not find process variable '%s' in the provided "
75  "variables "
76  "list for config tag <%s>.",
77  pv_name.c_str(), "process_variable");
78  }
79  DBUG("Found process variable '%s' for config tag <%s>.",
80  variable->getName().c_str(), "process_variable");
81 
82  per_process_variables.emplace_back(
83  const_cast<ProcessVariable&>(*variable));
84  }
85  process_variables.push_back(std::move(per_process_variables));
86  // end of reading primary variables for each
87  // BHE----------------------------------------------------------
88 
89  // solid phase thermal conductivity parameter.
90  auto& thermal_conductivity_solid = ParameterLib::findParameter<double>(
91  config,
93  "thermal_conductivity_solid", parameters, 1, &mesh);
94 
95  DBUG("Use '%s' as solid phase thermal conductivity parameter.",
96  thermal_conductivity_solid.name.c_str());
97 
98  // solid phase thermal conductivity parameter.
99  auto& thermal_conductivity_fluid = ParameterLib::findParameter<double>(
100  config,
102  "thermal_conductivity_fluid", parameters, 1, &mesh);
103 
104  DBUG("Use '%s' as fluid phase thermal conductivity parameter.",
105  thermal_conductivity_fluid.name.c_str());
106 
107  // gas phase thermal conductivity parameter.
108  auto& thermal_conductivity_gas = ParameterLib::findParameter<double>(
109  config,
111  "thermal_conductivity_gas", parameters, 1, &mesh);
112 
113  DBUG("Use '%s' as gas phase thermal conductivity parameter.",
114  thermal_conductivity_gas.name.c_str());
115 
116  // solid phase heat capacity parameter.
117  auto& heat_capacity_solid = ParameterLib::findParameter<double>(
118  config,
120  "heat_capacity_solid", parameters, 1, &mesh);
121 
122  DBUG("Use '%s' as solid phase heat capacity parameter.",
123  heat_capacity_solid.name.c_str());
124 
125  // fluid phase heat capacity parameter.
126  auto& heat_capacity_fluid = ParameterLib::findParameter<double>(
127  config,
129  "heat_capacity_fluid", parameters, 1, &mesh);
130 
131  DBUG("Use '%s' as fluid phase heat capacity parameter.",
132  heat_capacity_fluid.name.c_str());
133 
134  // gas phase heat capacity parameter.
135  auto& heat_capacity_gas = ParameterLib::findParameter<double>(
136  config,
138  "heat_capacity_gas", parameters, 1, &mesh);
139 
140  DBUG("Use '%s' as gas phase heat capacity parameter.",
141  heat_capacity_gas.name.c_str());
142 
143  // solid phase density parameter.
144  auto& density_solid = ParameterLib::findParameter<double>(
145  config,
147  "density_solid", parameters, 1, &mesh);
148 
149  DBUG("Use '%s' as solid phase density parameter.",
150  density_solid.name.c_str());
151 
152  // fluid phase density parameter.
153  auto& density_fluid = ParameterLib::findParameter<double>(
154  config,
156  "density_fluid", parameters, 1, &mesh);
157 
158  DBUG("Use '%s' as fluid phase density parameter.",
159  density_fluid.name.c_str());
160 
161  // gas phase density parameter.
162  auto& density_gas = ParameterLib::findParameter<double>(
163  config,
165  "density_gas", parameters, 1, &mesh);
166 
167  DBUG("Use '%s' as gas phase density parameter.", density_gas.name.c_str());
168 
169  // reading BHE parameters --------------------------------------------------
170  std::vector<BHE::BHETypes> bhes;
171  auto const& bhe_configs =
173  config.getConfigSubtree("borehole_heat_exchangers");
174 
175  for (
176  auto const& bhe_config :
178  bhe_configs.getConfigSubtreeList("borehole_heat_exchanger"))
179  {
180  // read in the parameters
181  const std::string bhe_type =
183  bhe_config.getConfigParameter<std::string>("type");
184 
185  if (bhe_type == "1U")
186  {
187  bhes.emplace_back(BHE::createBHE1U(bhe_config, curves));
188  continue;
189  }
190 
191  if (bhe_type == "CXA")
192  {
193  bhes.emplace_back(
194  BHE::createBHECoaxial<BHE::BHE_CXA>(bhe_config, curves));
195  continue;
196  }
197 
198  if (bhe_type == "CXC")
199  {
200  bhes.emplace_back(
201  BHE::createBHECoaxial<BHE::BHE_CXC>(bhe_config, curves));
202  continue;
203  }
204  OGS_FATAL("Unknown BHE type '%s'.", bhe_type.c_str());
205  }
206  // end of reading BHE parameters -------------------------------------------
207 
208  HeatTransportBHEProcessData process_data{thermal_conductivity_solid,
209  thermal_conductivity_fluid,
210  thermal_conductivity_gas,
211  heat_capacity_solid,
212  heat_capacity_fluid,
213  heat_capacity_gas,
214  density_solid,
215  density_fluid,
216  density_gas,
217  std::move(bhes)};
218 
219  SecondaryVariableCollection secondary_variables;
220 
221  NumLib::NamedFunctionCaller named_function_caller(
222  {"HeatTransportBHE_Temperature"});
223 
224  ProcessLib::createSecondaryVariables(config, secondary_variables,
225  named_function_caller);
226 
227  return std::make_unique<HeatTransportBHEProcess>(
228  mesh, std::move(jacobian_assembler), parameters, integration_order,
229  std::move(process_variables), std::move(process_data),
230  std::move(secondary_variables), std::move(named_function_caller));
231 }
void createSecondaryVariables(BaseLib::ConfigTree const &config, SecondaryVariableCollection &secondary_variables, NumLib::NamedFunctionCaller &named_function_caller)
BHE::BHE_1U createBHE1U(BaseLib::ConfigTree const &config, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation >> const &curves)
Definition: CreateBHE1U.cpp:21
Builds expression trees of named functions dynamically at runtime.
#define OGS_FATAL(fmt,...)
Definition: Error.h:63

◆ createLocalAssemblers()

template<template< typename, typename > class LocalAssemblerSoilImplementation, template< typename, typename, typename > class LocalAssemblerBHEImplementation, typename LocalAssemblerInterface , typename... ExtraCtorArgs>
void ProcessLib::HeatTransportBHE::createLocalAssemblers ( std::vector< MeshLib::Element *> const &  mesh_elements,
NumLib::LocalToGlobalIndexMap const &  dof_table,
std::vector< std::unique_ptr< LocalAssemblerInterface >> &  local_assemblers,
ExtraCtorArgs &&...  extra_ctor_args 
)

Creates local assemblers for each element of the given mesh.

Template Parameters
LocalAssemblerImplementationthe individual local assembler type
LocalAssemblerInterfacethe general local assembler interface
ExtraCtorArgstypes of additional constructor arguments. Those arguments will be passed to the constructor of LocalAssemblerImplementation.

The first two template parameters cannot be deduced from the arguments. Therefore they always have to be provided manually.

Definition at line 70 of file CreateLocalAssemblers.h.

References ProcessLib::HeatTransportBHE::detail::createLocalAssemblers().

Referenced by ProcessLib::HeatTransportBHE::HeatTransportBHEProcess::initializeConcreteProcess().

75 {
76  DBUG("Create local assemblers for the HeatTransportBHE process.");
77 
78  detail::createLocalAssemblers<LocalAssemblerSoilImplementation,
79  LocalAssemblerBHEImplementation>(
80  dof_table, mesh_elements, local_assemblers,
81  std::forward<ExtraCtorArgs>(extra_ctor_args)...);
82 }
void createLocalAssemblers(const unsigned dimension, std::vector< MeshLib::Element *> const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, const unsigned shapefunction_order, std::vector< std::unique_ptr< LocalAssemblerInterface >> &local_assemblers, ExtraCtorArgs &&... extra_ctor_args)

◆ getBHEDataInMesh()

BHEMeshData ProcessLib::HeatTransportBHE::getBHEDataInMesh ( MeshLib::Mesh const &  mesh)

get data about fracture and matrix elements/nodes from a mesh

Parameters
meshA mesh which includes BHE elements, i.e. 1-dimensional elements. It is assumed that elements forming a BHE have a distinct material ID.

Definition at line 49 of file MeshUtils.cpp.

References anonymous_namespace{MeshUtils.cpp}::extractOneDimensionalElements(), MeshLib::Mesh::getElements(), MathLib::Point3dWithID::getID(), MeshLib::Element::getID(), MeshLib::Mesh::getNumberOfElements(), anonymous_namespace{MeshUtils.cpp}::getUniqueMaterialIds(), BaseLib::makeVectorUnique(), MeshLib::materialIDs(), and OGS_FATAL.

50 {
51  std::vector<MeshLib::Element*> const all_bhe_elements =
52  extractOneDimensionalElements(mesh.getElements());
53 
54  // finally counting two types of elements
55  // They are (i) soil, and (ii) BHE type of elements
56  DBUG("-> found total %d soil elements and %d BHE elements",
57  mesh.getNumberOfElements() - all_bhe_elements.size(),
58  all_bhe_elements.size());
59 
60  // get BHE material IDs
61  auto const* const opt_material_ids = MeshLib::materialIDs(mesh);
62  if (opt_material_ids == nullptr)
63  {
64  OGS_FATAL("Not able to get material IDs! ");
65  }
66  auto const& material_ids = *opt_material_ids;
67 
68  auto const& bhe_material_ids =
69  getUniqueMaterialIds(material_ids, all_bhe_elements);
70  DBUG("-> found %d BHE material groups", bhe_material_ids.size());
71 
72  // create a vector of BHE elements for each group
73  std::vector<std::vector<MeshLib::Element*>> bhe_elements;
74  bhe_elements.resize(bhe_material_ids.size());
75  for (unsigned bhe_id = 0; bhe_id < bhe_material_ids.size(); bhe_id++)
76  {
77  const auto bhe_mat_id = bhe_material_ids[bhe_id];
78  std::vector<MeshLib::Element*>& vec_elements = bhe_elements[bhe_id];
79  copy_if(begin(all_bhe_elements), end(all_bhe_elements),
80  back_inserter(vec_elements), [&](MeshLib::Element* e) {
81  return material_ids[e->getID()] == bhe_mat_id;
82  });
83  DBUG("-> found %d elements on the BHE_%d", vec_elements.size(), bhe_id);
84  }
85 
86  // get a vector of BHE nodes
87  std::vector<std::vector<MeshLib::Node*>> bhe_nodes;
88  bhe_nodes.resize(bhe_material_ids.size());
89  for (unsigned bhe_id = 0; bhe_id < bhe_material_ids.size(); bhe_id++)
90  {
91  std::vector<MeshLib::Node*>& vec_nodes = bhe_nodes[bhe_id];
92  for (MeshLib::Element* e : bhe_elements[bhe_id])
93  {
94  for (unsigned i = 0; i < e->getNumberOfNodes(); i++)
95  {
96  vec_nodes.push_back(const_cast<MeshLib::Node*>(e->getNode(i)));
97  }
98  }
100  vec_nodes, [](MeshLib::Node* node1, MeshLib::Node* node2) {
101  return node1->getID() < node2->getID();
102  });
103  DBUG("-> found %d nodes on the BHE_%d", vec_nodes.size(), bhe_id);
104  }
105 
106  return {bhe_material_ids, bhe_elements, bhe_nodes};
107 }
void makeVectorUnique(std::vector< T > &v)
Definition: Algorithm.h:177
std::size_t getID() const
Definition: Point3dWithID.h:64
std::vector< int > getUniqueMaterialIds(std::vector< int > const &material_ids, std::vector< MeshLib::Element *> const &elements)
Definition: MeshUtils.cpp:31
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition: Mesh.cpp:403
virtual std::size_t getID() const final
Returns the ID of the element.
Definition: Element.h:90
#define OGS_FATAL(fmt,...)
Definition: Error.h:63
virtual unsigned getNumberOfNodes() const =0
Returns the number of all nodes including both linear and nonlinear nodes.
std::vector< MeshLib::Element * > extractOneDimensionalElements(std::vector< MeshLib::Element *> const &elements)
Definition: MeshUtils.cpp:19
const Node * getNode(unsigned i) const
Definition: Element.cpp:156