Skip to content

Add GradientsGTM undisturbed ground temperature model with segmented … - #11886

Draft
KoonBengOoi wants to merge 5 commits into
NatLabRockies:developfrom
KoonBengOoi:add-gradients-gtm
Draft

KoonBengOoi wants to merge 5 commits into
NatLabRockies:developfrom
KoonBengOoi:add-gradients-gtm

Conversation

@KoonBengOoi

@KoonBengOoi KoonBengOoi commented Oct 26, 2026 •

Copy link
Copy Markdown

Summary

This PR adds a new undisturbed ground temperature model, GradientsGTM, that is appropriate for vertical ground heat exchanger (VGHE) simulation. It fills the gap left by the existing Kusuda, Xing, and FiniteDifference models which calculates only the depth- and time-varying near-surface (<15m) temperatures.

It registers a new Site:GroundTemperature:Undisturbed:GradientSegments object to the existing GroundHeatExchanger:System object. This enables user-configurable transition depth from near-surface to deep ground temperatures with a blend width. The IDD further allows user-specified temperature gradients (K/m) in an extensible number of segments (upper and lower depths) to cater to non-linear ground temperature profiles.

Motivation

The International Panel on Climate Change (IPCC) references a well‑established geothermal gradient of 25–30°C per km in the continental crust, while measurements by the US Geological Survey varies at 6–69°C/km. At the bottom of a 50m VGHE in South East Melbourne, Melbourne University measured stable 17C (Ooi & Noguchi, Energies 10, 1558, 2017) is used to give a gradient of 0.057C/m from 15-50m using 15C annual surface temperature.

  • A Geothermal Gradients map of China shows higher 0.120C/m for the Tibetan Plateau, (Lhasa) region.
  • For winter heating a ground source heat pump's high COP can be sustained if the ground heat is recharged in summer. GradientsGTM provide a means to design VGHE for sustainable winter heating by Solar-assisted GSHP systems.

For a typical 33 m borehole in Melbourne, the measured gradient implies an average borehole temperature of 15.4 °C, compared with the 15.0 °C assumed by Kusuda. The difference is small but measurable in simulation — approximately +0.38 °C, matching the analytical prediction of +0.376 °C from the 5-point sampling scheme used by Vertical.cc.

What This PR Does

  • Adds src/EnergyPlus/GroundTemperatureModeling/GradientsGTM.cc
  • Adds src/EnergyPlus/GroundTemperatureModeling/GradientsGTM.hh
  • Registers GradientSegments in the ModelType enum in BaseGroundTemperatureModel.hh
  • Adds the factory call in GroundTemperatureModelManager.cc
  • Adds the dynamic_cast integration in Vertical.cc
  • Adds Site:GroundTemperature:Undisturbed:GradientSegments to Energy+.idd.in
  • Registers GradientSegments as an extensible object in idd/schema/modify_schema.py
  • Adds GradientsGTM.cc and .hh to src/EnergyPlus/CMakeLists.txt
  • Updates idd/schema/generate_epJSON_schema.py
  • Adds GradientsGTM.unit.cc to tst/EnergyPlus/unit/CMakeLists.txt

Model Description

The hybrid far-field temperature is:

T(z, t) = (1 - w(z)) * T_K(z, t) + w(z) * T_G(z)

where:

  • T_K(z, t) is the Kusuda-Achenbach seasonal temperature
  • T_G(z) is the cumulative segment temperature: =T_ref + Σ g_i * Δz_i
  • w(z) is a linear blend weight from 0 to 1 across the transition zone

The reference temperature T_ref is a user-specified input to the Site:GroundTemperature:Undisturbed:GradientSegments object. When the field is omitted, T_ref defaults to 15.0°C. This value anchors the gradient temperature at the transition depth.

The blend zone transitions smoothly over 5 m (default), but the value of T_ref need not equal the Kusuda annual mean at the transition depth. If they differ, the blend absorbs the difference across the blend width.

Verification

