Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of deep coaxial BHE process with types of CXA and CXC #2332

Merged
merged 14 commits into from Feb 16, 2019

Conversation

Projects
None yet
4 participants
@ChaofanChen
Copy link
Member

ChaofanChen commented Jan 25, 2019

In this PR, the process of coaxial BHE was implemented plus new BHE boundary condition of "PowerCurveConstantFlow" and new input parameters were documented.
In addition, there is a new benchmark added.
All the codes were Clang formatted.

@ChaofanChen ChaofanChen force-pushed the ChaofanChen:dbhe_impl branch from afeaf88 to 571dc55 Jan 25, 2019

@@ -0,0 +1 @@
It is the curve stands for the variation of heat load on the BHE.

This comment has been minimized.

@TomFischer

TomFischer Jan 30, 2019

Member

Suggestion:
It is tThe curve stands for the variation of heat load on the BHE.

This comment has been minimized.

@ChaofanChen

ChaofanChen Jan 30, 2019

Author Member

Thanks for your comments. Fixed.

@@ -46,6 +46,7 @@ class BHE_1U final : public BHECommon
PipeConfiguration1U const& pipes);

static constexpr int number_of_unknowns = 4;
static constexpr int number_of_grout_zones = 2;

This comment has been minimized.

@TomFischer

TomFischer Jan 30, 2019

Member

This PR implements coaxial BHE processes with types of CXA and CXC. Why is it necessary to add this line to the type BHE_1U?

This comment has been minimized.

@ChaofanChen

ChaofanChen Jan 30, 2019

Author Member

In the BHE model, the total heat flux through the grout is separated into two parts in 1U type because there is grout around inlet pipe and outlet pipe, respectively. Thus, the total heat flux through the grout should be the sum of these two parts. However, for coaxial BHE, there only one grout around the outer pipe. It is necessary to add this line because the heat flux through grout for different types was not considered before. The number of grout zone was just considered in the local assembler before, which wound cause double counting the total heat flux through grout for coaxial BHE.

