CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

customizing the meanVorticity utility

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

Like Tree1Likes
  • 1 Post By Zeppo

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 7, 2017, 00:43
Default customizing the meanVorticity utility
  #1
Senior Member
 
Join Date: Jan 2013
Posts: 134
Rep Power: 13
kkpal is on a distinguished road
Hi,
I am trying to calculate the vorticity of the mean velocity fields. So far what I have done to achieve this is to save the UMean file in another time directory as U and calculate the vorticity of this U with the built-in utility 'vorticity'.
This works good but not elegant.
I would like to customize a 'meanVorticity' utility that does the same thing as I have mentioned above. I anticipated that it would not be difficult since what I need to do is change the U with UMean in the original vorticity.C and then wmake.
However, it turns out that this is far more complicated than I had expected.
The meanVorticity.C file I modified is as follows:

Code:
#include "calc.H"
#include "fvc.H"

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

void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
{
    bool writeResults = !args.optionFound("noWrite");

    IOobject UMeanheader
    (
        "UMean",
        runTime.timeName(),
        mesh,
        IOobject::MUST_READ
    );

    if (Uheader.typeHeaderOk<volVectorField>(true))
    {
        Info<< "    Reading UMean" << endl;
        volVectorField UMean(UMeanheader, mesh);

        Info<< "    Calculating meanVorticity" << endl;
        volVectorField meanVorticity
        (
            IOobject
            (
                "meanVorticity",
                runTime.timeName(),
                mesh,
                IOobject::NO_READ
            ),
            fvc::curl(UMean)
        );

        volScalarField magMeanVorticity
        (
            IOobject
            (
                "magMeanVorticity",
                runTime.timeName(),
                mesh,
                IOobject::NO_READ
            ),
            mag(meanVorticity)
        );

        Info<< "meanVorticity max/min : "
            << max(magMeanVorticity).value() << " "
            << min(magMeanVorticity).value() << endl;

        if (writeResults)
        {
            meanVorticity.write();
            magMeanVorticity.write();
        }
    }
    else
    {
        Info<< "    No UMean" << endl;
    }

    Info<< "\nEnd\n" << endl;
}
And upon wmake after all the necessary modifications regarding 'file' and 'options' are finished, this piece of code gives me the following error:

Code:
meanVorticity.C:55:9: error: ‘Uheader’ was not declared in this scope
     if (Uheader.typeHeaderOk<volVectorField>(true))
         ^
meanVorticity.C:55:44: error: expected primary-expression before ‘>’ token
     if (Uheader.typeHeaderOk<volVectorField>(true))
                                            ^
make: *** [Make/linux64Gcc48DPOpt/meanVorticity.o] Error 1
It seems that something is wrong with the Uheader, and as a newbie to the programming in openfoam, I am stuck at this problem.

Could someone shed light on this problem? I attached the source code in here.
Attached Files
File Type: zip meanVorticity.zip (3.5 KB, 8 views)
kkpal is offline   Reply With Quote

Old   January 7, 2017, 12:45
Default
  #2
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21
Zeppo will become famous soon enough
Quote:
Originally Posted by kkpal View Post
Code:
    if (Uheader.typeHeaderOk<volVectorField>(true))
==>
Code:
    if (UMeanheader.typeHeaderOk<volVectorField>(true))
Zeppo is offline   Reply With Quote

Old   January 8, 2017, 13:06
Default
  #3
Senior Member
 
Join Date: Jan 2013
Posts: 134
Rep Power: 13
kkpal is on a distinguished road
Quote:
Originally Posted by Zeppo View Post
==>

Code:
    if (UMeanheader.typeHeaderOk<volVectorField>(true))


Thank you for pointing this out, Zeppo. But it still does not solve this problemIMG_1873.jpg


Sent from my iPhone using CFD Online Forum mobile app
kkpal is offline   Reply With Quote

Old   January 8, 2017, 15:07
Default
  #4
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21
Zeppo will become famous soon enough
Code:
if (Uheader.typeHeaderOk<volVectorField>(true))
==>
Code:
if (UMeanheader.headerOk())
kkpal likes this.
Zeppo is offline   Reply With Quote

Old   January 8, 2017, 23:13
Default
  #5
Senior Member
 
Join Date: Jan 2013
Posts: 134
Rep Power: 13
kkpal is on a distinguished road
Quote:
Originally Posted by Zeppo View Post
Code:
if (Uheader.typeHeaderOk<volVectorField>(true))
==>
Code:
if (UMeanheader.headerOk())
This worked! Thank you so much!
kkpal 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
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field lakeat OpenFOAM Community Contributions 58 December 23, 2021 03:36
Noise postprocessing utility setup RFlamm OpenFOAM Post-Processing 5 July 30, 2018 11:06
wallHeatFlux Calculation wrt utility version ahmet OpenFOAM Post-Processing 1 December 18, 2016 20:45
[mesh manipulation] mirrorMesh utility preserving regions zfaraday OpenFOAM Meshing & Mesh Conversion 1 November 7, 2016 22:51
Something doens't work with wallHeatFlux utility or externalWallHeatFluxTemperat BC!! zfaraday OpenFOAM Post-Processing 0 February 5, 2015 17:47


All times are GMT -4. The time now is 01:43.