Physics-guided Neural Networks (PGNN): An Application in Lake Temperature Modeling

本文介绍了PGNN在湖泊温度建模中的应用,通过构建混合物理数据模型和使用基于物理的损失函数,确保模型的物理一致性,即使在训练数据有限的情况下也能实现更好的泛化性能。PGNN结合了湖泊温度的动力学模型,通过多层感知器进行回归,同时利用温度-密度和密度-深度的关系作为物理约束,以确保模型预测的物理合理性。

1.构建混合物理数据模型

在这里插入图片描述
如下图

2.使用基于物理的损失函数

图2
上图中描述的HPD模型的一种标准方法是在训练集上最小化其模型预测Y ^的经验损失,同时保持较低的模型复杂度,如下所示:
在这里插入图片描述
其中R衡量模型的复杂性,而λ是权衡的超参数。但是,任何此类训练程序的有效性都受到标记训练集的大小的限制,在许多科学问题中,训练集的大小通常很小。特别是,不能保证通过最小化公式2.1训练的模型将产生与我们的物理学知识相一致的结果。因此,我们引入了基于物理的损失函数,以指导数据科学模型的学习,以实现物理上一致的解决方案,如下所示。
使用以下方程式表示目标变量Y和其他物理变量Z之间的物理关系:
在这里插入图片描述
G和H是基于物理学的方程式的一般形式,可能涉及Y和Z的代数运算。测量模型预测中是否违反了这些基于物理的方程的一种方法是评估以下基于物理的损失函数:
在这里插入图片描述
其中ReLU表示整流的线性单位函数。由于Loss:PHY不需要实际观察目标变量Y,因此与传统的损失函数相比,它甚至可以在未标记的数据实例上进行评估。 PGNN涉及Loss:PHY的完整学习目标可以表示为:
在这里插入图片描述
其中λPHY是决定与经验损失和模型复杂度相比最小化物理不一致性的相对重要性的超参数。由于假定已知的物理定律对于任何看不见的数据实例同样适用,因此,即使训练数据很小且不能完全代表,确保模型输出的物理一致性作为PGNN中的学习目标也可以帮助实现更好的泛化性能。此外,领域专家还可以解释PGNN模型的输出,并将其吸收到科学工作流程中,从而促进科学进步。

3.PGNN用于湖泊温度建模

由于在广泛的空间尺度上水温的观测数据不完整(或在某些地区不存在),因此需要高质量的温度建模。特别有趣的是在给定深度d和特定时间t上对水温进行建模的问题。这个问题被称为温度的一维建模(深度是一维的)。已经开发了许多基于物理学的模型来研究湖泊温度,例如,最新的一般湖泊模型(GLM)[7]。该模型捕获了控制湖泊温度动态的各种物理过程,例如,由于来自太阳的短波辐射引起的水面加热,地表下方辐射的衰减以及层间能量变化的层的混合。不同深度,以及通过蒸发或长波辐射从湖表面散发的热量,如图3所示。我们使用GLM作为我们基于物理学的湖温模型的首选模型。
在这里插入图片描述
我们将控制每个深度和时间步长的湖泊温度动态的物理变量视为输入驱动程序D。这包括水面的气象记录,例如不同波长的太阳辐射量,风速,以及气温,深度值和一年中的某天。要构建图2中所示类型的HPD模型,我们使用来自GLM,YPHY的湖泊温度模拟以及每个深度和时间步长的输入驱动程序D来获得增强的特征集,
在这里插入图片描述
我们采用基本的多层感知器体系结构,使用X对任何给定深度和时间的温度Y进行回归。对于具有L个隐藏层的完全连接的网络,这相当于与输入特征x相关的以下建模方程,对其目标进行预测
在这里插入图片描述
其中(W; b)权重和偏差参数集,f是在隐藏层上使用的激活函数。使用均方误差作为损失函数的选择,使用网络权重的L1和L2范数,W作为公式2.1中的正则项,如下所示:
在这里插入图片描述
为了将物理知识作为损失函数纳入神经网络的训练中,我们将温度,密度和水深之间的关键物理关系用作基于物理的方程式(方程式2.2)。在下文中,我们介绍了这种物理关系的两个关键组成部分,并描述了我们使用它来确保物理学习的方法
温度–密度:
在这里插入图片描述
密度–深度:
在图4(b)的示例图中,由于密度较大的水较重,并且会下降到湖底。在同一时间步长t上,两个不同深度d1和d2的水密度以下列方式彼此相关:
在这里插入图片描述
为了确保在基于物理的模型Y ^的温度预测中维持基于物理的方程,可以按以下方法构造基于物理的损失函数。考虑在nd深度值和nt时间步长的规则网格上未标记的输入要素数据集。在任意一对连续的深度值di和di + 1(di <di + 1)上,可以计算出时间步长t上模型密度估计的差为
在这里插入图片描述
正值Δ[i, t]可以视为违反了基于物理学的等式3.12的深度di和时间t。可以将其评估为ReLU(∆ [di, t])的非零出现。因此,我们可以将每个连续的深度对和时间步长上所有物理违规的平均值视为基于物理的损失函数:
在这里插入图片描述
在学习目标(公式2.4)中使用基于物理的损失以及经验损失(公式3.9)和正则项(公式3.10),我们获得了完整的PGNN公式。请注意,在我们特定的湖泊温度建模问题中,即使正在训练神经网络来提高其预测水温的准确性,但基于物理的损失函数的使用仍可确保温度预测也转化为其他物理变量,即密度和深度,因此可以解决该物理问题。