/**
* The BHE_CXA class is the realization of Coaxial pipe with Annular type of the
* Borehole Heate Exchanger. In this class, the pipe heat capacity,
* pipe heat conductiion, pie advection vectors are intialized according to the

This comment has been minimized.

@TomFischer

TomFischer Jan 30, 2019

Member

spelling: conductiion -> conduction, pie -> pipe

This comment has been minimized.

@ChaofanChen

ChaofanChen Jan 30, 2019

Author Member

Corrected.

* geometry of CXA type of BHE. For CXA type of BHE, 3 primary unknowns are
* assigned on the 1D BHE elements. They are the temperature in inflow pipe
* T_in, temperature in outflow pipe T_out, temperature of the grout zones
* sorrounding the inflow pipe T_g. These primary varaibles are solved

This comment has been minimized.

@TomFischer

TomFischer Jan 30, 2019

Member

spelling: sorrounding -> surrounding, varaibles -> variables

This comment has been minimized.

@ChaofanChen

ChaofanChen Jan 30, 2019

Author Member

Corrected.

* sorrounding the inflow pipe T_g. These primary varaibles are solved
* according to heat convection and conduction equations on the pipes and also
* in the grout zones. The interaction of the CXA type of BHE and the
* sorrounding soil is regulated through the thermal resistance values, which

This comment has been minimized.

@TomFischer

TomFischer Jan 30, 2019

Member

spelling: sorrounding -> surrounding

This comment has been minimized.

@ChaofanChen

ChaofanChen Jan 30, 2019

Author Member

Corrected.

template <int NPoints, typename SingleUnknownMatrixType,
typename RMatrixType, typename RPiSMatrixType,
typename RSMatrixType>
void assembleRMatrices(

This comment has been minimized.

@TomFischer

TomFischer Jan 30, 2019

Member

For discussion: Can this be moved to the local assembler? Maybe after the merge of this PR.

PipeConfigurationCXA const _pipes;

public:
std::array<double, number_of_unknowns> const cross_section_areas = {

This comment has been minimized.

@TomFischer

TomFischer Jan 30, 2019

Member

I wouldn't make this implementation detail, i.e. the std::array<> cross_section_areas, public. I would write get-functions with appropriate names that increase the readability.

Update
I discussed this issue with @endJunction. We concluded that the current version is the best solution at the moment.

This comment has been minimized.

@ChaofanChen

ChaofanChen Jan 31, 2019

Author Member

Thanks, so I will not change it.

@@ -0,0 +1,151 @@
/**

This comment has been minimized.

@TomFischer

TomFischer Jan 30, 2019

Member

Parts of this class look very similar to parts of the class BHE_CXC. Maybe BHE_CXA and BHE_CXC can be derived from a common base class?

This comment has been minimized.

@ChaofanChen

ChaofanChen Jan 30, 2019

Author Member

Fixed. The similar parts were removed to a common base class.

* according to heat convection and conduction equations on the pipes and also
* in the grout zones. The interaction of the CXC type of BHE and the
* sorrounding soil is regulated through the thermal resistance values, which
* are calculated specifically during the initialization of the class.

This comment has been minimized.

@TomFischer

TomFischer Jan 30, 2019

Member

The documentation contains the same spelling mistakes as the documentation for class BHE_CXA.

This comment has been minimized.

@ChaofanChen

ChaofanChen Jan 30, 2019

Author Member

Corrected.

template <int NPoints, typename SingleUnknownMatrixType,
typename RMatrixType, typename RPiSMatrixType,
typename RSMatrixType>
void assembleRMatrices(

This comment has been minimized.

@TomFischer

TomFischer Jan 30, 2019

Member

Again for discussion: This looks like it should be in the local assembler.

std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
curves)
{
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__borehole}

This comment has been minimized.

@TomFischer

TomFischer Jan 30, 2019

Member

This implementation, the createBHECXC and the already in the master contained function createBHE1U have many parts in common. Please, either extract common parts to separate functions that can be reused or implement only one create-function and call special functions for 1U, CXA, and CXC specific parts.

This comment has been minimized.

@ChaofanChen

ChaofanChen Jan 31, 2019

Author Member

Fixed. Common parts among 1U, CXA, and CXC were extracted while reading parameters.

//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout}
auto const& grout_config = config.getConfigSubtree("grout");
const double grout_density =
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout__density}

This comment has been minimized.

@TomFischer

TomFischer Jan 30, 2019

Member

Some of the parameter documentations are missing.

This comment has been minimized.

@ChaofanChen

ChaofanChen Jan 31, 2019

Author Member

After changing way of reading parameters, no new parameter is not documented.


The numerical outflow temperature over operational time of OGS-6 was compared against OGS-5 and the analytical solution and shown in the Figure 3. And the distributed temperature of circulating water in the DBHE after operation for 3000 s was presented in the Figure 4. The comparison figures demonstrate that the numerical results and analytical results can match very well and the biggest absolute error of outflow temperature is around 1.6 $^{\circ}$C at the starting up stage, while such error will decrease to around 0.5 $^{\circ}$C after 30 days' operation. It reveals that such error will not accumulate in long term simulation. The maximum relative error regarding temperature distribution of circulating water after operation for 3000 s is around 2 \%. The soil temperature verification can be seen in the Benchmark of 3D Beier sandbox.

{{< img src="../3D_coaxial_deep_BHE_figures/outflow_temperature_over_time_long-term.png" width="200">}}

This comment has been minimized.

@TomFischer

TomFischer Jan 30, 2019

Member

The results seems to fit the analytical solution. I would suggest to plot also the difference.

## Problem description
The Deep Borehole Heat Exchanger (DBHE) is utilized to extract deep geothermal energy for building heating in recent years (Kong et al. (2017)). In the DBHE system, there are two types including the Coaxial pipe with Centred inlet (CXC) and the Coaxial pipe with Annular inlet (CXA), but the CXA type of DBHE is always installed in real projects. Using circulating water transports heat energy from subsurface. Detailed schematization of this system is shown in Figure 1. In this benchmark, the coaxial type DBHE numerical model in OGS-6 was compared with OGS-5 and analytical solution proposed by Beier et al.(2014).

{{< img src="../3D_coaxial_deep_BHE_figures/coaxial_deep_BHE.png" width="200">}}

This comment has been minimized.

@TomFischer

TomFischer Jan 30, 2019

Member

Nice picture! 🍰

@ChaofanChen ChaofanChen force-pushed the ChaofanChen:dbhe_impl branch 2 times, most recently from a9912fb to bce105a Jan 30, 2019


struct PipeWallThermalResistanceCoaxial
{
double const R_con_inner_pipe;

This comment has been minimized.

@endJunction

endJunction Jan 30, 2019

Member

what is con stands for?

This comment has been minimized.

@ChaofanChen

ChaofanChen Jan 31, 2019

Author Member

Thanks for your comments. It's the conductive thermal resistance due to the pipes wall material.

double const R_adv_o = 1.0 / (Nu_o * lambda_r * pi);
double const R_adv_a_i = 1.0 / (Nu_i * lambda_r * pi) * (d_h / d_i_o);
double const R_adv_b_i = 1.0 / (Nu_i * lambda_r * pi) * (d_h / d_o);
double const R_adv_o = advective_thermal_resistance.R_adv_inner_pipe;

This comment has been minimized.

@endJunction

endJunction Jan 30, 2019

Member

If you would choose names such that, this expression becomes

double const R_adv_o = R_advective.inner_pipe;

you wouldn't make yet another copy of the value, but simply use it below.

This comment has been minimized.

@ChaofanChen

ChaofanChen Jan 31, 2019

Author Member

Rename all the heat transfer coefficients.

@ChaofanChen ChaofanChen force-pushed the ChaofanChen:dbhe_impl branch 2 times, most recently from 9cc34d2 to 4ceb57b Jan 31, 2019

@codecov

This comment has been minimized.

Copy link

codecov bot commented Feb 1, 2019

Codecov Report

Merging #2332 into master will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2332      +/-   ##
==========================================
+ Coverage   32.61%   32.62%   +0.01%     
==========================================
  Files         525      525              
  Lines       19748    19748              
  Branches     9253     9253              
==========================================
+ Hits         6440     6442       +2     
+ Misses      10023    10022       -1     
+ Partials     3285     3284       -1
Impacted Files Coverage Δ
GeoLib/Polyline.cpp 36.47% <0%> (+0.6%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ee241a9...569c910. Read the comment docs.

@@ -27,6 +28,25 @@ struct ThermoMechanicalFlowProperties
double nusselt_number;
};

struct AdvectiveThermalResistanceCoaxial
{
double Inner_pipe;

This comment has been minimized.

@endJunction

endJunction Feb 2, 2019

Member

variable names must start with lowercase letters.

This comment has been minimized.

@ChaofanChen

ChaofanChen Feb 5, 2019

Author Member

Changed.

struct GroutAndGroutSoilExchangeThermalResistanceCoaxial
{
double const conductive_b;
double const gs;

This comment has been minimized.

@endJunction

endJunction Feb 2, 2019

Member

what is gs?

This comment has been minimized.

@ChaofanChen

ChaofanChen Feb 5, 2019

Author Member

It is the thermal resistance due to grout-soil exchange. Name has been changed.


inline GroutAndGroutSoilExchangeThermalResistanceCoaxial
calculateGroutAndGroutSoilExchangeThermalResistance(
Pipe const& outer_pipe, GroutParameters const& groutPara,

This comment has been minimized.

@endJunction

endJunction Feb 2, 2019

Member

grout_parameters

This comment has been minimized.

@ChaofanChen

ChaofanChen Feb 5, 2019

Author Member

Changed.

@ChaofanChen ChaofanChen force-pushed the ChaofanChen:dbhe_impl branch 5 times, most recently from 19d20d8 to 7eecd7b Feb 5, 2019

@ChaofanChen ChaofanChen force-pushed the ChaofanChen:dbhe_impl branch from 7735be1 to 935c79c Feb 12, 2019


double outsideDiameter() const { return diameter + 2 * wall_thickness; }
double outsideDiameter(double const diameter,
double const wall_thickness) const

This comment has been minimized.

@endJunction

endJunction Feb 13, 2019

Member

Why do you need the function arguments?

This comment has been minimized.

@ChaofanChen

ChaofanChen Feb 13, 2019

Author Member

deleted.

@endJunction

This comment has been minimized.

Copy link
Member

endJunction commented Feb 13, 2019

The commit messages should reflect the changes.

@ChaofanChen ChaofanChen force-pushed the ChaofanChen:dbhe_impl branch 2 times, most recently from 7247417 to 6d3cf7d Feb 13, 2019

@HBShaoUFZ

This comment has been minimized.

Copy link
Contributor

HBShaoUFZ commented Feb 13, 2019

We have streamlined and reorganized the commits, along with their messages. The code is ready to be merged.

}

public:
std::array<double, number_of_unknowns> cross_section_areas_coaxial()

This comment has been minimized.

@endJunction

endJunction Feb 13, 2019

Member

function names must be in camelBack case.

This comment has been minimized.

@ChaofanChen

ChaofanChen Feb 13, 2019

Author Member

changed.

std::array<Eigen::Vector3d, number_of_unknowns> pipeAdvectionVectors()
const;
double cross_section_area_inner_pipe, cross_section_area_annulus,
cross_section_area_grout;

This comment has been minimized.

@endJunction

endJunction Feb 13, 2019

Member

Why not save the cross_section_areas in an std::array? Or even better, in CrossSectionAreasCoaxial struct?

tm_flow_properties_annulus.nusselt_number);

auto const cross_section_area = calculateCrossSectionAreasCoaxial(
_pipes.inner_pipe, _pipes.outer_pipe, borehole_geometry.area());

This comment has been minimized.

@endJunction

endJunction Feb 13, 2019

Member

Do the cross section areas change with the flow_rate? Probably not => no need to calculate them every time.

This comment has been minimized.

@ChaofanChen

ChaofanChen Feb 13, 2019

Author Member

It has been moved.

@ChaofanChen ChaofanChen force-pushed the ChaofanChen:dbhe_impl branch 2 times, most recently from 71359f4 to 0f053cd Feb 14, 2019

@endJunction endJunction force-pushed the ChaofanChen:dbhe_impl branch from 0f053cd to 569c910 Feb 15, 2019

@endJunction endJunction merged commit e946d4c into ufz:master Feb 16, 2019

2 of 3 checks passed

continuous-integration/jenkins/pr-merge This commit cannot be built
Details
deploy/netlify Deploy preview ready!
Details
ufz.ogs #20190215.11 succeeded
Details

@ChaofanChen ChaofanChen deleted the ChaofanChen:dbhe_impl branch Feb 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.