FLUENT 5 - How to make contour plots of difference in pressures (or any other variable) in two data files?
It is often necessary to make a close comparison between
the results contained in two data files. One way to do
this is to subtract the results of one data file from
those contained in the other to obtain a third data
set that can be post-processed (i.e. one should be able
to plot countours, etc. of the third data set).
The solution listed below has the following attributes:
1) It works for two data files obtained from the same
mesh with different settings (boundary conditions,
initial conditions, physical models, etc.)
2) It works even if the two data files are obtained
from different case files which have different
geometry and mesh. (Though it is not necessary
to have exactly identical geometry and mesh between
the two case files, they should be similar.)
3) The solution is currently developed to process one
variable (pressure, temperature, etc.) at a time, but
can be easily extended to processes multiple variables
at a time.
4) The original data from the first data file as well as
the subtracted data are stored in the second data file
under user defined memory and thus get saved with it.
All post-processing functions (contour plots, etc.)
can be performed on the subtracted data.
Follow this procedure for the solution:
1) Open first case and data file and write out an inter-
polate file for the variable of interest (e.g. pressure)
through FILE -> INTERPOLATE -> write
Close first case and data file.
2) Open second case and data file. Add two user-defined
DEFINE -> USER-DEFINED -> USER-DEFINED-MEMORY
3) Load the attached udf through
DEFINE -> USER-DEFINED -> FUNCTIONS
See the "UDF User's Guide" for details of how to
compile and load udfs.
4) Execute the following "Execute on Demand" command:
DEFINE -> USER-DEFINED -> EXECUTE-ON-DEMAND -> p_to_udm0
(This copies the pressure to user-defined-memory-0)
5) Read in the interpolate file created from the first
case and data (in step 1) through:
FILE -> INTERPOLATE -> read
(This will overwrite the pressure field in the second
data file with the pressure data from the first data
6) Execute the following "Execute on Demand" command:
DEFINE -> USER-DEFINED -> EXECUTE-ON-DEMAND -> delta_p_to_udm1
(This calculates the delta-pressure and stores it in
7) Thus finally you will have
- pressure from data-file-1 in the pressure field of
- original pressure from data-file-2 in user-defined-
memory-0 of data-file-2
- delta-p (i.e. pressure from data-file-2 minus pressure
from data-file-1) in user-defined-memory-1 of data-file-2
All these three quantities can be post-processesed as
8) The attached udf will have to be modified suitably for
obtaining difference of a variable other than pressure
for for processing multiple variables simultaneously.
extern Domain *domain;
extern Domain *domain;