|
[Sponsors] |
June 18, 2020, 15:49 |
How to use argList::addOption correctly?
|
#1 |
New Member
Ziqu Cao
Join Date: Aug 2019
Location: The University of Glasgow
Posts: 10
Rep Power: 0 |
Hi,
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 Code:
int main(int argc, char *argv[]) { Foam::timeSelector::addOptions(); #include "addRegionOption.H" Foam::argList::addBoolOption ( "noWrite", "suppress writing results" ); #include "addDictOption.H" Foam::argList::addOption ( "fieldName", "name", "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" ... Code:
#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; } else { FatalErrorIn("vorticity::calc") << "fieldName option must be used with this tool" << nl << exit(FatalError); } --> FOAM FATAL ERROR: 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. |
|
Tags |
post procesing |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM] How to correctly show the result of #codeStream# internalField? | chengdi | ParaView | 24 | July 14, 2022 05:26 |
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 |