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

postProcessing - want to stop the headers repeating in surfaceFieldValue.dat

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 16, 2020, 08:46
Default postProcessing - want to stop the headers repeating in surfaceFieldValue.dat
  #1
New Member
 
Thangasivam
Join Date: Sep 2012
Location: India
Posts: 5
Rep Power: 10
namsivag is on a distinguished road
Hello,
I am trying to write p, T, U values at inlet while solving.
But in surfaceFieldValue.dat, I am seeing headers repeating after every timeStep or deltaT. I would like to stop the repetitive headers.

I am attaching the necessary codes / contents of the files.

I want
Code:
# Region type : patch inlet
# Faces       : 174
# Area        : 1.756255e-04
# Scale factor: 1.000000e+00
# Time            areaAverage(p)    areaAverage(T)    areaAverage(phi)    areaAverage(U)
-179.75           9.996845e+04    3.000000e+02    6.017445e-09    (2.330926e-06 -4.596611e-05 1.718942e-02)
-179.5            9.956394e+04    3.000000e+02    1.916559e-07    (-1.352449e-05 -5.353317e-04 5.285954e-01)
:
:
:
I am getting at \postProcessing\velocityInlet\-180\surfaceFieldValue.dat
Code:
# Region type : patch inlet
# Faces       : 174
# Area        : 1.756255e-04
# Scale factor: 1.000000e+00
# Time            areaAverage(p)    areaAverage(T)    areaAverage(phi)    areaAverage(U)
-179.75           9.996845e+04    3.000000e+02    6.017445e-09    (2.330926e-06 -4.596611e-05 1.718942e-02)
# Region type : patch inlet
# Faces       : 174
# Area        : 1.756255e-04
# Scale factor: 1.000000e+00
# Time            areaAverage(p)    areaAverage(T)    areaAverage(phi)    areaAverage(U)
-179.5            9.956394e+04    3.000000e+02    1.916559e-07    (-1.352449e-05 -5.353317e-04 5.285954e-01)
# Region type : patch inlet
# Faces       : 174
# Area        : 1.756255e-04
# Scale factor: 1.000000e+00
:
:
:

controlDict
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1912                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict.1st;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     XiEngineFoam;

startFrom       startTime;

startTime       -180;

stopAt          endTime;

endTime         -160;// 60

deltaT          0.25;

writeControl    runTime;

writeInterval   5;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;

adjustTimeStep  no;

maxCo           0.2;

maxDeltaT       1;

functions
{

    timeStep
    {
        name    setDeltaT;
        type    coded;
        libs    (utilityFunctionObjects);

        code
        #{
        #};

        codeExecute
        #{
            const Time& runTime = mesh().time();
            if (runTime.timeToUserTime(runTime.value()) >= -15.0)
            {
                const_cast<Time&>(runTime).setDeltaT
                (
                    runTime.userTimeToTime(0.025)
                );
            }
        #};
    }

    #include "momentum"
    #include "velocityInlet"
}

// ************************************************************************* //

velocityInlet
Code:
velocityInlet
{
    // Mandatory entries (unmodifiable)    
    type            surfaceFieldValue;
    libs            (fieldFunctionObjects);
    log             true;        
    // Mandatory entries (runtime modifiable)    
    fields          (p T phi U);
    operation       areaAverage;
    regionType      patch;
    name            inlet;    
    
    // Optional (inherited) entries
    writeFields     false;    

    writeControl    timeStep;
    writeInterval   1;
    writeArea 	false;
}
namsivag is offline   Reply With Quote

Old   July 29, 2020, 18:14
Default
  #2
New Member
 
Munaf
Join Date: May 2019
Posts: 28
Rep Power: 3
mwmalkawi is on a distinguished road
Hi


Please have you manged to resolve it as i am having the same problem





Thanks
mwmalkawi is offline   Reply With Quote

Old   Yesterday, 13:04
Default
  #3
Member
 
Join Date: Sep 2018
Posts: 34
Rep Power: 4
tecmul is on a distinguished road
This resolves the issue for me on OpenFoam-v2006.

