CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

How to use argList::addOption correctly?

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

LinkBack Thread Tools Search this Thread Display Modes
Old   June 18, 2020, 15:49
Default How to use argList::addOption correctly?
New Member
Ziqu Cao
Join Date: Aug 2019
Location: The University of Glasgow
Posts: 10
Rep Power: 4
Kevin Cao is on a distinguished road

I use OpenFOAM-2.4.0-MNF to add a new usage option in my user defined utility based on vorticity. The make/options file of my utility is the same as the one of vorticity.
As the make/options file in vorticity has been linked to postCalc so I just go into postCalc.C and add Foam::argList::addOption
Here is part of the code in postCalc.C
int main(int argc, char *argv[])

    #include "addRegionOption.H"
        "suppress writing results"
    #include "addDictOption.H"
        "specify a fieldName for the velocity"
        "example: -fieldName N2"
    #include "setRootCase.H"
    #include "createTime.H"
    Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args);
    #include "createNamedMesh.H"
Here is part of the code of my utility

#include "calc.H"
#include "fvc.H"
#include "argList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
    bool writeResults = !args.optionFound("noWrite");
    word fieldName;
    if (args.optionFound("fieldName"))
        args.optionLookup("fieldName")() >> fieldName;
        << "fieldName option must be used with this tool"
        << nl
        << exit(FatalError);
The utility and postCalc.C are all compiled successfully but when I use it, it shows:
Invalid option: -fieldName

I also put argList::addOption part into my utility but it still does not work

What did I miss? Can anyone help me please?

Thanks in advance.
Kevin Cao is offline   Reply With Quote


post procesing

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
[OpenFOAM] How to correctly show the result of #codeStream# internalField? chengdi ParaView 22 July 3, 2020 08:02
How to correctly use cyclic BCs ? Roxxor91 OpenFOAM Running, Solving & CFD 0 September 30, 2019 18:24
SIMPLER Code Temperatures not coming correctly Dharma Vedula Main CFD Forum 5 July 5, 2017 22:34
SU2 optimization does not work correctly with CGNS format Andrei SU2 Shape Design 1 April 22, 2016 11:35
interFoam running blowing up sandy13 OpenFOAM Running, Solving & CFD 2 May 5, 2015 08:16

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