functionGridGenerator_SizeOnly

Compute N_r_actual from physical parameters and characteristic spacing. This pure function enables compile-time sizing of geometry arrays. Uses same bisection logic as GridGenerator (steps 0-1b) but returns only N_r_actual. For discretization and cell sizing, use GridGenerator function.

Extends from TransiEnt.Basics.Icons.Function.

Information

1. Purpose of function

Pure function that computes the number of radial control volumes (N_r_actual) from physical aquifer parameters and desired characteristic grid spacing. This function is designed for compile-time evaluation and enables dynamic sizing of geometry arrays in the Geometry model. It implements the same bisection algorithm as GridGenerator (steps 0-1b) but returns only the number of control volumes, not the full discretization.

2. Level of detail, physical effects considered, and physical insight

Purely mathematical component. Implements steps 0 and 1 of the GridGenerator algorithm:

  • Step 0: Computation of thermal radius R_th from injected volume and heat capacities (characteristic length scale)
  • Step 1a: Heuristic initial estimate of number of cells
  • Step 1b: Bisection refinement to match first cell width to target dx_min

3. Limits of validity

- N_r is clamped to [5, 500]. If computed N_r exceeds 500, result is 500 (undersampling).

- Function assumes positive volumetric heat capacities and aquifer dimensions.

- Thermal radius R_th must be positive for meaningful result.

- Bisection convergence tolerance is 1% of dx_min; result may differ slightly from exact match.

4. Interfaces

Inputs:

c_f — volumetric heat capacity of fluid [J/(m³·K)]

c_a — effective volumetric heat capacity of aquifer [J/(m³·K)]

H_a — thickness of aquifer [m]

V_inj — injected thermal energy storage volume [m³]

domain_factor — multiplicative factor for R_th to determine domain extent [-] (default 3.0)

dx_min — target width of first radial cell [m]

Output:

N_r_actual — computed number of radial control volumes (fixed after initialization), range [5, 500]

5. Nomenclature

See GridGenerator documentation for full nomenclature. Key quantities:

R_th = thermal radius [m]

R_domain = domain radius [m]

N_r_actual = number of radial control volumes [-]

dx_min = target first cell width [m]

6. Governing Equations

Same as GridGenerator steps 0-1b:

Thermal radius: R_th = sqrt( (c_f / c_a) * (V_inj / (pi * H_a)) )

Domain radius: R_domain = domain_factor * R_th

Initial estimate: N_r_temp = ceil(R_domain / dx_min)

Final: N_r_actual from bisection to match first logistic cell width to dx_min

7. Remarks for Usage

Run this function once up front to size the optimized grid. Because N_r is a structural parameter (it sets array dimensions), it cannot be computed inside the model at runtime; instead the value returned here is entered manually into the Setting record:

1. Choose dx_min and the physical parameters (V_inj, H_a, H_c, domain_factor, ...).

2. Evaluate N_r = GridGenerator_SizeOnly(c_f, c_a, H_a, H_c, V_inj, r_0, domain_factor, dx_min).

3. Enter the resulting N_r into Setting.N_r (with optimized_grid = true).

The Dymola script Resources/../AutoConfigureN_r.mos automates steps 1-2 (it prints the computed N_r) and then translates and simulates the ATES system with the new N_r.

For the full discretization and cell width generation, the GridGenerator function then uses this N_r (passed as input) and reproduces the same first cell width by identical logistic logic.

8. Validation

Tested implicitly through comparison with GridGenerator: both functions must return identical N_r for same inputs.

9. References

no remarks

10. Version History

Function created by Markus Gillner (markus.gillner@tuhh.de), May 2026

Function revised by Markus Gillner (markus.gillner@tuhh.de), June 2026

- Filled in author placeholder and clarified the manual N_r workflow (Setting record / AutoConfigureN_r.mos).

Inputs

TypeNameDefaultDescription
Realc_fvolumetric heat capacity of fluid [J/(m³·K)]
Realc_aeffective volumetric heat capacity of aquifer [J/(m³·K)]
SI.LengthH_athickness of aquifer [m]
SI.VolumeV_injinjected thermal energy storage volume [m³]
Realdomain_factor3.0domain radius factor relative to thermal radius [-]
SI.Lengthdx_mincharacteristic radial grid width: first cell width target [m]

Outputs

TypeNameDefaultDescription
IntegerN_r_actualcomputed number of radial control volumes (5 to 500)