OPENFOAM中有些后处理工具是否只能在计算时运行,计算完毕后无法运行?
-
今天在一个算例算完之后试图用fieldAverage工具计算UMean,发现openfoam4.x中提供的模板是把它全部写在了controlDict文件下的functions下面了。。由于我已经计算完毕,所以在system下建了一个fieldAverage文件,controlDict下用#includeFunc fieldAverage挂载,如下:
// Type of functionObject type fieldAverage; // Where to load it from (if not already in solver) libs ("libfieldFunctionObjects.so"); // Function object enabled flag enabled true; // When to output the average fields writeControl adjustableRunTime; writeInterval 0.001; // Fields to be averaged - runTime modifiable fields ( U { mean on; prime2Mean off; base time; window 20; // 当设定window为一正整数w时,输出的时均值是当前时间步以及其之前w-1步,这w步内Field的时均值 } );
而此时输入postProcess -func fieldAverage时会报这种错误(PS:采用#includeFunc挂载的方式即使边算边输出也会出现这个错误):
--> FOAM FATAL IO ERROR: wrong token type - expected word, found on line 18 the punctuation token '{' file: /home/dyfluid/tutorials/incompressible/pimpleFoam/pitzDaily/system/fieldAverage.fields at line 18. From function Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::word&) in file primitives/strings/word/wordIO.C at line 74. FOAM exiting
看上去是说U后面不应该是{ ,但事实上,openfoam给出的模板里这个地方就是这么写的,并且我把system下面的fieldAverage文件中的code复制到controlDict下面,边算边处理的话,完美运行。。但是如果再用postProcess -func fieldAverage的方式,这段程序不会被运行,原因是:
--> FOAM Warning : From function static bool Foam::functionObjectList::readFunctionObject(const Foam::string&, Foam::dictionary&, Foam::HashSet<>&, const Foam::word&) in file db/functionObjects/functionObjectList/functionObjectList.C at line 245 Cannot find functionObject file fieldAverage
那么,是否表明这个后处理工具不能在计算完成后运行?
如果可以,那应该怎么做呢。。
跪求大神指教! -
@东岳 东岳前辈,这样貌似没有用,还是之前的错误
-
@东岳 东岳前辈您好,现在的情况是程序(twoPhaseEulerFoam)已经运行结束,我想对整个床层计算孔隙率,在system文件下system下建了一个volFieldValue文件,controlDict下用#includeFunc volFieldValue挂载,运行postProcess -func volFieldValue后提示:
--> FOAM Warning :
From function static bool Foam::functionObjectList::readFunctionObject(const Foam::string&, Foam::dictionary&, Foam::HashSet<>&, const Foam::word&)
in file db/functionObjects/functionObjectList/functionObjectList.C at line 278
Cannot find functionObject file volFieldValue
但是如果在controlDIct中按照上述您写的进行添加,并重新运行算例,可以得到想要的结果。
所以问题是如果程序运行结束后,如何通过postProcess处理得到床层平均空隙率? -
@李东岳 我这试了下system下创建fieldAverage文件并复制上述代码,删掉functions和fieldAverage1可以计算完成后处理,controDict不需要挂载,完整的文件内容如下
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 9 \\/ M anipulation | ------------------------------------------------------------------------------- Description Calculates and writes the time averages of given list of fields. \*---------------------------------------------------------------------------*/ type fieldAverage; libs ( "libfieldFunctionObjects.so" ); writeControl writeTime; timeStart 0; timeEnd 100; resetOnOutput false; fields ( U { mean on; prime2Mean on; base time; } );