sup3r.utilities.loss_metrics.GeothermalConductiveHeatTransferLoss#
- class GeothermalConductiveHeatTransferLoss(dx, dy, depths=range(0, 8000, 1000), temperature_prefix='t', heat_flux_prefix='q', thermal_conductivity_prefix='k')[source]#
Bases:
Sup3rLossDeviation from three-dimensional conductive heat transfer.
This loss evaluates the conductive heat-transfer PDE residual described in [1] using predicted temperature, thermal conductivity, and surface heat flow. Temperature features are expected in C, thermal conductivity features in W/m-K, and heat-flow features in mW/m^2.
The loss requires temperature and thermal conductivity channels at each requested depth and a single surface heat-flow channel at 0 m. Expected feature names are
<temperature_prefix>_<depth>m(e.g. “t_1000m”),<thermal_conductivity_prefix>_<depth>m(e.g. “k_1000m”), andq_0m.References
Initialize the conductive heat-transfer loss
- Parameters:
dx (float) – Horizontal grid spacing along the x dimension in m.
dy (float) – Horizontal grid spacing along the y dimension in m.
depths (iterable of int, optional) – Depth levels in m used to assemble the temperature and thermal conductivity feature channels. Depths must include 0 m and be uniformly spaced so the vertical derivative can be evaluated.
temperature_prefix (str, optional) – Prefix used for temperature channels in C. Expected feature names are
<temperature_prefix>_<depth>m.heat_flux_prefix (str, optional) – Prefix used for heat-flow channels in mW/m^2. This loss requires a surface heat-flow feature only, named
<heat_flux_prefix>_0m.thermal_conductivity_prefix (str, optional) – Prefix used for thermal-conductivity channels in W/m-K. Expected feature names are
<thermal_conductivity_prefix>_<depth>m.
Methods
call(y_true, y_pred)Invokes the Loss instance.
from_config(config)Instantiates a Loss from its config (output of get_config()).
Returns the config dictionary for a Loss instance.
Attributes
LOSS_METRIC- __call__(__, x_gen)[source]#
Evaluate the conductive heat-transfer loss
- Parameters:
x_true (tf.tensor) – Ground truth data (unused).
x_gen (tf.tensor) – Synthetic generator output used to compute the conductive heat-transfer residual. The feature axis must contain temperature channels in C, thermal conductivity channels in W/m-K, and a surface heat-flow channel in mW/m^2. Shape must be either: (n_observations, spatial_1, spatial_2, features) or (n_observations, spatial_1, spatial_2, temporal, features)
- Returns:
tf.tensor – 0D tensor loss value
- abstract call(y_true, y_pred)#
Invokes the Loss instance.
- Args:
- y_true: Ground truth values. shape = [batch_size, d0, .. dN],
except sparse loss functions such as sparse categorical crossentropy where shape = [batch_size, d0, .. dN-1]
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
- Returns:
Loss values with the shape [batch_size, d0, .. dN-1].
- classmethod from_config(config)#
Instantiates a Loss from its config (output of get_config()).
- Args:
config: Output of get_config().
- Returns:
A Loss instance.
- get_config()#
Returns the config dictionary for a Loss instance.