grokkingstuff Home Blog Projects Wiki Calculators About

DPM Sample Files — Cutting Planes and Iso-Surfaces in ANSYS Fluent

#+CATEGORY: cfd

#+TAGS: DPM sample-files cutting-planes iso-surfaces TUI

#+MATURITY: growing

DPM Sample Files :: Writing Particle Data on Surfaces

Sample files record DPM particle properties as particles cross a defined surface. They are the primary tool for quantitative analysis of particle concentration, flux, and size distribution at specific locations in the domain. This page covers surface creation, sample file setup, TUI commands, and interpretation of output. Target application: shisha PM2.5 simulation.

What Is a Sample File?

A sample file records every particle that crosses a user-defined surface during DPM tracking. For each crossing particle, Fluent writes:

The file is a plain-text, space-delimited file that can be read by external tools (Python, MATLAB, Tecplot) or re-imported into Fluent as a file injection.

Surface Creation

Before sampling, you must define the surface. Three surface types are most useful for DPM:

1. Plane surface (cutting plane): 1. Surface > Iso-Clip... or Surface > Plane Surface... 2. For a plane surface:

3. Name the surface: plane-mid-height, plane-outlet, etc.

TUI command for plane surface: ``` surface/plane-surface <surface-name> ; Then define: point-x point-y point-z normal-x normal-y normal-z ```

2. Iso-surface of a variable: 1. Surface > Iso-Surface... 2. Select variable (e.g., DPM Concentration, Temperature) 3. Set iso-value 4. Fluent generates a surface at that isovalue 5. Particles crossing this surface are sampled

3. Existing boundary zone:

TIP: For shisha PM2.5, create a horizontal plane at mouth/nose height (e.g., $z = 0.15$ m above the bowl top). This is the breathing zone for exposure analysis.

Sample File Setup via GUI

Access: Report > Discrete Phase > Sample...

Procedure: 1. Open Sample Track dialog 2. Write on: select the surface(s) you defined 3. File name: specify output path (e.g., shisha-pm25-plane.dat) 4. Additional properties to include: check all that apply:

5. Click Write to generate the file

Multiple surfaces: You can sample on multiple surfaces in a single operation. Each surface gets its own output file, or all are concatenated into one file with a surface-ID column.

Sample File Setup via TUI

The TUI approach is faster for multiple samples and is scriptable.

Basic sample command: ``` sample/particle-data <surface-name> <filename> ```

Example — sample on a cutting plane: ``` sample/particle-data plane-mid-height shisha-pm25-midplane.dat ```

Example — sample on a boundary zone: ``` sample/particle-data outlet shisha-pm25-outlet.dat ```

Sample with additional columns: ``` sample/particle-data <surface-name> <filename> <additional-options> ; additional-options: 1 = include velocity, 2 = include diameter, 3 = both ```

Sample on iso-surface: ``` ; First create the iso-surface surface/iso-surface dpm-concentration 0.001 iso-conc-001

; Then sample sample/particle-data iso-conc-001 shisha-pm25-isoconc.dat ```

*Sample file format: The output file has the following columns (default): ``` x y z u v w d T time mass-flow injection-id ```

Units are SI (meters, seconds, kg, Kelvin).

Post-Processing Sample Files

Once you have a sample file, you can analyze it externally.

Python example — read sample file and compute statistics: ```python import numpy as np

data = np.loadtxt('shisha-pm25-midplane.dat')

x = data[:, 0] y = data[:, 1] z = data[:, 2] d = data[:, 6] mass_flow = data[:, 9] residence_time = data[:, 8]

total_mass_flux = np.sum(mass_flow) print(f"Total mass flux: {total_mass_flux:.4e} kg/s")

mean_diameter = np.average(d, weights=mass_flow) print(f"Mass-weighted mean diameter: {mean_diameter*1e6:.2f} um")

mean_residence = np.average(residence_time, weights=mass_flow) print(f"Mass-weighted mean residence time: {mean_residence:.3f} s") ```

Re-import as file injection: 1. Models > Discrete Phase > Injections... > Create 2. Type: file 3. File name: select the sample file 4. Fluent reads the particle data and creates an injection from it

This is useful for downstream simulations: run the shisha bowl, sample the outlet, then inject those particles into a room-scale model.

Sampling for Concentration Profiles

To build a vertical concentration profile (concentration vs. height), create multiple parallel planes at different heights and sample on each.

Procedure: 1. Create 10 horizontal planes from $z = 0$ to $z = 0.3$ m at 0.03 m intervals 2. Sample particle data on each plane 3. For each plane, compute: $$C(z_i) = \frac{\sum \dot{m}_j}{A_{\text{plane}}}$$ where $\dot{m}_j$ is the mass flow rate of each parcel crossing the plane and $A_{\text{plane}}$ is the plane area. 4. Plot $C(z)$ vs. $z$

TUI script for multiple planes: ``` ; Define 10 planes surface/plane-surface plane-z00 0 0 0.00 0 0 1 surface/plane-surface plane-z03 0 0 0.03 0 0 1 surface/plane-surface plane-z06 0 0 0.06 0 0 1 surface/plane-surface plane-z09 0 0 0.09 0 0 1 surface/plane-surface plane-z12 0 0 0.12 0 0 1 surface/plane-surface plane-z15 0 0 0.15 0 0 1 surface/plane-surface plane-z18 0 0 0.18 0 0 1 surface/plane-surface plane-z21 0 0 0.21 0 0 1 surface/plane-surface plane-z24 0 0 0.24 0 0 1 surface/plane-surface plane-z27 0 0 0.27 0 0 1 surface/plane-surface plane-z30 0 0 0.30 0 0 1

; Sample on each sample/particle-data plane-z00 sample-z00.dat sample/particle-data plane-z03 sample-z03.dat sample/particle-data plane-z06 sample-z06.dat sample/particle-data plane-z09 sample-z09.dat sample/particle-data plane-z12 sample-z12.dat sample/particle-data plane-z15 sample-z15.dat sample/particle-data plane-z18 sample-z18.dat sample/particle-data plane-z21 sample-z21.dat sample/particle-data plane-z24 sample-z24.dat sample/particle-data plane-z27 sample-z27.dat sample/particle-data plane-z30 sample-z30.dat ```

TIP: Automate this with a Fluent journal file. Write all TUI commands to a .jou file and replay with File > Read > Journal...

Sampling on Iso-Surfaces

Iso-surfaces let you sample particles at a specific concentration threshold. This is useful for exposure contour analysis: what particles are in the region where concentration exceeds a health guideline?

Procedure: 1. Run DPM to completion 2. Create an iso-surface of DPM Concentration at the threshold value (e.g., 50 $\mu$g/m^3 for WHO PM2.5 guideline) 3. Sample particle data on that iso-surface 4. Analyze size distribution and residence time of particles in the high-concentration region

TUI: ``` ; Create iso-surface at 50 ug/m^3 = 5e-5 kg/m^3 surface/iso-surface dpm-concentration 5e-5 iso-who-guideline

; Sample sample/particle-data iso-who-guideline sample-exposure.dat ```

Common Pitfalls

PitfallSymptomFix
Sampling before DPM run completesEmpty fileRun DPM first, then sample
Surface not intersecting particle pathsEmpty fileCheck surface position/orientation
Plane surface outside meshError or no dataVerify surface lies within domain
Too few parcels crossingNoisy statisticsIncrease parcel count in injection
Steady tracking samplingOnly counts each parcel onceCorrect for steady: flux = mass flow rate
Transient tracking samplingMultiple crossings per parcelAccount for time-weighting

See Also