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

Extracting cell centre values WITHOUT interpolation

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

Reply
 
LinkBack Thread Tools Display Modes
Old   August 17, 2013, 23:35
Default Extracting cell centre values WITHOUT interpolation
  #1
New Member
 
Aaron
Join Date: Mar 2013
Posts: 10
Rep Power: 4
dalaron is on a distinguished road
I would like to extract cell centre values without using any interpolation schemes. My sampleDict file is as follows:
PHP Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.2.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    
version     2.0;
    
format      ascii;
    class       
dictionary;
    
location    "system";
    
object      sampleDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

interpolationScheme cell;    

setFormat       raw;

sets
(
    
centrePatch
    
{
        
type    uniform;
        
axis    x;
        
start   0 0 0 ); // start of sample region
        
end     8.11734270322 0 0 ); // end point of sample region
        
nPoints 50;
    }
);

fields          Ux p T );


// ************************************************************************* // 
The problem I am having is what to do with nPoints. I would ideally like to have this automatically match the number of cells I have without me having to specify it. For example if my grid hasd 50 cells in the horizontal direction I could go
PHP Code:
 nPoints nDomain
(or some other keyword), instead of having to specify manually
PHP Code:
 nPoints 50
Is this something that can be done?

Using nPoints 50; gives me the following temperature plot. As you can see, towards the end of the domain the sample points from my solution are more noticeably clustered in pairs.
Attached Images
File Type: png temperatureVariation.png (39.7 KB, 10 views)
dalaron is offline   Reply With Quote

Old   August 18, 2013, 00:39
Default
  #2
New Member
 
Aaron
Join Date: Mar 2013
Posts: 10
Rep Power: 4
dalaron is on a distinguished road
I believe I have solved my problem. Here is the sampleDict with modifications:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.2.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      sampleDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

interpolationScheme cell;    

setFormat       raw;

sets
(
    centrePatch
    {
        type    midPoint; 
        axis    x;
        start   ( 0 0 0 );
        end     ( 8.11734270322 0 0 );
    }
);

fields
(
    Ux 
    p 
    T 
);


// ************************************************************************* //
I used
Code:
 type    midPoint;
and removed the nPoints part of the sampleDict file.

I still have the issue of 'clustered' pairs of temperature points and am not sure what is causing that, though they now much more closely match the theoretical predication. Is this something I should even be looking into? Plots for Pressure, Density, and Mach number do not have this issue (or if they do it much, much less obvious).
Attached Images
File Type: png temperatureVariationNew.png (39.8 KB, 7 views)
dalaron is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting cell variable values in a fluid zone using UDF eromon84 Fluent UDF and Scheme Programming 5 October 15, 2013 05:16
Calculate Cell Centre to Cell Face Distances iamed18 OpenFOAM Programming & Development 15 October 10, 2012 06:09
Cell face values computation un unstructured grids Sergio Rossi Main CFD Forum 2 May 28, 2006 10:04
Interpolation for ghost cell help zonexo Main CFD Forum 0 March 11, 2006 21:03
interpolation from cell center to vertices Zhang Main CFD Forum 3 August 22, 2003 07:31


All times are GMT -4. The time now is 03:19.