Extract pressure and velocity magnitude from point data from input file in Fluent
Given set of point data (x,y,z), extract the pressure or velocity magnitudes and print them to file.
A UDF was created for this purpose. Contact ww to obtain the files and an example.
Here is the README file from the package.
This UDF takes a set of data points in an input file "point-data.inp" in the format
* First line = number of data points
* Remaining lines are the coordinate points.
Thus, for a 2D case
and likewise for a 3D case
x0, y0, z0
x1, y1, z1
x(N-1), y(N-1), z(N-1)
The UDF interpolates either the v-magnitude and the pressure at those locations
and saves them to a data file via an EXECUTE ON DEMAND procedure in FLUENT.
The interpolation is obtained as follows:
* The nearest cell containing the point is located.
* The neighbour cells of the host cell are identified.
* The scalar value at all cells are gotten.
* A linear-least squares problem is solved to obtain a function scalar = ax + by + cz.
The coefficients are determined to minimize the sum of the square of the errors.
* Using this function, the scalar value at the data point is computed.
Sequential executions of the UDF are appended to the data file...
For the pressure, the output file is "pressure-data.out"
For the v-magnitude, the output file is "velocity-data.out"
* Compile UDF for your platform... It has tested ok on parallel/serial Linux
* Load case/data
* Link the UDF
* Make sure you have a data file "point-data.inp" in the format above.
NOTE... Data points in the file that are outside the domain are IGNORED and NO
WARNING is issued.
* Solve for a steady solution or perform a transient analysis.
* When you want the pressure/velocity data at the points int "point-data.inp",
click on Define->User Defined->Execute on Demand...
If you don't have N points in the file, you'll get an error...
I can make the UDF smarter, but just use "wc -l point-data.inp"
to print out the number of lines in the file. It should give you
N+1, where N is the number of data points.
The output file "point-data.out" is always appended. I would recommend
simply renaming this file to the appropriate name for the case.