经理 1 ImportError 79 Hy3DRenderMultiView 重新连接中 Hy3DRenderMultiView 导入时 DLL 加载失败 custom_rasterizer_kernel: 找不到指定的程序。 # ComfyUI Error Report ## Error Details - **Node ID:** 79 - **Node Type:** Hy3DRenderMultiView - **Exception Type:** ImportError - **Exception Message:** DLL load failed while importing custom_rasterizer_kernel: 找不到指定的程序。 ## Stack Trace ``` File "E:\comfyui\ComfyUI_windows_portable\ComfyUI\execution.py", line 496, in execute output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\comfyui\ComfyUI_windows_portable\ComfyUI\execution.py", line 315, in get_output_data return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\comfyui\ComfyUI_windows_portable\ComfyUI\execution.py", line 289, in _async_map_node_over_list await process_inputs(input_dict, i) File "E:\comfyui\ComfyUI_windows_portable\ComfyUI\execution.py", line 277, in process_inputs result = f(**inputs) ^^^^^^^^^^^ File "E:\comfyui\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Hunyuan3DWrapper\nodes.py", line 540, in process self.render = MeshRender( ^^^^^^^^^^^ File "E:\comfyui\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Hunyuan3DWrapper\hy3dgen\texgen\differentiable_renderer\mesh_render.py", line 158, in __init__ import custom_rasterizer as cr File "E:\comfyui\ComfyUI_windows_portable\python_embeded\Lib\site-packages\custom_rasterizer\__init__.py", line 32, in <module> from .render import * File "E:\comfyui\ComfyUI_windows_portable\python_embeded\Lib\site-packages\custom_rasterizer\render.py", line 25, in <module> import custom_rasterizer_kernel ``` ## System Information - **ComfyUI Version:** 0.3.49 - **Arguments:** ComfyUI\main.py --windows-standalone-build - **OS:** nt - **Python Version:** 3.12.10 (tags/v3.12.10:0cc8128, Apr 8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)] - **Embedded Python:** true - **PyTorch Version:** 2.6.0+cu124 ## Devices - **Name:** cuda:0 NVIDIA GeForce RTX 3050 Laptop GPU : cudaMallocAsync - **Type:** cuda - **VRAM Total:** 4294443008 - **VRAM Free:** 3461768807 - **Torch VRAM Total:** 0 - **Torch VRAM Free:** 0 ## Logs ``` 2025-11-19T23:17:49.885469 - [START] Security scan2025-11-19T23:17:49.885469 - 2025-11-19T23:17:51.166065 - [DONE] Security scan2025-11-19T23:17:51.166065 - 2025-11-19T23:17:51.328833 - ## ComfyUI-Manager: installing dependencies done.2025-11-19T23:17:51.328833 - 2025-11-19T23:17:51.328833 - ** ComfyUI startup time:2025-11-19T23:17:51.329838 - 2025-11-19T23:17:51.329838 - 2025-11-19 23:17:51.3282025-11-19T23:17:51.329838 - 2025-11-19T23:17:51.329838 - ** Platform:2025-11-19T23:17:51.329838 - 2025-11-19T23:17:51.329838 - Windows2025-11-19T23:17:51.329838 - 2025-11-19T23:17:51.329838 - ** Python version:2025-11-19T23:17:51.329838 - 2025-11-19T23:17:51.329838 - 3.12.10 (tags/v3.12.10:0cc8128, Apr 8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)]2025-11-19T23:17:51.329838 - 2025-11-19T23:17:51.329838 - ** Python executable:2025-11-19T23:17:51.329838 - 2025-11-19T23:17:51.329838 - E:\comfyui\ComfyUI_windows_portable\python_embeded\python.exe2025-11-19T23:17:51.329838 - 2025-11-19T23:17:51.330843 - ** ComfyUI Path:2025-11-19T23:17:51.330843 - 2025-11-19T23:17:51.330843 - E:\comfyui\ComfyUI_windows_portable\ComfyUI2025-11-19T23:17:51.330843 - 2025-11-19T23:17:51.330843 - ** ComfyUI Base Folder Path:2025-11-19T23:17:51.330843 - 2025-11-19T23:17:51.330843 - E:\comfyui\ComfyUI_windows_portable\ComfyUI2025-11-19T23:17:51.330843 - 2025-11-19T23:17:51.330843 - ** User directory:2025-11-19T23:17:51.330843 - 2025-11-19T23:17:51.330843 - E:\comfyui\ComfyUI_windows_portable\ComfyUI\user2025-11-19T23:17:51.330843 - 2025-11-19T23:17:51.330843 - ** ComfyUI-Manager config path:2025-11-19T23:17:51.330843 - 2025-11-19T23:17:51.330843 - E:\comfyui\ComfyUI_windows_portable\ComfyUI\user\default\ComfyUI-Manager\config.ini2025-11-19T23:17:51.331847 - 2025-11-19T23:17:51.331847 - ** Log path:2025-11-19T23:17:51.331847 - 2025-11-19T23:17:51.331847 - E:\comfyui\ComfyUI_windows_portable\ComfyUI\user\comfyui.log2025-11-19T23:17:51.331847 - 2025-11-19T23:17:52.690461 - Prestartup times for custom nodes: 2025-11-19T23:17:52.690461 - 0.0 seconds: E:\comfyui\ComfyUI_windows_portable\ComfyUI\custom_nodes\rgthree-comfy 2025-11-19T23:17:52.690461 - 4.9 seconds: E:\comfyui\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager 2025-11-19T23:17:52.690461 - 2025-11-19T23:17:54.565792 - Checkpoint files will always be loaded safely. 2025-11-19T23:17:54.670102 - Total VRAM 4096 MB, total RAM 15714 MB 2025-11-19T23:17:54.671106 - pytorch version: 2.6.0+cu124 2025-11-19T23:17:54.672110 - Set vram state to: NORMAL_VRAM 2025-11-19T23:17:54.672110 - Device: cuda:0 NVIDIA GeForce RTX 3050 Laptop GPU : cudaMallocAsync 2025-11-19T23:17:56.216535 - Using pytorch attention 2025-11-19T23:17:58.860794 - Python version: 3.12.10 (tags/v3.12.10:0cc8128, Apr 8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)] 2025-11-19T23:17:58.860794 - ComfyUI version: 0.3.49 2025-11-19T23:17:58.923432 - ComfyUI frontend version: 1.23.4 2025-11-19T23:17:58.924645 - [Prompt Server] web root: E:\comfyui\ComfyUI_windows_portable\python_embeded\Lib\site-packages\comfyui_frontend_package\static 2025-11-19T23:18:07.596254 - Unable to import guidedFilter, make sure you have only opencv-contrib-python or run the import_error_install.bat script2025-11-19T23:18:07.596254 - 2025-11-19T23:18:07.888831 - ### Loading: ComfyUI-Manager (V3.37.1) 2025-11-19T23:18:07.888831 - [ComfyUI-Manager] network_mode: public 2025-11-19T23:18:08.059458 - ### ComfyUI Revision: 150 [32a95bba] *DETACHED | Released on '2025-08-05' 2025-11-19T23:18:08.143693 - 2025-11-19T23:18:08.143693 - [rgthree-comfy] Loaded 48 extraordinary nodes. 🎉2025-11-19T23:18:08.143693 - 2025-11-19T23:18:08.143693 - 2025-11-19T23:18:08.147117 - Import times for custom nodes: 2025-11-19T23:18:08.147117 - 0.0 seconds: E:\comfyui\ComfyUI_windows_portable\ComfyUI\custom_nodes\websocket_image_save.py 2025-11-19T23:18:08.148171 - 0.0 seconds: E:\comfyui\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_essentials 2025-11-19T23:18:08.148171 - 0.0 seconds: E:\comfyui\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_ultimatesdupscale 2025-11-19T23:18:08.148171 - 0.0 seconds: E:\comfyui\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-kjnodes 2025-11-19T23:18:08.148171 - 0.0 seconds: E:\comfyui\ComfyUI_windows_portable\ComfyUI\custom_nodes\rgthree-comfy 2025-11-19T23:18:08.148171 - 0.2 seconds: E:\comfyui\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager 2025-11-19T23:18:08.148171 - 0.2 seconds: E:\comfyui\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-logicutils 2025-11-19T23:18:08.148171 - 1.6 seconds: E:\comfyui\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Image-Filters 2025-11-19T23:18:08.148171 - 5.4 seconds: E:\comfyui\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Hunyuan3DWrapper 2025-11-19T23:18:08.148171 - 2025-11-19T23:18:08.349134 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json 2025-11-19T23:18:08.600606 - Context impl SQLiteImpl. 2025-11-19T23:18:08.600606 - Will assume non-transactional DDL. 2025-11-19T23:18:08.603626 - No target revision found. 2025-11-19T23:18:08.637116 - Starting server 2025-11-19T23:18:08.637116 - To see the GUI go to: http://127.0.0.1:8188 2025-11-19T23:18:28.048663 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json 2025-11-19T23:18:28.164346 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/github-stats.json 2025-11-19T23:18:28.288138 - [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json 2025-11-19T23:18:49.057744 - got prompt 2025-11-19T23:18:49.059745 - Failed to validate prompt for output 99: 2025-11-19T23:18:49.060745 - * CheckpointLoaderSimple 168: 2025-11-19T23:18:49.060745 - - Value not in list: ckpt_name: 'juggernautXL_juggXIByRundiffusion.safetensors' not in [] 2025-11-19T23:18:49.060745 - * UpscaleModelLoader 172: 2025-11-19T23:18:49.060745 - - Value not in list: model_name: '4x-ClearRealityV1.pth' not in [] 2025-11-19T23:18:49.060745 - * ControlNetLoader 171: 2025-11-19T23:18:49.060745 - - Value not in list: control_net_name: 'diffusion_pytorch_model_promax.safetensors' not in [] 2025-11-19T23:18:49.060745 - Output will be ignored 2025-11-19T23:18:49.060745 - Failed to validate prompt for output 126: 2025-11-19T23:18:49.060745 - Output will be ignored 2025-11-19T23:18:49.060745 - Failed to validate prompt for output 154: 2025-11-19T23:18:49.060745 - Output will be ignored 2025-11-19T23:18:49.060745 - Failed to validate prompt for output 127: 2025-11-19T23:18:49.060745 - Output will be ignored 2025-11-19T23:18:49.061745 - Failed to validate prompt for output 175: 2025-11-19T23:18:49.061745 - Output will be ignored 2025-11-19T23:18:49.061745 - Failed to validate prompt for output 125: 2025-11-19T23:18:49.061745 - Output will be ignored 2025-11-19T23:18:49.061745 - Failed to validate prompt for output 179: 2025-11-19T23:18:49.061745 - Output will be ignored 2025-11-19T23:18:52.285314 - Removed floaters, resulting in 999886 vertices and 1999788 faces 2025-11-19T23:18:54.959404 - Removed degenerate faces, resulting in 999886 vertices and 1999788 faces 2025-11-19T23:19:28.516701 - Reduced faces, resulting in 149992 vertices and 300000 faces 2025-11-19T23:19:28.649617 - UV wrap: The mesh has more than 50,000 faces, which is not recommended.2025-11-19T23:19:28.649617 - 2025-11-19T23:21:23.896140 - camera_distance: 1.452025-11-19T23:21:23.896140 - 2025-11-19T23:21:24.195009 - !!! Exception during processing !!! DLL load failed while importing custom_rasterizer_kernel: 找不到指定的程序。 2025-11-19T23:21:24.198269 - Traceback (most recent call last): File "E:\comfyui\ComfyUI_windows_portable\ComfyUI\execution.py", line 496, in execute output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\comfyui\ComfyUI_windows_portable\ComfyUI\execution.py", line 315, in get_output_data return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\comfyui\ComfyUI_windows_portable\ComfyUI\execution.py", line 289, in _async_map_node_over_list await process_inputs(input_dict, i) File "E:\comfyui\ComfyUI_windows_portable\ComfyUI\execution.py", line 277, in process_inputs result = f(**inputs) ^^^^^^^^^^^ File "E:\comfyui\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Hunyuan3DWrapper\nodes.py", line 540, in process self.render = MeshRender( ^^^^^^^^^^^ File "E:\comfyui\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Hunyuan3DWrapper\hy3dgen\texgen\differentiable_renderer\mesh_render.py", line 158, in __init__ import custom_rasterizer as cr File "E:\comfyui\ComfyUI_windows_portable\python_embeded\Lib\site-packages\custom_rasterizer\__init__.py", line 32, in <module> from .render import * File "E:\comfyui\ComfyUI_windows_portable\python_embeded\Lib\site-packages\custom_rasterizer\render.py", line 25, in <module> import custom_rasterizer_kernel ImportError: DLL load failed while importing custom_rasterizer_kernel: 找不到指定的程序。 2025-11-19T23:21:24.200271 - Prompt executed in 155.14 seconds ``` ## Attached Workflow Please make sure that workflow does not contain any sensitive information such as API keys or passwords. ``` Workflow too large. Please manually upload the workflow from local file system. ``` ## Additional Context (Please add any additional context or steps to reproduce the error here) 什么意思
最新发布
11-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值