NaluCFD 介绍和使用指南
文章目录
- NaluCFD 介绍和使用指南
- NaluCFD 简介
- 主要特点
- 安装 NaluCFD
- 系统要求
- 安装步骤
- 使用 NaluCFD
- 基本工作流程
- 示例输入文件
- 运行计算
- 后处理
- 高级功能
- 学习资源
NaluCFD 介绍和使用指南
NaluCFD 简介
NaluCFD 是一个开源的计算流体动力学(CFD)求解器,由美国国家可再生能源实验室(NREL)开发。它是基于Sierra工具箱中的Nalu模块发展而来,专注于解决复杂的多物理场流动问题。
主要特点
- 开源免费:基于BSD许可证发布
- 高性能:支持大规模并行计算
- 多物理场:支持流体流动、传热、化学反应等多物理场耦合
- 可扩展性:模块化设计,易于扩展新功能
- 工业级应用:适用于风力涡轮机、建筑环境、航空航天等工程应用
安装 NaluCFD
系统要求
- Linux 系统 (推荐 Ubuntu/CentOS)
- C++编译器 (GCC/Intel)
- MPI 实现 (OpenMPI/MPICH)
- CMake (≥3.10)
- Trilinos (≥12.12)
- YAML-cpp
- Boost
安装步骤
-
获取源代码:
git clone https://github.com/NaluCFD/Nalu.git cd Nalu
-
创建构建目录:
mkdir build && cd build
-
配置构建:
cmake -DTrilinos_DIR=/path/to/trilinos \-DYAML_DIR=/path/to/yaml-cpp \-DCMAKE_INSTALL_PREFIX=/path/to/install \..
-
编译和安装:
make -j4 make install
使用 NaluCFD
基本工作流程
- 准备输入文件:创建YAML格式的输入文件
- 网格准备:生成或导入计算网格
- 运行计算:执行Nalu可执行文件
- 后处理:分析计算结果
示例输入文件
Problem:name: channel_flowRealm:name: realm_1mesh: channel.exoautomatic_decomposition_type: rcbequation_systems:name: theEqSysmax_iterations: 10solver_system_specification:velocity: solve_scalarpressure: solve_contsystems:- LowMachEOM:name: myLowMachmax_iterations: 3convergence_tolerance: 1.0e-5material_properties:target_name: block_1specifications:- name: densitytype: constantvalue: 1.0- name: viscositytype: constantvalue: 1.0e-3initial_conditions:- constant:target_name: block_1value:pressure: 0.0velocity: [1.0, 0.0, 0.0]boundary_conditions:- wall_boundary_condition:target_name: top_wallwall_user_data:velocity: [0,0,0]- wall_boundary_condition:target_name: bottom_wallwall_user_data:velocity: [0,0,0]- inflow_boundary_condition:target_name: inletinflow_user_data:velocity: [1.0, 0.0, 0.0]- open_boundary_condition:target_name: outletopen_user_data:pressure: 0.0solution_options:name: myOptionsturbulence_model: laminaroptions:- hybrid_factor:velocity: 1.0- limiter:pressure: novelocity: no- projected_nodal_gradient:velocity: elementpressure: elementTime_Integrators:- StandardTimeIntegrator:name: ti_1start_time: 0.0termination_time: 10.0time_step: 0.1time_stepping_type: fixedtime_step_count: 0realms: [realm_1]
运行计算
mpirun -np 4 naluX -i input_file.yaml
后处理
NaluCFD 输出 Exodus II 格式的结果文件,可以使用以下工具进行后处理:
- ParaView
- VisIt
- Ensight
高级功能
- 湍流模型:支持RANS、LES和DES等多种湍流模型
- 传热计算:支持传导、对流和辐射传热
- 多相流:支持VOF和Level Set方法
- 化学反应:支持有限速率化学反应
- 动网格:支持刚体运动和变形网格
学习资源
- 官方文档:https://nalu-cfd.readthedocs.io/
- GitHub仓库:https://github.com/NaluCFD/Nalu
- 用户论坛:https://github.com/NaluCFD/Nalu/discussions
NaluCFD 是一个功能强大但学习曲线较陡的CFD工具,适合有一定CFD背景的用户使用。对于初学者,建议从简单的案例开始,逐步掌握其使用方法。