# PFFDTD (pretty fast FDTD)
![PFFDTD Screenshot](https://github.com/bsxfun/pffdtd/raw/main/screenshot.png)
PFFDTD is an implementation of finite-difference time-domain (FDTD) simulation for 3D room acoustics, which includes an accompanying set of tools for simulation setup and processing of input/output signals. This software is intended for research use with powerful workstations or single-node remote servers with one or more Nvidia GPUs (using CUDA). PFFDTD was designed be "pretty fast" when run on GPUs – at least for FDTD simulations (the name is mostly intended as a pun).
## Features
- Multi-GPU-accelerated execution (with CUDA-enabled Nvidia GPUs)
- Multi-threaded CPU execution
- Python-based voxelization with CPU multiprocessing
- Energy conservation to machine precision (numerical stability)
- 7-point Cartesian and 13-point face-centered cubic (FCC) schemes
- Frequency-dependent impedance boundaries
- Works with non-watertight models
- Stability safeguards for single-precision operation
- A novel staircase boundary-surface-area correction scheme
- 3D visualization
## Installation
PFFDTD is designed to run on a Linux system (e.g. Ubuntu/Centos/Arch).
### Installation (Python)
PFFDTD requires at least Python 3.9 to run, with additional required packages in pip_requirements.txt (for pip) or
conda_pffdtd.yml (for conda). Conda (or miniconda) is recommended to get started with a PFFDTD-specific conda environment (see .yml file).
### Installation (C/CUDA)
To compile, run 'make all' in the c_cuda folder.
You will need the CUDA toolkit, which you can install from [this link](https://developer.nvidia.com/cuda-downloads).
You will also need HDF5 runtime and development files. In Ubuntu it suffices to install the libhdf5-dev package. For Centos install hdf5-devel. You can also link to the shared libraries [which you can download here](https://www.hdfgroup.org/downloads/hdf5/). Check the Makefile for environment variables to set.
## Examples
There are two models provided with the code, which you can start to run from the four test scripts in this root folder.
## Starting a project from scratch
To start a project (a model) from scratch, follow the provided examples, but essentially you will need to:
1. Build a Sketchup model, set source/receiver locations in CSV files, and export to a JSON file.
2. Fit absorption/impedance data to the passive boundary impedance model used [BHBS16]. Only a simple routine is provided to fit to 11 octave-band absorption coefficients (16Hz to 16kHz).
3. Fill out a setup script to configure the model and simulation.
3. Run your setup script, which in turns runs a 'voxelization' routine and sets up input/output grid positions and signals.
4. Simulate your model from the exported .h5 data files with either the CPU-based Python code (which includes energy + visualization), or the C/CPU-based engine, or the C/CUDA/GPU-based engine.
5. Post-process the output files from output .h5 files (if not just a run for visualization purposes).
The setup phase (signals + voxelization) can be carried out on a different machine to the simulation itself. This is useful if you're using GPUs on a remote server. There are GZIP compression options in the HDF5 exporting if
network uploading is a bottleneck (you can also repack HDF5 files with 'h5repack'). Note, however, the voxelization phase is compute-intensive. It is best to have a many-core CPU server or workstation for this, or least a
powerful laptop.
### Sketchup
After building a Sketchup model of your room/scene, you can export it using the provided Sketchup plugin (.rbz file under ruby_SU folder), which exports the model and source/receiver positions (defined in separate CSV files – see examples) to a JSON file. Walls should be labelled with Sketchup Materials (which you can rename as necessary), and you should pay attention to the orientation of faces. Unlabelled materials are taken to be rigid. It is important to only label the 'active' side of a surface in order to save on computation time and memory in the FDTD scheme (non-rigid boundary nodes require extra state for internal ODEs). It is possible to have two-sided materials if needed, but both sides must be the same material. The model does not need to be closed (watertight) but it is good practice to have that. The exported model is expected to have at least four triangles. It only exports visible entities, and only Face entities (not Groups or Components – explode them first). Layers (Tags) are not taken into account.
The rest of the code works from the JSON export, so it's possible to export to this JSON format from other CAD software (in theory, but you would need to develop plugins for that). There is a
Three.JS based viewer in a [separate repository](https://github.com/bsxfun/pffdtd_js_model_viewer) to double check the export (and orientation of faces).
### Python
Follow the test script examples to set up your simulation. You need to choose input-signal types, link up materials to impedance data files (.h5 HDF5 format files), and choose your grid resolution. It helps to know some basics of Python/Numpy and FDTD here. When you run the script you will get a bunch of info related to the scheme, and it will give you an estimate of memory requirements for the simulation, and save some necessary data in .h5 files.
### Simulation engine
Once you have your .h5 files ready in some folder, you can run the Python FDTD engine (pointing to the folder), or run the compiled C binaries from that folder. You will of course need Nvidia GPUs to run the CUDA version of the FDTD engine. The different engine implementations produce identical results (to within machine accuracy). Generally, the Python version is for visualization purposes and correctness checking (comparing outputs or calculating system energy), whereas the CUDA code is meant for larger simulations. Single-precision GPU execution will generally be the fastest (and cheapest) to run.
### Post-processing
When the simulation has completed there will be a 'sim_outs.h5' file which has the raw signal read from grid locations. You can process these signals to get final output files, which do need some
cleanup to remove, e.g., high frequencies with too much error (numerical dispersion) or to resample to a standard audio rate like 48kHz. There are also filters to apply air absorption to the output
responses [Ham21a,Ham21b]. PFFDTD is only designed to output monoaural RIRs, but you can build arrays of outputs and feed those into frequency-domain microphone-array processing tools [(e.g.,)](http://research.spa.aalto.fi/projects/sparta_vsts/) for spatial audio, or encode Ambisonics directly in the time-domain [BPH19] (a similar approach can be used for directive sources [BAH19]).
## Enhancements
This code largely implements algorithms that have already been published (see key reference list below) but it does feature some enhancements that have not appeared in articles that are worth
mentioning below.
### Operation in single precision
Instabilities can occur with FDTD simulations in finite-precision if you wait long enough, and that length will depend on the precision chosen and the particular simulation. You should not experience instabilities in double precision (indeed, the code conserves energy to machine precision). Single precision is generally faster and uses less memory, but operating in single precision can be give rise to instabilities (due to rounding errors) (see, e.g., [HBW14]).
If you choose to use single precision, this code has a few safeguards to mitigate/delay long-time instabilities. First, the eigenvalues of the underlying finite-difference Laplacian operator are perturbed to prevent DC-mode instabilities. In view of a matrix operator, off-diagonal elements are rounded towards zero (RTZ), while diagonal elements are shifted (on the order of machine epsilon) such that the finite-difference Laplacian operator rema
没有合适的资源?快使用搜索试试~ 我知道了~
PFFDTD 是用于 3D 房间声学 的开源FDTD模拟器_python_代码_下载
共78个文件
py:37个
h5:14个
csv:5个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 63 浏览量
2022-07-03
14:40:50
上传
评论
收藏 2.93MB ZIP 举报
温馨提示
PFFDTD 是用于 3D 房间声学的有限差分时域 (FDTD) 仿真的实现,其中包括一组用于仿真设置和输入/输出信号处理的随附工具。该软件旨在用于具有一个或多个 Nvidia GPU(使用 CUDA)的强大工作站或单节点远程服务器的研究用途。PFFDTD 在 GPU 上运行时被设计为“相当快”——至少对于 FDTD 模拟而言 特征 多 GPU 加速执行(使用支持 CUDA 的 Nvidia GPU) 多线程 CPU 执行 基于 Python 的体素化与 CPU 多处理 机器精度的节能(数值稳定性) 7 点笛卡尔和 13 点面心立方 (FCC) 方案 频率相关阻抗边界 适用于非防水模型 单精度运行的稳定性保障 一种新颖的楼梯边界面修正方案 3D 可视化 更多详情、使用方法,请下载后阅读README.md文件
资源推荐
资源详情
资源评论
收起资源包目录
pffdtd-main.zip (78个子文件)
pffdtd-main
c_cuda
cpu_engine.h 13KB
gpu_engine.h 46KB
helper_funcs.h 4KB
fdtd_data.h 28KB
fdtd_common.h 6KB
Makefile 2KB
fdtd_main.c 1KB
ruby_SU
RoomExporter.rb 466B
RoomExporter
RoomExport.rb 15KB
RoomExporter.rbz 5KB
data
models
CTK_Church
CTK_Church_SU2017.skp 1.31MB
sources.csv 51B
model_export.json 59KB
receivers.csv 89B
README.md 680B
Musikverein_ConcertHall
sources.csv 53B
model_export.json 1.66MB
receivers.csv 272B
README.md 992B
Musikverein_SU2017.skp 4.05MB
materials
mv_chairs.h5 2KB
ctk_audience.h5 2KB
ctk_window.h5 2KB
ctk_walls.h5 2KB
mv_window.h5 2KB
mv_wood.h5 2KB
mv_floor.h5 2KB
ctk_chair.h5 2KB
ctk_acoustic_panel.h5 2KB
ctk_carpet.h5 2KB
mv_plasterboard.h5 2KB
ctk_altar.h5 2KB
ctk_tile.h5 2KB
ctk_ceiling.h5 2KB
python
conda_pffdtd.yml 491B
fdtd
sim_mats.py 2KB
sim_comms.py 9KB
sim_consts.py 3KB
__init__.py 0B
rotate_sim_data.py 9KB
process_outputs.py 12KB
sim_fdtd.py 34KB
test_script_CTK_cart_gpu.py 2KB
build_mats.py 4KB
pip_requirements.txt 604B
voxelizer
cart_grid.py 4KB
__init__.py 0B
vox_scene.py 29KB
vox_grid_base.py 9KB
vox_grid.py 8KB
test_script_MV_fcc_viz.py 2KB
common
myfuncs.py 8KB
tris_precompute.py 3KB
box.py 6KB
timer.py 2KB
tri_box_intersection.py 5KB
__init__.py 0B
check_version.py 604B
timerdict.py 2KB
room_geo.py 11KB
tri_ray_intersection.py 8KB
myasserts.py 864B
air_abs
get_air_absorption.py 4KB
test_air_abs_filters.py 2KB
visco_filter.py 2KB
__init__.py 0B
ola_filter.py 2KB
modal_filter.py 2KB
test_script_CTK_cart_viz.py 2KB
materials
__init__.py 0B
adm_funcs.py 10KB
sim_setup.py 6KB
test_script_MV_fcc_gpu.py 2KB
LICENSE 1KB
benchmarks
pffdtd_benchmarks.csv 1KB
README.md 533B
screenshot.png 281KB
README.md 15KB
共 78 条
- 1
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9149
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Gradle,Maven 插件将 Java 应用程序打包为原生 Windows、MacOS 或 Linux 可执行文件并为其创建安装程序 .zip
- Google Maps API Web 服务的 Java 客户端库.zip
- Google Java 核心库.zip
- GitBook 教授 Javascript 编程基础知识.zip
- Generation.org 开发的 JAVA 模块练习.zip
- FastDFS Java 客户端 SDK.zip
- etcd java 客户端.zip
- Esercizi di informatica!执行计划,metti alla prova!.zip
- Eloquent JavaScript 翻译 - 2ª edição .zip
- Eclipse Paho Java MQTT 客户端库 Paho 是一个 Eclipse IoT 项目 .zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功