OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
GroundHeat.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
11
12#pragma once
13#include "PorousHeat.hpp"
14#include "GroundPorewater.hpp"
15#include <cstdint>
16namespace openswmm {
18}
20class MeshSnow;
21}
22namespace openswmm::twoD {
23struct MeshData;
24struct GwTransportData;
25struct SubsurfaceTransportState;
29 std::vector<double> saturated_water;
30 // Water already accepted out of this column but not yet applied to its
31 // hydraulic moisture profile. Its sensible energy is debited at the
32 // producing face; reserve its heat capacity from intervening contacts.
33 std::vector<double> reserved_out_water;
34 double initial_j = 0, advective_j = 0, source_j = 0, surface_j = 0, deep_j = 0, latent_j = 0,
36 double vertical_absolute_j = 0, geo_flux = .065;
37 bool surface_owned = false;
38 int failed = 0;
39 std::string error;
40};
42 int node = -1, row = -1;
43 double area = 0;
44};
47 surface::MeshSnow* snow_owner = nullptr; // borrowed mesh snow state for reciprocal UEB contact
48 const GwTransportData* config = nullptr;
49 std::vector<GroundThermalCell> cells;
50 // Resolved Mesh Richards LID footprints by soil cell. Derived from the
51 // hydraulic bed bindings at initialization; energy itself lives in the
52 // persistent LidNodeState and is checkpointed with the 1D owner.
53 std::vector<std::vector<GroundLidThermalOwner>> lid_owners;
54 double top_now = 0, deep_now = 0;
55 double density = 1000, water_capacity = 4184000;
56 int top_series = -1, deep_series = -1;
63 bool active() const noexcept { return !cells.empty(); }
70 void clear() { *this = {}; }
77 double activeCapacity(int cell, std::size_t layer) const noexcept;
83 double activeTemperature(int cell, std::size_t layer) const noexcept;
91 bool snowContactEnabled(int cell) const noexcept;
99 double snowContactFraction(int cell) const noexcept;
107 bool appendSnowContact(int cell, double area, std::vector<ThermalBoundary>&) const;
118 std::string applySnowContactEnergy(int cell, double soil_j);
119 std::string initialize(SimulationContext&, const MeshData&, const SubsurfaceState&,
121 const std::vector<uint8_t>& coverage);
123 const std::vector<unsigned char>& owned);
132 void prepare();
133 // RK2 forcing reads project series without changing their shared cursors
134 // or the engine calendar. Cuts apply to the entire coupled transaction.
141 void prepareAt(double elapsed_seconds);
150 void appendRk2Cuts(double start, double end, std::vector<double>&) const;
160 void refreshView(int cell, SubsurfaceTransportState&);
168 double zoneTemperature(int cell, bool saturated) const;
169 // Append physical top/deep boundaries, returning the number of top
170 // records. Exposed fraction excludes the finite water contact footprint.
180 std::size_t boundaries(int cell, double exposed_fraction, std::vector<ThermalBoundary>&) const;
181 // Called after accepted water advection. A surface-owned column advances
182 // its conduction with its finite water contact instead, never twice.
191 std::string conduct(int cell, double seconds, bool midpoint = false);
192};
193} // namespace openswmm::twoD
Species inventories in fixed physical soil layers.
Local thermal equilibrium in porous ground layers.
Owned mixed degree-day/UEB snow on remaining mesh weather footprints. Geometry area is horizontal m2;...
Definition MeshSnow.hpp:54
Definition GroundHeat.hpp:19
Definition ExchangeLaw.hpp:60
Definition ExchangeLaw.hpp:60
Central, reentrant simulation context.
Definition SimulationContext.hpp:390
Definition GroundHeat.hpp:45
double water_capacity
Definition GroundHeat.hpp:55
bool appendSnowContact(int cell, double area, std::vector< ThermalBoundary > &) const
Append the top-layer boundary representing a reciprocal finite snow/soil contact.
Definition GroundHeat.cpp:525
double zoneTemperature(int cell, bool saturated) const
Read a water-volume-weighted physical-layer temperature for a hydraulic zone.
Definition GroundHeat.cpp:466
SimulationContext * context
Definition GroundHeat.hpp:46
bool active() const noexcept
Test whether the owner has allocated any thermal cell slots.
Definition GroundHeat.hpp:63
double top_now
Definition GroundHeat.hpp:54
std::vector< std::vector< GroundLidThermalOwner > > lid_owners
Definition GroundHeat.hpp:53
void refreshView(int cell, SubsurfaceTransportState &)
Publish canonical physical heat/porewater inventories into the derived groundwater view.
Definition GroundHeat.cpp:561
void appendRk2Cuts(double start, double end, std::vector< double > &) const
Append thermal forcing knots inside a coupled interval after validating series support.
Definition GroundHeat.cpp:426
double snowContactFraction(int cell) const noexcept
Read the active snow-contact footprint fraction.
Definition GroundHeat.cpp:510
std::string initializeStandalone(SimulationContext &, const MeshData &, const GwTransportData &, const std::vector< unsigned char > &owned)
Build fixed saturated physical soil columns for surface-owned transient storage.
Definition GroundHeat.cpp:321
double deep_now
Definition GroundHeat.hpp:54
double density
Definition GroundHeat.hpp:55
bool snowContactEnabled(int cell) const noexcept
Test reciprocal UEB snow/soil thermal contact availability.
Definition GroundHeat.cpp:505
std::size_t boundaries(int cell, double exposed_fraction, std::vector< ThermalBoundary > &) const
Append configured top/deep thermal boundaries for one physical ground column.
Definition GroundHeat.cpp:608
const GwTransportData * config
Definition GroundHeat.hpp:48
std::string initialize(SimulationContext &, const MeshData &, const SubsurfaceState &, const SubsurfaceTransportState &, const GwTransportData &, const std::vector< uint8_t > &coverage)
Build physical aquifer thermal layers and seed conserved energy from resolved moisture.
Definition GroundHeat.cpp:169
std::vector< GroundThermalCell > cells
Definition GroundHeat.hpp:49
void prepare()
Sample top and deep thermal forcing at context.current_date.
Definition GroundHeat.cpp:381
std::string applySnowContactEnergy(int cell, double soil_j)
Publish reciprocal energy to the active snow owner after a soil contact solve.
Definition GroundHeat.cpp:544
double activeCapacity(int cell, std::size_t layer) const noexcept
Remove promised outgoing water capacity from one physical thermal layer.
Definition GroundHeat.cpp:490
void prepareAt(double elapsed_seconds)
Sample top/deep thermal forcing at a coupled elapsed horizon.
Definition GroundHeat.cpp:402
int deep_series
Definition GroundHeat.hpp:56
std::string conduct(int cell, double seconds, bool midpoint=false)
Advance unowned physical-column conduction once after accepted water advection.
Definition GroundHeat.cpp:648
int top_series
Definition GroundHeat.hpp:56
double activeTemperature(int cell, std::size_t layer) const noexcept
Divide physical-layer energy by its unreserved heat capacity.
Definition GroundHeat.cpp:502
surface::MeshSnow * snow_owner
Definition GroundHeat.hpp:47
void clear()
Reset thermal cells, diagnostics, configuration and borrowed bindings to defaults.
Definition GroundHeat.hpp:70
Definition GroundHeat.hpp:41
int node
Definition GroundHeat.hpp:42
int row
Definition GroundHeat.hpp:42
double area
Definition GroundHeat.hpp:43
Definition GroundPorewater.hpp:20
Definition GroundHeat.hpp:26
int failed
Definition GroundHeat.hpp:38
double water_contact_j
Definition GroundHeat.hpp:35
double initial_j
Definition GroundHeat.hpp:34
double deep_j
Definition GroundHeat.hpp:34
GroundPorewaterColumn porewater
Definition GroundHeat.hpp:28
std::vector< double > reserved_out_water
Definition GroundHeat.hpp:33
double source_j
Definition GroundHeat.hpp:34
double latent_j
Definition GroundHeat.hpp:34
double advective_j
Definition GroundHeat.hpp:34
double geo_flux
Definition GroundHeat.hpp:36
PorousHeatColumn column
Definition GroundHeat.hpp:27
bool surface_owned
Definition GroundHeat.hpp:37
double surface_j
Definition GroundHeat.hpp:34
double lid_contact_j
Definition GroundHeat.hpp:35
double channel_contact_j
Definition GroundHeat.hpp:35
std::string error
Definition GroundHeat.hpp:39
std::vector< double > saturated_water
Definition GroundHeat.hpp:29
double vertical_absolute_j
Definition GroundHeat.hpp:36
double lateral_j
Definition GroundHeat.hpp:35
Every [GW_*] authoring row of one model.
Definition GwTransportData.hpp:187
SoA storage for 2D mixed triangle/quad mesh geometry and topology.
Definition MeshData.hpp:65
Definition PorousHeat.hpp:148
Per-cell resolved parameters and state (SoA).
Definition SubsurfaceData.hpp:219
Species mass in both aquifer zones, and where mass crossed a boundary.
Definition SubsurfaceTransportState.hpp:69