|
[Sponsors] |
April 21, 2021, 00:39 |
Mean of a functionObject field
|
#1 |
New Member
Marc
Join Date: Oct 2017
Posts: 11
Rep Power: 9 |
Hi All,
I would like to get a mean value of a field that is is calculated with a function object. However, this is resulting in a error, I think because the function object field is not initialized at the beginning of the simulation. For simplicity I have recreated the error with a modified version of the channel935 case. My modified controlDict for this case is as follows: Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 6 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object controlDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // application pimpleFoam; startFrom latestTime; startTime 0; stopAt endTime; endTime 20; deltaT 0.2; writeControl timeStep; writeInterval 10; purgeWrite 0; writeFormat ascii; writePrecision 6; writeCompression off; timeFormat general; timePrecision 6; runTimeModifiable true; functions { fieldAverage1 { type fieldAverage; libs ("libfieldFunctionObjects.so"); writeControl writeTime; fields ( U { mean on; prime2Mean on; base time; } p { mean on; prime2Mean on; base time; } dp { mean on; prime2Mean off; base time; } ); } gradU { type grad; libs ("libfieldFunctionObjects.so"); field p; result dp; writeControl writeTime; } } // ************************************************************************* // Code:
[0] --> FOAM FATAL ERROR: [0] request for volVectorField dpMean from objectRegistry region0 failed available objects of type volVectorField are 5 ( U_0 U UMean U_0_0 dp ) [0] [0] [0] From function const Type& Foam::objectRegistry::lookupObject(const Foam::word&) const [with Type = Foam:: GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>] [0] in file /home/ubuntu/OpenFOAM/OpenFOAM-7/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 193. [0] FOAM parallel run aborting |
|
April 21, 2021, 04:44 |
|
#2 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29 |
Hi Marc,
Have you tried switching the two functions, i.e. calculating dp first, then doing the fieldAverage ? Yann |
|
April 21, 2021, 10:04 |
|
#3 |
New Member
Marc
Join Date: Oct 2017
Posts: 11
Rep Power: 9 |
That indeed was the issue. Thank you for the suggestion!
Everything is calculated correctly if I revise the controlDict function order to the following: Code:
functions { gradp { type grad; libs ("libfieldFunctionObjects.so"); field p; result dp; writeControl writeTime; } fieldAverage1 { type fieldAverage; libs ("libfieldFunctionObjects.so"); writeControl writeTime; //timeStart 4; fields ( U { mean on; prime2Mean on; base time; } p { mean on; prime2Mean on; base time; } dp { mean on; prime2Mean off; base time; } ); } } |
|
Tags |
function objects, mean values |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Error: "Source airToporous defined for field h but never used" | Utkan | OpenFOAM Running, Solving & CFD | 2 | April 6, 2022 09:23 |
Cannot find functionObject file residuals | vava10 | OpenFOAM Pre-Processing | 2 | November 14, 2020 13:21 |
Averaging a field created by a functionObject | me3840 | OpenFOAM Post-Processing | 2 | October 3, 2018 12:58 |
potential flows, helmholtz decomposition and other stuffs | pigna | Main CFD Forum | 1 | October 26, 2017 09:34 |
[General] How to create an additional vector with {Field 4, Field 5, Field 6} | Bombacar | ParaView | 1 | August 15, 2015 19:05 |