OGS 6.2.0-555-gc9b84ea78.dirty.20190716144505
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 (std::string name, 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 ( std::string  name,
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().

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