TNO Intern

Resolve "fix bug qzb"

Closes #16 (closed)

Merge request reports

Loading
+4 −4
Changes for docs/manual/simulation_configuration.md: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ The main input JSON file includes the following parameters:
| optimize_keys_bounds | Bounds for optimized parameters                                        | —       | nested_list    | `[[lower, upper]]` matching optimize_keys                                                                                                                                                         |
| loadprofile          | Path to configuration file of the heat load profile                    | —       | string         | Optional                                                                                                                                                                                          |
| flow_data            | Path to configuration file of the flow rate profile                    | -       | string         | Optional                                                                                                                                                                                          |
| Q                    | Power demand                                                           | W       | scalar         | Used if `run_type` is POWER and no `loadprofile` defined                                                                                                                                          |
| Q                    | Power demand                                                           | W       | scalar         | Used if `run_type` is POWER and no `loadprofile` defined; positive for heat production, negative for cold production                                                                              |
| Tin                  | Inlet temperature                                                      | °C      | scalar         | Used if `run_type` is TIN                                                                                                                                                                         |
| variables_config     | Path to stochastic simulation configuration file                       | —       | string         | Used for stochastic runs (RunMain module)                                                                                                                                                         |
| save_Tfield_res      | Flag to save results of 3D temperature field in a numarical simulation | —       | boolean        | Only used if model_type is FINVOL                                                                                                                                                                 |
@@ -272,7 +272,7 @@ of the parameters in the *results* subset is always the number of
samples.

| Parameter | Description                                           | Unit  | Dimensions         | Remark                                                            |
|-----------|-------------------------------------------------------|-------|--------------------|---------------------------------------------|
|-----------|-------------------------------------------------------|-------|--------------------|-------------------------------------------------------------------|
| Q_b       | Heat load                                             | W     | time               | Only calculated for run_type TIN                                  |
| Re_in     | Reynolds nr. in the inlet pipe(s)                     |       | time               |                                                                   |
| Re_out    | Reynolds nr. in the outlet pipe(s)                    |       | time               |                                                                   |
@@ -288,8 +288,8 @@ samples.
| k_g       | Grout thermal conductivity                            | W/mK  | time or time; zseg |                                                                   |
| k_s       | Subsurface thermal conductivity                       | W/mK  | time or time; zseg |                                                                   |
| qloop     | Consumed power by the fluid circulation pump          | W     | time               |                                                                   |
| qsign     | Sign of heat flow                                     |       | time               | Sign indicates heat extraction or injection |
| qzb       | Subsurface heat flow                                  | W/m   | time; zseg         |                                             |
| qsign     | Sign of heat flow                                     |       | time               | Sign indicates heat extraction (positive) or injection (negative) |
| qzb       | Subsurface heat flow                                  | W     | time; zseg         |                                                                   |
| nPipes    | Number of pipes                                       |       |                    | Coördinates for the nPipes dimension                              |
| time      | Simulation timesteps                                  | hours |                    | Coördinates for the time dimension                                |
| z         | Depth for top and bottom of simulation depth segments | m     |                    | Coördinates for the depth dimension                               |
+3 −3
Changes for src/geoloop/bin/SingleRunSim.py: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -221,7 +221,7 @@ class SingleRunResult:
        flowrate : np.ndarray
            Mass flow rate over time [kg/s].
        qsign : np.ndarray
            Sign of power production (-1 = extraction, +1 = injection).
            Sign of power production (1 = heat extraction, -1 = heat injection).
        T_fi : np.ndarray
            Inlet fluid temperature over time [°C].
        T_fo : np.ndarray
@@ -243,7 +243,7 @@ class SingleRunResult:
            Fluid temperature as function of time, depth and pipe index [°C].
            Shape: (n_time, n_depth_nodes, nPipes)
        qzb : np.ndarray
            Distributed heat flux at borehole wall [W/m].
            Distributed heat flux at borehole wall [W].
            Shape: (n_time, n_depth_segments)
        Re_in : np.ndarray
            Reynolds number in inlet pipes over time [-].
@@ -566,7 +566,7 @@ class SingleRun:
            - T_f : ndarray of shape (nt, npipes, nz)
                Fluid temperature in pipes [°C].
            - qzb : ndarray of shape (nt, nseg)
                Heat flux along the borehole wall [W/m].
                Heat flux along the borehole wall [W].
            - k_s : ndarray of shape (nseg,)
                Soil conductivity interpolated over segments.
            - k_g : ndarray of shape (nseg,)
+1 −1
Changes for src/geoloop/geoloopcore/b2g.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ class B2G:
        T_f : ndarray
            Pipe fluid temperature field [°C].
        qzb : ndarray
            Vertical heat flux along borehole [W/m].
            Vertical heat flux along borehole [W].
        h_fpipes : ndarray
            Convective film coefficients for each pipe.
        result : ndarray
+2 −2
Changes for src/geoloop/geoloopcore/b2g_ana.py: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -264,7 +264,7 @@ class B2G_ana:
                    T_ftimes[i] = T_f  # stored index time, depth, pipe
                    T_b[i] = Tb
                    qbzseg[i] = qbz
                    qsign[i] = np.sign(max(qbz) * min(qbz))
                    qsign[i] = np.sign(np.sum(qbz))
                    imax = i

        hours = time / 3600.0
@@ -494,7 +494,7 @@ class B2G_ana:
                    T_b[i] = Tb
                    # qbz is calculated at the depth division in segments (zseg)
                    qbzseg[i] = qbz
                    qsign[i] = np.sign(max(qbz) * min(qbz))
                    qsign[i] = np.sign(np.sum(qbz))
                    imax = i

        hours = time / 3600.0
+9 −2
Changes for src/geoloop/plotting/create_plots.py: 9 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -616,7 +616,7 @@ class PlotResults:

                dz = zp[1] - zp[0]
                if model_type in ["ANALYTICAL"]:
                    qbzm = qzb / dz
                    qbzm = qzb / abs(dz)
                    ax2.plot(
                        qbzm,
                        zseg,
@@ -624,7 +624,7 @@ class PlotResults:
                        color=next(color_iter_ax2),
                    )
                elif model_type in ["FINVOL"]:
                    qbzm = qzb / dz
                    qbzm = qzb / abs(dz)
                    qbzm[0] *= 2
                    qbzm[-1] *= 2
                    ax2.plot(
@@ -639,6 +639,9 @@ class PlotResults:
                    q_plot = qbzm * np.ones(len(zp))
                    # because of UBWT condition the heat flow is not linear
                    # ax2.plot(q_plot, zp, label=f'{file_name}: Heat Flow', color=next(color_iter_ax2))
                    # remove label of x-axis
                    ax2.set_xlabel("")
                    ax2.set_xticklabels("")
                else:
                    print(f"Unrecognized model type: {model_type}")

@@ -685,6 +688,10 @@ class PlotResults:
            # combine the legends from the second plot primary and secondary axis
            handles2, labels2 = ax2.get_legend_handles_labels()
            handles3, labels3 = ax2twin.get_legend_handles_labels()
            if model_type in ["PYG", "PYGFIELD"]:
                all_handles = handles2
                all_labels = labels2
            else:
                all_handles = handles2 + handles3
                all_labels = labels2 + labels3
            # Create a single combined legend and define legend location
Loading
Loading