|
[Sponsors] |
[swak4Foam] Trouble accessing fields within expressionField |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 20, 2016, 08:47 |
[swak4Foam] Trouble accessing fields within expressionField
|
#1 |
Member
Join Date: Mar 2009
Posts: 90
Rep Power: 17 |
Hello all,
I am trying to use swak4foam to calculate a velocity field (based on position in the mesh), and this works great! But then I try to add that velocity field to the UMean field calculate by OpenFOAM 2.4.0, using the following controlDict entry: Code:
UCalc { after $monStart; type expressionField; outputControlMode outputTime; outputInterval $endTime; fieldName UCalc; dimension [ 0 1 -1 0 0 0 0 ]; expression "UMean + Urot"; autowrite true; } Code:
Creating expression field Urot ... type:volVectorField [13] [13] [13] --> FOAM FATAL ERROR: [13] Parser Error for driver FieldValueExpressionDriver at "1.1-5" :"field UMean not existing or of wrong type" "UMean + Urot" ^^^^^ --| Context of the error: - Driver constructed from scratch Evaluating expression "UMean + Urot" [13] [13] [13] From function parsingValue [13] in file lnInclude/CommonValueExpressionDriverI.H at line 1189. [13] FOAM parallel run exiting |
|
January 31, 2016, 15:00 |
|
#2 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Quick questions:
__________________
|
|
February 1, 2016, 05:15 |
|
#3 |
Member
Join Date: Mar 2009
Posts: 90
Rep Power: 17 |
||
February 21, 2016, 15:06 |
|
#4 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Quick answer: Sorry, but only today did I managed to come back to your problem.
OK, I believe that the problem is because you need to use a function object that loads the field after it's saved. For example: Code:
readFields { // Where to load it from (if not already in solver) functionObjectLibs ("libfieldFunctionObjects.so"); type readFields; fields (UMean); } The other solution is to use swak4Foam's own function object for calculating the "UMean" field.
__________________
|
|
June 10, 2016, 02:46 |
|
#5 | |
Member
Matt
Join Date: Oct 2012
Posts: 39
Rep Power: 14 |
Quote:
Here is what I am working with: Code:
... functions { cubeUx { type expressionField; dimension [0 3 -3 0 0 0 0]; fieldName "cubeUx"; expression "pow(U.x,3)"; verbose true; autowrite false; outputControl timeStep; } fieldAverage1 { type fieldAverage; functionObjectLibs ( "libfieldFunctionObjects.so" ); enabled true; outputControl outputTime; fields ( U { mean on; prime2Mean on; base time; } p { mean on; prime2Mean on; base time; } cubeUx { mean on; prime2Mean off; base time; } ); } readFields { functionObjectLibs ("libfieldFunctionObjects.so"); type readFields; fields (cubeUxMean); } skewnessX { type expressionField; dimension [0 3 -3 0 0 0 0]; fieldName "skewnessX"; expression "(cubeUxMean-3*UMean.x*UPrime2Mean.xx-pow(UMean.x,3))/pow(UPrime2Mean.xx,1.5)"; verbose true; autowrite true; outputControl timeStep; } } libs ( "libOpenFOAM.so" "libsimpleFunctionObjects.so" "libsimpleSwakFunctionObjects.so" "libswakFunctionObjects.so" ); |
||
May 12, 2017, 11:34 |
|
#6 |
New Member
David Kinast
Join Date: Nov 2016
Posts: 15
Rep Power: 9 |
Hi,
rigth now I have the same problem. readFields and also reading the Field with the solver does not solve that in OpenFOAM 4.1 |
|
May 12, 2017, 16:02 |
|
#7 | |
Member
Matt
Join Date: Oct 2012
Posts: 39
Rep Power: 14 |
Quote:
https://www.cfd-online.com/Forums/op...tml#post616247 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Accessing neighbor cells fields | antoniofct | OpenFOAM Programming & Development | 7 | May 3, 2021 04:14 |
Accessing Mesh, Fields in Foam::sixDoFRigidBodyMotionRestraints::linearSprin g | kumar2 | OpenFOAM Programming & Development | 3 | August 4, 2014 17:06 |
a reconstructPar issue | immortality | OpenFOAM Post-Processing | 8 | June 16, 2013 12:25 |
an odd(at least for me!) reconstructPar error on a field | immortality | OpenFOAM Running, Solving & CFD | 3 | June 3, 2013 23:36 |
PostChannel | maka | OpenFOAM Post-Processing | 5 | July 22, 2009 10:15 |