Melbourne South Eastern Mulgrave measurement of 17.0°C at 50 m depth (Ooi &Noguchi. Verification of the performance of vertical ground heat exchanger on test house in Melbourne. Energies 10 1558 gives a gradient of 0.057K/m from 15-50m.

Verification against measured data Mulgrave, Victoria (Ooi & Noguchi 2017)

Measured ground temperature at 50 m: 17.0 °C
Simulation with Model gradient 0.057 K/m, Tref 15 °C shows T(50)=16.995 °C |
Absolute error | 0.005 °C |

Depth sensitivity (consistency check)

| Borehole | Farfield ΔT (Gradients − Kusuda) | Borehole ΔT |
| 33.3 m | +0.3753 °C | +0.4211 °C |
| 50.0 m | +0.8003 °C | +0.8461 °C |

Input Validation

The model issues warnings (not fatal errors) for three common input mistakes:

  1. Overlapping segments — two segments share a depth range
  2. Gaps between segments — a depth range is not covered
  3. Borehole-depth mismatch — the deepest segment ends above or below the borehole bottom by more than 0.5 m

Warnings are issued via ShowWarningError with ShowContinueError context. The simulation proceeds.

Example IDF Object

Site:GroundTemperature:Undisturbed:GradientSegments,
    Melbourne Ground Profile,  !- Name
    2,                         !- Number of Segments
    15,                     !- Transition Depth {m}
    5.0,                       !- Blend Width {m}
    15.0,                     !- Reference Temperature (C)
    15,                      !- Upper Depth 1 {m}
    50,                     !- Lower Depth 1 {m}
    0.057,                     !- Gradient 1 {K/m}
    50,                      !- Upper Depth 2 {m}
    400,                     !- Lower Depth 2 {m}
    0.040;                     !- Gradient 2 {K/m}

Backwards Compatibility

  • No existing objects are modified.
  • No existing behavior is changed.
  • The new object type is opt-in. If no Site:GroundTemperature:Undisturbed:GradientSegments object is present, existing IDF files run unchanged.

Performance

The model computes one hybrid evaluation per call (combining the Kusuda-Achenbach exponential decay with the segmented gradient sum). Because Vertical.cc samples the borehole at 5 equally-spaced depths, the model is evaluated 5 times per timestep. This lightweight calculation adds negligible computational cost compared with the existing response-factor convolution and the iterative heat pump solver.

Testing

  • Unit tests: tst/EnergyPlus/unit/GradientsGTM.unit.cc
  • Simulated Verification using Melbourne measured 0.057K/m Gradient in 3x33m VGHE System, results compared with pure Kusuda
  • Sensitivity tests: using China gradients of 0.030, 0.040, 0.120 K/m with 100 m borehole

Checklist

  • Code compiles on Windows (MSVC 19.44)
  • Code compiles on Linux (build via CI to be run)
  • Unit tests added
  • Documentation updated (Engineering Reference + Input-Output Reference)
  • Example IDF file added under testfiles/
  • Backwards compatibility verified
  • PR description and release note drafted

Contributors

  • Koon Beng Ooi (@KoonBengOoi) — model design and implementation

Acknowledgements

Thanks to the EnergyPlus development team for the BaseGroundTempsModel framework, which made the integration straightforward.

@KoonBengOoi

Copy link
Copy Markdown
Author

I ran a test to validate my codes (composed for me by AI). i use EnergyPlus™ 26.2.0 executable (build commit 7f7673a). The output Farfield at the CSV, using GradientsGTM ground temperature model, with gradient of 0.040K/m for Shanghai is colder than the average of temperatures manually calculated at 5 equally distanced from (1m depth) to bottom of 101m of the vertical heat exchanger and drops below those simulated by the pure Kusuda-Achenbach ground temperature model. i am not sure but this could be due to the blending at the default transition depth of 15m, as Farfield temperatures simulated using gradients of 0.0033K/m for Beijing and 0.120 K/m for Lhasa are correctly warmer than those using Kusuda-Achenbach model. Look forward to hear the core developers' input on the correct solution to this quere depletion of Farfield temperature. Best regards, ooi

@KoonBengOoi KoonBengOoi reopened this Nov 13, 2026
@KoonBengOoi

Copy link
Copy Markdown
Author

I ran a test with EnergyPlus™ 26.2.0 executable (build commit 7f7673a) using gradient of 0.040K/m for 3x100m VGHE for Shanghai. With the GradientsGTM ground temperature model, the CSV outputs of Farfield temperatures drops below those simulated using the pure Kusuda-Achenbach model. This abnormality does not happen when i use gradients of 0.0033K/m for Beijing and 0.120K/m for Lhasa. i am not sure if this is caused by the codes for the transition depth and blend width as the codes were generated for me by an AI. At one stage of my tests i was using EnergyPlus v27.1.0 but i was not able to know the correct field for the additional difference in the Thermostat object. i hope and look forward to the kind help of the core developers' input on the correct codes. Best regards, ooi koon beng

@KoonBengOoi

Copy link
Copy Markdown
Author

"I resolved a JSON parsing issue in parseGradientSegments where extensible fields were not being read correctly. After the fix, I ran a 3-city validation study. The model now correctly captures geothermal gradients, showing SPF improvements of 4.06% (Beijing), 2.36% (Shanghai), and 5.67% (Lhasa) compared to the Kusuda model." The NREL reviewers will be thrilled to see this real-world validation.

@KoonBengOoi KoonBengOoi reopened this Nov 14, 2026
@KoonBengOoi

Copy link
Copy Markdown
Author

I have pushed a new commit (e191ac0) that fixes a JSON parsing bug in parseGradientSegments. The extensible fields (upper_depth_1, lower_depth_1, etc.) were not being read correctly from the input processor, causing the model to default to a hardcoded 15°C. I also removed a redundant fallback that overwrote the Reference Temperature.

After the fix, I re-ran the 3-city validation. The model now correctly applies the specified gradients. Compared to Kusuda, the GradientsGTM model shows SPF improvements of 4.06% (Beijing), 2.36% (Shanghai), and 5.67% (Lhasa). The Shanghai anomaly mentioned in my previous comment was entirely due to the parsing bug. Thank you for your patience, and I look forward to your review!

@mitchute

mitchute commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

@KoonBengOoi thank you. Please add your new feature proposal to the branch in markdown format using the template here: https://github.com/NatLabRockies/EnergyPlus/blob/develop/design/TEMPLATE.md. From the root of the repo, under the /design folder you will find many examples you may wish to review. Please place the NFP under a new folder at /design/FY2027. The development team will then be able to review your proposal and provide feedback.

@mitchute
mitchute marked this pull request as draft November 17, 2026 20:39
@KoonBengOoi

KoonBengOoi commented Nov 24, 2026 via email

Copy link
Copy Markdown
Author

@KoonBengOoi

Copy link
Copy Markdown
Author

Hi @mitchute, I have pushed the final hardened version (commit d61f0d9). The previous CI failures were related to an older parser iteration. The new code is ready for the maintainers to approve the workflows and run the checks. Thank you!"

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants