跳转至

13 - 能量平衡与叶温求解

混合 Mesh、TurbidBoundary 与动态地形使用同一个三后端原生联合能量平衡。 固定叶片使用 stomatal_resistance(s/m);配置 Farquhar 的叶片联合求解 叶温、An 与 Ball--Berry gs。非收敛抛出 ConvergenceError,不发布部分状态。

热红外模拟需要地物温度。温度既可以由用户直接指定,也可以由能量平衡根据 光照、空气温度、湿度和风速求解。本章介绍第二种方法。

能量平衡计算什么

对参与求解的叶片或地表,LESS 求解:

\[ R_n = H + LE + G \]

其中:

  • \(R_n\) 是净辐射,包括短波吸收、长波吸收和自身长波发射;
  • \(H\) 是显热通量;
  • \(LE\) 是潜热通量;
  • \(G\) 是地表热通量。叶片通常取 0。

求解结果不只是一个温度数组。它还包含每个面片或统计介质 component 的 R_nHLEG 和闭合残差。

所需属性

参与能量平衡的 component 需要光学、热学和生物物理属性:

leaves.set_property(
    "leaf",
    less.Fluspect(
        N=1.5, cab=45, car=10, cw=0.012, cm=0.006,
        fqe=0.012,
    ),
)
leaves.set_property(
    "leaf",
    less.ThermalProperty(
        temperature="air",
        emissivity=0.98,
    ),
)
leaves.set_property(
    "leaf",
    less.BiophysicalProperty(
        leaf_width=0.05,
        stomata_side="bottom",
        stomatal_resistance=150.0,
    ),
)

ThermalProperty.temperature 有两种常用写法:

  • "air":以当前空气温度作为初始温度;
  • Kelvin 数值,例如 298.15:以指定温度作为初始值。

尚未运行能量平衡时,这也是热红外模拟使用的固定温度。能量平衡收敛后, 热红外模拟自动使用求解后的当前状态。

设置微气候

microclimate = less.Microclimate(
    air_temperature=25.0,  # 摄氏度
    humidity=60.0,         # 相对湿度,百分数
    wind_speed=2.0,        # m/s
    pressure=101325.0,     # Pa
    ca=400.0,              # CO2,ppm
)

注意:air_temperature 使用摄氏度,humidity 使用 0–100 的百分数。

推荐流程:求解后直接成像

state = scene.solve(
    microclimate=microclimate,
    modules=["energy_balance"],
)

print(state.energy_balance.result.summary())

thermal = scene.simulate(
    less.ThermalImager(
        less.Orthographic(image_size=512),
        bands=[10600.0],
        quality=128,
    )
)
thermal.save("leaf_temperature.tif")

ThermalImager 默认读取场景当前的能量平衡状态,因此不需要把 state.energy_balance 再传给成像器。

检查能量闭合

eb = state.energy_balance.result
active = eb.active_mask

residual = eb.residual[active]
print("最大闭合残差:", abs(residual).max(), "W/m2")
print("平均闭合残差:", abs(residual).mean(), "W/m2")
print("迭代次数:", eb.n_iterations)
print("是否收敛:", eb.converged)

发布级计算不应只检查 converged。还应同时检查温度范围和 R_n - H - LE - G 残差。

Mesh 与 TurbidBoundary

两种几何表示使用相同的用户流程:

  • Mesh 结果按三角面片保存;
  • TurbidBoundary 的场景按放置后的 component 保存;
  • 统计介质内部会分别计算条件阳叶和阴叶温度,再按叶面积比例汇总;
  • 三种后端均支持能量平衡。
eb = state.energy_balance
print(eb.spatial_mode)  # "primitive" 或 "component"

状态何时失效

修改以下输入后,旧的求解状态会自动失效:

  • 光照;
  • 微气候;
  • component 属性;
  • 场景几何或实例。

此时重新调用 scene.solve(...)。如果显式把旧结果传给成像器,LESS 会报告 状态已过期,而不会继续生成可能错误的图像。

下一步

相关 API

  • less.EnergyBalanceProcessless.RadiationFieldProcess
  • less.Microclimateless.BiophysicalProperty
  • less.ThermalPropertyless.Farquhar
  • less.ThermalImagerless.EnergyBalanceProduct