CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

How to get boundary values using graph post-process function?

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By Tobermory
  • 1 Post By thiagopl

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 16, 2025, 17:17
Default How to get boundary values using graph post-process function?
  #1
Member
 
Thiago Parente Lima
Join Date: Sep 2011
Location: Diamantina, Brazil.
Posts: 69
Rep Power: 15
thiagopl is on a distinguished road
Hi all,

To exemplify my question I will use a 1D steady state conduction case, presented here in section "1.1 Part A: Steady-State conduction" (case attached in OF 12).
What I want is to plot the temperature, T, along x axis from one boundary to the other (y and z position doesn't matter here). Using the graphCell post-processing function, I get the exact cell center values inside the domain. But, I want also to get the values on the boundaries, i.e., T at x=0 m and x=0.2 m. For this, I thought I should use graphCellFace function which says: "One graph point is generated on each face and in each cell that the line intersects.".
However, using the following configuration for graphCellFace, I can't get the correct values for the temperature at the boundaries, as shown bellow.
Code:
start           (0.0 0.5 0.005);
end             (0.2 0.5 0.005);

fields          (T);

axis            x; // The independent variable of the graph. Can be "x",
                          // "y", "z", "xyz" (all coordinates written out), or
                          // "distance" (from the start point).

#includeEtc "caseDicts/functions/graphs/graphCellFace.cfg"
Code:
#           x             T
            0       390.535
        0.005         390.5
         0.01           388
        0.015         385.5
         0.02           383
        0.025         380.5

intermediate values ommited for simplicity...

        0.175         305.5
         0.18           303
        0.185         300.5
         0.19           298
        0.195         295.5
          0.2       295.465
I should expect 393 K at x=0 m and 293 K at x=0.2 m, so it seems that some interpolation is happen on the boundaries. Using graphUniform or graphFace doesn't help either.

The question is, how to get the correct values on the boundaries?

P.S.: I don't want to use paraview.
Attached Files
File Type: zip testCase.zip (4.8 KB, 1 views)
__________________
Field of interest: heat transer. OpenFOAM Foundation's distribution user.
thiagopl is offline   Reply With Quote

Old   January 28, 2025, 10:10
Default
  #2
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 792
Rep Power: 14
Tobermory will become famous soon enough
You need to adjust the interpolationScheme from cellPoint to cellPointFace, and the line type from lineCell to lineFace.

You had already pretty much done the second of these by including graphCellFace.cfg, but this also includes graph.cfg which sets interpolationScheme to cellPoint.

I understand OF's use of include files, but sometimes its just easier to have all the parameters visible and in one file, eg:

Code:
type            sets;
libs            ("libsampling.so");

writeControl    writeTime;

start           (-0.1 0.5 0.005);
end             (0.2 0.5 0.005);

fields          (T);
axis            x;

//interpolationScheme cellPoint;
interpolationScheme cellPointFace;

setFormat       raw;
sets
(
    line
    {
        //type            lineCell;
        type            lineFace;
        axis            $axis;
        start           $start;
        end             $end;
    }
);
Finally, note that I set the start to outside the domain, since otherwise for some reason (rounding error?) it was missing the data point at x=0. Output is now:

Code:
#           x             T
            0           393
         0.01           388
         0.02           383
...
         0.16           313
         0.17           308
         0.18           303
         0.19           298
thiagopl likes this.
Tobermory is offline   Reply With Quote

Old   January 29, 2025, 07:52
Default
  #3
Member
 
Thiago Parente Lima
Join Date: Sep 2011
Location: Diamantina, Brazil.
Posts: 69
Rep Power: 15
thiagopl is on a distinguished road
Hi Tobermory,

Thank you for the answer. You are right. I think this should be corrected since when we choose for graphCellFace we want this face values at boundaries. In a more complex case this error could result in many problems, for example, when trying to validate results near walls.

Here is a corrected version of the graphCellFace, still using the include files.

Code:
start           (-1e-6 0.5 0.005);	//setting the start point a bit before 0.0
end             (0.200001 0.5 0.005);	//setting the end point a bit after 0.2

fields          (T);

axis            x; // The independent variable of the graph. Can be "x",
                          // "y", "z", "xyz" (all coordinates written out), or
                          // "distance" (from the start point).

#includeEtc "caseDicts/functions/graphs/graphCellFace.cfg"

interpolationScheme cellPointFace; //this line MUST be after the #includeEtc command
The result:
Code:
#           x             T
            0           393
        0.001         392.5
        0.002           392
        0.003         391.5
...
        0.197         294.5
        0.198           294
        0.199         293.5
          0.2           293
Tobermory likes this.
__________________
Field of interest: heat transer. OpenFOAM Foundation's distribution user.

Last edited by thiagopl; January 29, 2025 at 07:55. Reason: Add results
thiagopl is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
../externals/cgns/hdf5/H5public.h:63:10: fatal error: mpi.h: No such file or director Mohsin1 SU2 8 November 25, 2023 04:46
Question about adaptive timestepping Guille1811 CFX 25 November 12, 2017 18:38
Wrong flow in ratating domain problem Sanyo CFX 17 August 15, 2015 07:20
Low Mixing time Problem Mavier CFX 5 April 29, 2013 01:00
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 21:50


All times are GMT -4. The time now is 22:33.