Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation

Example models for ThermalResponseFactors

Information

This package contains examples for the use of functions that can be found in Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

Package Content

Name Description
Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.CylindricalHeatSource CylindricalHeatSource Test case for cylindrical heat source
Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.CylindricalHeatSource_Integrand CylindricalHeatSource_Integrand Test case for cylindrical heat source integrand function
Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.FiniteLineSource FiniteLineSource Test case for finite line source
Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.FiniteLineSource_Erfint FiniteLineSource_Erfint Test case for the evaluation of the integral of the error function
Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.FiniteLineSource_Integrand FiniteLineSource_Integrand Test case for finite line source integrand function
Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.FiniteLineSource_Integrand_Length FiniteLineSource_Integrand_Length Test case for finite line source integrand function
Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.GFunction_100boreholes GFunction_100boreholes g-Function calculation for a field of 10 by 10 boreholes
Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.GFunction_1borehole_5meters GFunction_1borehole_5meters g-Function calculation for a field of 1 borehole
Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.GFunction_SmallScaleValidation GFunction_SmallScaleValidation g-Function calculation for the small scale validation case
Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.InfiniteLineSource InfiniteLineSource Test case for infinite line source
Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.ShaGFunction ShaGFunction Verifies the SHA-1 encryption of a single borehole
Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.TimeGeometric TimeGeometric Test case for geometric expansion of time vector

Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.CylindricalHeatSource Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.CylindricalHeatSource

Test case for cylindrical heat source

Information

