CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   postProcessing - want to stop the headers repeating in surfaceFieldValue.dat (https://www.cfd-online.com/Forums/openfoam-post-processing/227989-postprocessing-want-stop-headers-repeating-surfacefieldvalue-dat.html)

namsivag June 16, 2020 07:46

postProcessing - want to stop the headers repeating in surfaceFieldValue.dat
 
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;
}


mwmalkawi July 29, 2020 17:14

Hi


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





Thanks

tecmul November 28, 2020 12:04

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);
}


olesen November 29, 2020 06:31

Quote:

Originally Posted by tecmul (Post 789178)
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

tecmul November 29, 2020 12:15

Quote:

Originally Posted by olesen (Post 789252)
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.

olesen November 29, 2020 13:46

Quote:

Originally Posted by tecmul (Post 789285)
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

tecmul November 29, 2020 16:25

Quote:

Originally Posted by olesen (Post 789294)
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.

Alright then, you have inspired me to complai...file reports on some issues I found with the rigid body dynamics library.


All times are GMT -4. The time now is 18:24.