Create a copy of the surfaceFieldValue function object and inside the implementation file, comment out the line

writeFileHeader(file());

Then add the same line to the constructor of the function object.
Code:
Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
(
    const word& name,
    const Time& runTime,
    const dictionary& dict
)
:
    fieldValue(name, runTime, dict, typeName),
    regionType_(regionTypeNames_.get("regionType", dict)),
    operation_(operationTypeNames_.get("operation", dict)),
    postOperation_
    (
        postOperationTypeNames_.getOrDefault
        (
            "postOperation",
            dict,
            postOperationType::postOpNone,
            true  // Failsafe behaviour
        )
    ),
    weightFieldName_("none"),
    needsUpdate_(true),
    writeArea_(false),
    totalArea_(0),
    nFaces_(0),
    faceId_(),
    facePatchId_(),
    faceFlip_()
 {
    writeFileHeader(file());
    read(dict);
}
tecmul is offline   Reply With Quote

Old   Today, 07:31
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: http://olesenm.github.io/
Posts: 1,055
Rep Power: 27
olesen will become famous soon enougholesen will become famous soon enough
Quote:
Originally Posted by tecmul View Post
This resolves the issue for me on OpenFoam-v2006.

Create a copy of the surfaceFieldValue function object and inside the implementation file, comment out the line

writeFileHeader(file());
This is horrible. If the problem still occurs with latest maintenance branch of v2006 (currently master) please file a bug report on the issue tracker and let's get it fixed properly.
https://develop.openfoam.com/Develop...nfoam/-/issues
olesen is offline   Reply With Quote

Old   Today, 13:15
Default
  #5
Member
 
Join Date: Sep 2018
Posts: 34
Rep Power: 4
tecmul is on a distinguished road
Quote:
Originally Posted by olesen View Post
This is horrible. If the problem still occurs with latest maintenance branch of v2006 (currently master) please file a bug report on the issue tracker and let's get it fixed properly.
https://develop.openfoam.com/Develop...nfoam/-/issues
So I searched in the bug reports and came upon this.
https://develop.openfoam.com/Develop.../-/issues/1556
Apparently, this is by design in cases with a dynamic or topologically changing mesh and can be disabled with the "updateHeader" keyword, which defaults to true.

I know user-friendliness is against OpenFoam's design philosophy but it would still be nice if the surfaceFieldValue header file mentioned this.
tecmul is offline   Reply With Quote

Old   Today, 14:46
Default
  #6
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: http://olesenm.github.io/
Posts: 1,055
Rep Power: 27
olesen will become famous soon enougholesen will become famous soon enough
Quote:
Originally Posted by tecmul View Post
So I searched in the bug reports and came upon this.
https://develop.openfoam.com/Develop.../-/issues/1556
Apparently, this is by design in cases with a dynamic or topologically changing mesh and can be disabled with the "updateHeader" keyword, which defaults to true.

I know user-friendliness is against OpenFoam's design philosophy but it would still be nice if the surfaceFieldValue header file mentioned this.

Fair enough but sometimes things do get forgotten, or are difficult to find. For these cases it would be best to flag it as an issue. Lamenting about the problem here is perfectly OK, but it increases the probability of things getting fixed if you report them. I've open this issue
https://develop.openfoam.com/Develop...am/issues/1942
olesen is offline   Reply With Quote

Reply

Tags
fieldfunctionobjects, headers, postprocessing, surfacefieldvalue, xienginefoam

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
Add a stop criteria for an unsteady multiphase simulation Jeneas OpenFOAM Pre-Processing 0 May 18, 2018 10:22
How to stop transient simulation which has been run from scheme script? AlexanderZ FLUENT 8 August 31, 2017 05:25
Transient DPM-About Start Stop times Julie FLUENT 3 January 24, 2014 08:39
command TUI / Scheme for stop and continue calculate rayolau FLUENT 1 May 13, 2013 11:20
compiling firefoam Farshad_Noravesh OpenFOAM 27 December 24, 2012 05:21


All times are GMT -4. The time now is 15:45.