This example demonstrates the use of the function for the evaluation of the cylindrical heat source solution.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
ThermalDiffusivityaSoi1.0e-6Ground thermal diffusivity [m2/s]
RadiusrSource0.075Radius of cylinder source [m]
Radiusr[5]{rSource,2*rSource,5*rSource...Radial position of evaluation of the solution [m]

Modelica definition

model CylindricalHeatSource "Test case for cylindrical heat source" extends Modelica.Icons.Example; parameter Modelica.Units.SI.ThermalDiffusivity aSoi=1.0e-6 "Ground thermal diffusivity"; parameter Modelica.Units.SI.Radius rSource=0.075 "Radius of cylinder source"; parameter Modelica.Units.SI.Radius[5] r={rSource,2*rSource,5*rSource,10* rSource,20*rSource} "Radial position of evaluation of the solution"; Modelica.Units.SI.Time t "Time"; Real[5] G "Cylindrical heat source solution"; equation t = exp(time) - 1.0; for k in 1:5 loop G[k] = Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.cylindricalHeatSource( t = t, aSoi = aSoi, dis = r[k], rBor = rSource); end for; end CylindricalHeatSource;

Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.CylindricalHeatSource_Integrand Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.CylindricalHeatSource_Integrand

Test case for cylindrical heat source integrand function

Information

This example demonstrates the evaluation of the cylindrical heat source integrand function.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
RealFo1.0Fourier time
Realp[4]{1,2,5,10}Ratio of distance over borehole radius

Modelica definition

model CylindricalHeatSource_Integrand "Test case for cylindrical heat source integrand function" extends Modelica.Icons.Example; parameter Real Fo = 1.0 "Fourier time"; parameter Real[4] p = {1, 2, 5, 10} "Ratio of distance over borehole radius"; Real u "Integration variable"; Real[4] y "Cylindrical heat source integrand"; equation u = time; for k in 1:4 loop y[k] = Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.cylindricalHeatSource_Integrand( u = u, Fo = Fo, p = p[k]); end for; end CylindricalHeatSource_Integrand;

Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.FiniteLineSource Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.FiniteLineSource

Test case for finite line source

Information

This example demonstrates the use of the function for the evaluation of the finite line source solution. The solution is evaluated at different positions and averaged over different lengths around line heat sources.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
ThermalDiffusivityaSoi1.0e-6Ground thermal diffusivity [m2/s]
Distancer[2]{0.075,7.0}Radial position of evaluation of the solution [m]
Heightlen112.5Length of emitting source [m]
HeightburDep129.0Buried depth of emitting source [m]
Heightlen2[7]{12.5,8.0,15.0,14.0,6.0,20.0...Length of receiving line [m]
HeightburDep2[7]{29.0,25.0,34.0,2.0,32.0,27....Buried depth of receiving line [m]

Modelica definition

model FiniteLineSource "Test case for finite line source" extends Modelica.Icons.Example; parameter Modelica.Units.SI.ThermalDiffusivity aSoi=1.0e-6 "Ground thermal diffusivity"; parameter Modelica.Units.SI.Distance[2] r={0.075,7.0} "Radial position of evaluation of the solution"; parameter Modelica.Units.SI.Height len1=12.5 "Length of emitting source"; parameter Modelica.Units.SI.Height burDep1=29.0 "Buried depth of emitting source"; parameter Modelica.Units.SI.Height[7] len2={12.5,8.0,15.0,14.0,6.0,20.0,3.0} "Length of receiving line"; parameter Modelica.Units.SI.Height[7] burDep2={29.0,25.0,34.0,2.0,32.0,27.0, 44.0} "Buried depth of receiving line"; Modelica.Units.SI.Time t "Time"; Real[2,7] hRea "Finite line source solution (Real part)"; Real[2,7] hMir "Finite line source solution (Mirror part)"; Real[2,7] h "Finite line source solution"; equation t = exp(time) - 1.0; for i in 1:2 loop for j in 1:7 loop hRea[i,j] = Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.finiteLineSource( t = t, aSoi = aSoi, dis = r[i], len1 = len1, burDep1 = burDep1, len2 = len2[j], burDep2 = burDep2[j], includeMirrorSource=false); hMir[i,j] = Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.finiteLineSource( t = t, aSoi = aSoi, dis = r[i], len1 = len1, burDep1 = burDep1, len2 = len2[j], burDep2 = burDep2[j], includeRealSource=false); h[i,j] = Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.finiteLineSource( t = t, aSoi = aSoi, dis = r[i], len1 = len1, burDep1 = burDep1, len2 = len2[j], burDep2 = burDep2[j]); end for; end for; end FiniteLineSource;

Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.FiniteLineSource_Erfint Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.FiniteLineSource_Erfint

Test case for the evaluation of the integral of the error function

Information

This example demonstrates the evaluation of the integral of the error function.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model FiniteLineSource_Erfint "Test case for the evaluation of the integral of the error function" extends Modelica.Icons.Example; Real u "Independent variable"; Real erfint "Integral of the error function"; Real erfint_num "Numerical integral of the error function"; Real err "Difference between analytical and numerical evaluations"; initial equation erfint_num=0.0; equation u = time; erfint = Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.finiteLineSource_Erfint(u=u); der(erfint_num) = Modelica.Math.Special.erf(u); err = erfint - erfint_num; end FiniteLineSource_Erfint;

Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.FiniteLineSource_Integrand Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.FiniteLineSource_Integrand

Test case for finite line source integrand function

Information

This example demonstrates the evaluation of the finite line source integrand function.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Distancedis0.075Radial distance between borehole axes [m]
Heightlen1150.0Length of emitting borehole [m]
HeightburDep14.0Buried depth of emitting borehole [m]
Heightlen2150.0Length of receiving borehole [m]
HeightburDep24.0Buried depth of receiving borehole [m]

Modelica definition

model FiniteLineSource_Integrand "Test case for finite line source integrand function" extends Modelica.Icons.Example; parameter Modelica.Units.SI.Distance dis=0.075 "Radial distance between borehole axes"; parameter Modelica.Units.SI.Height len1=150.0 "Length of emitting borehole"; parameter Modelica.Units.SI.Height burDep1=4.0 "Buried depth of emitting borehole"; parameter Modelica.Units.SI.Height len2=150.0 "Length of receiving borehole"; parameter Modelica.Units.SI.Height burDep2=4.0 "Buried depth of receiving borehole"; Real u "Integration variable"; Real y "Finite line source integrand"; equation u = time; y = Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.finiteLineSource_Integrand( u=u, dis=dis, len1=len1, burDep1=burDep1, len2=len2, burDep2=burDep2); end FiniteLineSource_Integrand;

Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.FiniteLineSource_Integrand_Length Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.FiniteLineSource_Integrand_Length

Test case for finite line source integrand function

Information

This example demonstrates the evaluation of the finite line source integrand function.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Realdis_over_len0.0005Radial distance between borehole axes
Heightlen150150.0Length of emitting borehole [m]
Heightlen7575.0Length of emitting borehole [m]
Heightlen2525.0Length of emitting borehole [m]
Heightlen55.0Length of emitting borehole [m]
Heightlen11.0Length of emitting borehole [m]
HeightburDep4.Buried depth of emitting borehole [m]

Modelica definition

model FiniteLineSource_Integrand_Length "Test case for finite line source integrand function" extends Modelica.Icons.Example; parameter Real dis_over_len = 0.0005 "Radial distance between borehole axes"; parameter Modelica.Units.SI.Height len150=150.0 "Length of emitting borehole"; parameter Modelica.Units.SI.Height len75=75.0 "Length of emitting borehole"; parameter Modelica.Units.SI.Height len25=25.0 "Length of emitting borehole"; parameter Modelica.Units.SI.Height len5=5.0 "Length of emitting borehole"; parameter Modelica.Units.SI.Height len1=1.0 "Length of emitting borehole"; parameter Modelica.Units.SI.Height burDep=4. "Buried depth of emitting borehole"; Real u "Integration variable"; Real logy150 "Logarithm of finite line source integrand"; Real logy75 "Logarithm of finite line source integrand"; Real logy25 "Logarithm of finite line source integrand"; Real logy5 "Logarithm of finite line source integrand"; Real logy1 "Logarithm of finite line source integrand"; equation u = time; logy150 = log10(max(Modelica.Constants.small, Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.finiteLineSource_Integrand( u=u, dis=dis_over_len*len150, len1=len150, burDep1=burDep, len2=len150, burDep2=burDep))); logy75 = log10(max(Modelica.Constants.small, Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.finiteLineSource_Integrand( u=u, dis=dis_over_len*len75, len1=len75, burDep1=burDep, len2=len75, burDep2=burDep))); logy25 = log10(max(Modelica.Constants.small, Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.finiteLineSource_Integrand( u=u, dis=dis_over_len*len25, len1=len25, burDep1=burDep, len2=len25, burDep2=burDep))); logy5 = log10(max(Modelica.Constants.small, Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.finiteLineSource_Integrand( u=u, dis=dis_over_len*len5, len1=len5, burDep1=burDep, len2=len5, burDep2=burDep))); logy1 = log10(max(Modelica.Constants.small, Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.finiteLineSource_Integrand( u=u, dis=dis_over_len*len1, len1=len1, burDep1=burDep, len2=len1, burDep2=burDep))); end FiniteLineSource_Integrand_Length;

Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.GFunction_100boreholes Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.GFunction_100boreholes

g-Function calculation for a field of 10 by 10 boreholes

Information

This example checks the implementation of functions that evaluate the g-function of a borefield of 100 boreholes in a 10 by 10 configuration.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
IntegernBor100Number of boreholes
PositioncooBor[nBor, 2]{{7.5*mod(i - 1, 10),7.5*flo...Coordinates of boreholes [m]
HeighthBor150Borehole length [m]
HeightdBor4Borehole buried depth [m]
RadiusrBor0.075Borehole radius [m]
ThermalDiffusivityaSoi1e-6Ground thermal diffusivity used in g-function evaluation [m2/s]
IntegernSeg12Number of line source segments per borehole
IntegernTimSho26Number of time steps in short time region
IntegernTimLon50Number of time steps in long time region
RealttsMaxexp(5)Maximum non-dimensional time for g-function calculation
TimetshBor^2/(9*aSoi)Bore field characteristic time [s]

Modelica definition

model GFunction_100boreholes "g-Function calculation for a field of 10 by 10 boreholes" extends Modelica.Icons.Example; parameter Integer nBor = 100 "Number of boreholes"; parameter Modelica.Units.SI.Position cooBor[nBor,2]={{7.5*mod(i - 1, 10),7.5* floor((i - 1)/10)} for i in 1:nBor} "Coordinates of boreholes"; parameter Modelica.Units.SI.Height hBor=150 "Borehole length"; parameter Modelica.Units.SI.Height dBor=4 "Borehole buried depth"; parameter Modelica.Units.SI.Radius rBor=0.075 "Borehole radius"; parameter Modelica.Units.SI.ThermalDiffusivity aSoi=1e-6 "Ground thermal diffusivity used in g-function evaluation"; parameter Integer nSeg = 12 "Number of line source segments per borehole"; parameter Integer nTimSho = 26 "Number of time steps in short time region"; parameter Integer nTimLon = 50 "Number of time steps in long time region"; parameter Real ttsMax = exp(5) "Maximum non-dimensional time for g-function calculation"; final parameter Integer nTimTot=nTimSho+nTimLon; final parameter Real[nTimTot] gFun(each fixed=false); final parameter Real[nTimTot] lntts(each fixed=false); final parameter Modelica.Units.SI.Time[nTimTot] tGFun(each fixed=false); final parameter Real[nTimTot] dspline(each fixed=false); Real gFun_int "Interpolated value of g-function"; Real lntts_int "Non-dimensional logarithmic time for interpolation"; discrete Integer k "Current interpolation interval"; discrete Modelica.Units.SI.Time t1 "Previous value of time for interpolation"; discrete Modelica.Units.SI.Time t2 "Next value of time for interpolation"; discrete Real gFun1 "Previous g-function value for interpolation"; discrete Real gFun2 "Next g-function value for interpolation"; parameter Modelica.Units.SI.Time ts=hBor^2/(9*aSoi) "Bore field characteristic time"; initial equation // Evaluate g-function for the specified bore field configuration (tGFun,gFun) = Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.gFunction( nBor = nBor, cooBor = cooBor, hBor = hBor, dBor = dBor, rBor = rBor, aSoi = aSoi, nSeg = nSeg, nTimSho = nTimSho, nTimLon = nTimLon, ttsMax = ttsMax); lntts = log(tGFun/ts .+ Modelica.Constants.small); // Initialize parameters for interpolation dspline = Buildings.Utilities.Math.Functions.splineDerivatives( x = tGFun, y = gFun); k = 1; t1 = tGFun[1]; t2 = tGFun[2]; gFun1 = gFun[1]; gFun2 = gFun[2]; equation // Dimensionless logarithmic time lntts_int = log(Buildings.Utilities.Math.Functions.smoothMax(time, 1e-6, 2e-6)/ts); // Interpolate g-function gFun_int = Buildings.Utilities.Math.Functions.cubicHermiteLinearExtrapolation( x = time, x1 = t1, x2 = t2, y1 = gFun1, y2 = gFun2, y1d = dspline[pre(k)], y2d = dspline[pre(k)+1]); // Update interpolation parameters, when needed when time >= pre(t2) then k = min(pre(k) + 1, nTimTot); t1 = tGFun[k]; t2 = tGFun[k+1]; gFun1 = gFun[k]; gFun2 = gFun[k+1]; end when; end GFunction_100boreholes;

Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.GFunction_1borehole_5meters Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.GFunction_1borehole_5meters

g-Function calculation for a field of 1 borehole

Information

This example checks the implementation of functions that evaluate the g-function of a borefield of 100 boreholes in a 1 configuration.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
IntegernBor1Number of boreholes
PositioncooBor[nBor, 2]{{5.*mod(i - 1, 3),5.*floor(...Coordinates of boreholes [m]
HeighthBor5Borehole length [m]
HeightdBor1Borehole buried depth [m]
RadiusrBor0.075Borehole radius [m]
ThermalDiffusivityaSoi1e-6Ground thermal diffusivity used in g-function evaluation [m2/s]
IntegernSeg12Number of line source segments per borehole
IntegernTimSho26Number of time steps in short time region
IntegernTimLon50Number of time steps in long time region
RealttsMaxexp(5)Maximum non-dimensional time for g-function calculation
TimetshBor^2/(9*aSoi)Bore field characteristic time [s]

Modelica definition

model GFunction_1borehole_5meters "g-Function calculation for a field of 1 borehole" extends Modelica.Icons.Example; parameter Integer nBor = 1 "Number of boreholes"; parameter Modelica.Units.SI.Position cooBor[nBor,2]={{5.*mod(i - 1, 3),5.* floor((i - 1)/3)} for i in 1:nBor} "Coordinates of boreholes"; parameter Modelica.Units.SI.Height hBor=5 "Borehole length"; parameter Modelica.Units.SI.Height dBor=1 "Borehole buried depth"; parameter Modelica.Units.SI.Radius rBor=0.075 "Borehole radius"; parameter Modelica.Units.SI.ThermalDiffusivity aSoi=1e-6 "Ground thermal diffusivity used in g-function evaluation"; parameter Integer nSeg = 12 "Number of line source segments per borehole"; parameter Integer nTimSho = 26 "Number of time steps in short time region"; parameter Integer nTimLon = 50 "Number of time steps in long time region"; parameter Real ttsMax = exp(5) "Maximum non-dimensional time for g-function calculation"; final parameter Integer nTimTot=nTimSho+nTimLon; final parameter Real[nTimTot] gFun(each fixed=false); final parameter Real[nTimTot] lntts(each fixed=false); final parameter Modelica.Units.SI.Time[nTimTot] tGFun(each fixed=false); final parameter Real[nTimTot] dspline(each fixed=false); Real gFun_int "Interpolated value of g-function"; Real lntts_int "Non-dimensional logarithmic time for interpolation"; discrete Integer k "Current interpolation interval"; discrete Modelica.Units.SI.Time t1 "Previous value of time for interpolation"; discrete Modelica.Units.SI.Time t2 "Next value of time for interpolation"; discrete Real gFun1 "Previous g-function value for interpolation"; discrete Real gFun2 "Next g-function value for interpolation"; parameter Modelica.Units.SI.Time ts=hBor^2/(9*aSoi) "Bore field characteristic time"; initial equation // Evaluate g-function for the specified bore field configuration (tGFun,gFun) = Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.gFunction( nBor = nBor, cooBor = cooBor, hBor = hBor, dBor = dBor, rBor = rBor, aSoi = aSoi, nSeg = nSeg, nTimSho = nTimSho, nTimLon = nTimLon, ttsMax = ttsMax); lntts = log(tGFun/ts .+ Modelica.Constants.small); // Initialize parameters for interpolation dspline = Buildings.Utilities.Math.Functions.splineDerivatives( x = tGFun, y = gFun); k = 1; t1 = tGFun[1]; t2 = tGFun[2]; gFun1 = gFun[1]; gFun2 = gFun[2]; equation // Dimensionless logarithmic time lntts_int = log(Buildings.Utilities.Math.Functions.smoothMax(time, 1e-6, 2e-6)/ts); // Interpolate g-function gFun_int = Buildings.Utilities.Math.Functions.cubicHermiteLinearExtrapolation( x = time, x1 = t1, x2 = t2, y1 = gFun1, y2 = gFun2, y1d = dspline[pre(k)], y2d = dspline[pre(k)+1]); // Update interpolation parameters, when needed when time >= pre(t2) then k = min(pre(k) + 1, nTimTot); t1 = tGFun[k]; t2 = tGFun[k+1]; gFun1 = gFun[k]; gFun2 = gFun[k+1]; end when; end GFunction_1borehole_5meters;

Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.GFunction_SmallScaleValidation Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.GFunction_SmallScaleValidation

g-Function calculation for the small scale validation case

Information

This example checks the implementation of functions that evaluate the g-function of the borehole used in the small-scale experiment of Cimmino and Bernier (2015).

References

Cimmino, M. and Bernier, M. 2015. Experimental determination of the g-functions of a small-scale geothermal borehole. Geothermics 56: 60-71.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
SmallScale_BorefieldborFieDat Record of borehole configuration data
IntegernBorborFieDat.conDat.nBorNumber of boreholes
PositioncooBor[nBor, 2]borFieDat.conDat.cooBorCoordinates of boreholes [m]
HeighthBorborFieDat.conDat.hBorBorehole length [m]
HeightdBorborFieDat.conDat.dBorBorehole buried depth [m]
RadiusrBorborFieDat.conDat.rBorBorehole radius [m]
ThermalDiffusivityaSoiborFieDat.soiDat.kSoi/(borFi...Ground thermal diffusivity used in g-function evaluation [m2/s]
IntegernSeg12Number of line source segments per borehole
IntegernTimSho26Number of time steps in short time region
IntegernTimLon50Number of time steps in long time region
RealttsMaxexp(5)Maximum non-dimensional time for g-function calculation
TimetshBor^2/(9*aSoi)Bore field characteristic time [s]

Modelica definition

model GFunction_SmallScaleValidation "g-Function calculation for the small scale validation case" extends Modelica.Icons.Example; parameter Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.Validation.BaseClasses.SmallScale_Borefield borFieDat "Record of borehole configuration data"; parameter Integer nBor = borFieDat.conDat.nBor "Number of boreholes"; parameter Modelica.Units.SI.Position cooBor[nBor,2]=borFieDat.conDat.cooBor "Coordinates of boreholes"; parameter Modelica.Units.SI.Height hBor=borFieDat.conDat.hBor "Borehole length"; parameter Modelica.Units.SI.Height dBor=borFieDat.conDat.dBor "Borehole buried depth"; parameter Modelica.Units.SI.Radius rBor=borFieDat.conDat.rBor "Borehole radius"; parameter Modelica.Units.SI.ThermalDiffusivity aSoi=borFieDat.soiDat.kSoi/( borFieDat.soiDat.dSoi*borFieDat.soiDat.cSoi) "Ground thermal diffusivity used in g-function evaluation"; parameter Integer nSeg = 12 "Number of line source segments per borehole"; parameter Integer nTimSho = 26 "Number of time steps in short time region"; parameter Integer nTimLon = 50 "Number of time steps in long time region"; parameter Real ttsMax = exp(5) "Maximum non-dimensional time for g-function calculation"; final parameter Integer nTimTot=nTimSho+nTimLon; final parameter Real[nTimTot] gFun(each fixed=false); final parameter Real[nTimTot] lntts(each fixed=false); final parameter Modelica.Units.SI.Time[nTimTot] tGFun(each fixed=false); final parameter Real[nTimTot] dspline(each fixed=false); Real gFun_int "Interpolated value of g-function"; Real lntts_int "Non-dimensional logarithmic time for interpolation"; discrete Integer k "Current interpolation interval"; discrete Modelica.Units.SI.Time t1 "Previous value of time for interpolation"; discrete Modelica.Units.SI.Time t2 "Next value of time for interpolation"; discrete Real gFun1 "Previous g-function value for interpolation"; discrete Real gFun2 "Next g-function value for interpolation"; parameter Modelica.Units.SI.Time ts=hBor^2/(9*aSoi) "Bore field characteristic time"; initial equation // Evaluate g-function for the specified bore field configuration (tGFun,gFun) = Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.gFunction( nBor = nBor, cooBor = cooBor, hBor = hBor, dBor = dBor, rBor = rBor, aSoi = aSoi, nSeg = nSeg, nTimSho = nTimSho, nTimLon = nTimLon, ttsMax = ttsMax); lntts = log(tGFun/ts .+ Modelica.Constants.small); // Initialize parameters for interpolation dspline = Buildings.Utilities.Math.Functions.splineDerivatives( x = tGFun, y = gFun); k = 1; t1 = tGFun[1]; t2 = tGFun[2]; gFun1 = gFun[1]; gFun2 = gFun[2]; equation // Dimensionless logarithmic time lntts_int = log(Buildings.Utilities.Math.Functions.smoothMax(time, 1e-6, 2e-6)/ts); // Interpolate g-function gFun_int = Buildings.Utilities.Math.Functions.cubicHermiteLinearExtrapolation( x = time, x1 = t1, x2 = t2, y1 = gFun1, y2 = gFun2, y1d = dspline[pre(k)], y2d = dspline[pre(k)+1]); // Update interpolation parameters, when needed when time >= pre(t2) then k = min(pre(k) + 1, nTimTot); t1 = tGFun[k]; t2 = tGFun[k+1]; gFun1 = gFun[k]; gFun2 = gFun[k+1]; end when; end GFunction_SmallScaleValidation;

Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.InfiniteLineSource Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.InfiniteLineSource

Test case for infinite line source

Information

This example demonstrates the use of the function for the evaluation of the infinite line source solution.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
ThermalDiffusivityaSoi1.0e-6Ground thermal diffusivity [m2/s]
RadiusrSource0.075Minimum radius [m]
Radiusr[5]{rSource,2*rSource,5*rSource...Radial position of evaluation of the solution [m]

Modelica definition

model InfiniteLineSource "Test case for infinite line source" extends Modelica.Icons.Example; parameter Modelica.Units.SI.ThermalDiffusivity aSoi=1.0e-6 "Ground thermal diffusivity"; parameter Modelica.Units.SI.Radius rSource=0.075 "Minimum radius"; parameter Modelica.Units.SI.Radius[5] r={rSource,2*rSource,5*rSource,10* rSource,20*rSource} "Radial position of evaluation of the solution"; Modelica.Units.SI.Time t "Time"; Real[5] E "Infinite line source solution"; equation t = exp(time) - 1.0; for k in 1:5 loop E[k] = Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.infiniteLineSource(t, aSoi, r[k]); end for; end InfiniteLineSource;

Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.ShaGFunction Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.ShaGFunction

Verifies the SHA-1 encryption of a single borehole

Information

This example uses a typical single borehole to test the SHA1-encryption of the arguments required to determine the borehole's thermal response factor.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
StringstrInBuildings.Fluid.Geothermal.B...SHA1-encrypted g-function inputs
StringstrEx"f1213b0067741511110ed55c968...Expected string output

Modelica definition

model ShaGFunction "Verifies the SHA-1 encryption of a single borehole" extends Modelica.Icons.Example; //Input parameter String strIn= Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.shaGFunction( 1, {{0,0}}, 150, 4, 0.075, 1e-6, 12, 26, 50, exp(5)) "SHA1-encrypted g-function inputs"; //Expected output (SHA1-encryption of (1,{{0,0}},150,4,0.075,1e-6,12,26,50,exp(5))) parameter String strEx= "f1213b0067741511110ed55c9689cd740f9d42ae" "Expected string output"; //Comparison result Boolean cmp "Comparison result"; equation cmp = Modelica.Utilities.Strings.isEqual(strIn,strEx,false); end ShaGFunction;

Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.TimeGeometric Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.TimeGeometric

Test case for geometric expansion of time vector

Information

This example demonstrates the construction of vector of geometrically expanding time values.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Durationdt2.0Minimum time step [s]
Timet_max20.0Maximum value of time [s]
IntegernTim5Number of time values

Modelica definition

model TimeGeometric "Test case for geometric expansion of time vector" extends Modelica.Icons.Example; parameter Modelica.Units.SI.Duration dt=2.0 "Minimum time step"; parameter Modelica.Units.SI.Time t_max=20.0 "Maximum value of time"; parameter Integer nTim = 5 "Number of time values"; final parameter Modelica.Units.SI.Time[nTim] t(each fixed=false) "Time vector"; initial equation t = Buildings.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.timeGeometric( dt=dt, t_max=t_max, nTim=nTim); end TimeGeometric;