|
[Sponsors] |
How to rename the field name in FunctionObject? |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Senior Member
|
For example, I use wallShearStress function object first then use mag , then get the field like
Code:
mag(wallShearStress) This is just an example. What I want is to control the output file name of the field obtained from FO. I know that U and p are created in the solver, but the fileds created in FO should be able to control by users. Also, how can I manipulate these derived fields, for example, how to calculate mag(U)*mag(U)/2 + p (energy head)? |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,290
Rep Power: 30 ![]() ![]() |
Hello,
I don't know which OpenFOAM branch/version you are using, so I'll answer for the OpenCFD branch (openfoam.com). I didn't check if it is also true on the foundation branch (openfoam.org). You can use the parameter result to define your own variable name: https://doc.openfoam.com/2306/tools/...cts/field/mag/ This parameter seems to be inherited from the fieldExpression class, so it should also be available in the other function objects using this class. The objects created by function objects are available in the database to be used in other function object, so you should be able to use the field computed by a function object in another function object. Depending on what you need to do, you can also have a look at the exprField function object to directly define the expression you need to compute: https://doc.openfoam.com/2306/tools/...eld/exprField/ I hope this will help you to find the information your need, Yann |
|
![]() |
![]() |
![]() |
![]() |
#3 | ||||
Senior Member
|
Hi Yann,
Thank you so much for your help! Quote:
Quote:
Quote:
Quote:
|
|||||
![]() |
![]() |
![]() |
![]() |
#4 | |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,290
Rep Power: 30 ![]() ![]() |
I'm glad it helped!
![]() Quote:
https://doc.openfoam.com/2306/tools/.../fieldAverage/ Cheers, Yann |
||
![]() |
![]() |
![]() |
![]() |
#5 |
Senior Member
|
Basically, I want to calculate the time averaged shear stress and rename it to TAWSS. Here is my dict:
Code:
// step 1: get wall shear stress tau { type wallShearStress; libs (fieldFunctionObjects); patches (wall); writeControl writeTime; } // step 2: get the magnitude of wall shear stress and rename it to mag_tau magwallShearStress { type mag; libs (fieldFunctionObjects); // Mandatory (inherited) entries (runtime modifiable) field wallShearStress; // Optional (inherited) entries result mag_tau; // rename mag(wallShearStress) to mag_tau region region0; enabled true; log true; timeStart 0; timeEnd 1000; executeControl timeStep; executeInterval 1; writeControl timeStep; writeInterval 1; writeFields true; } // step 3: get the time averaged wall shear stress, we'll get the field named "mag_tauMean" mean_tau { type fieldAverage; libs ("libfieldFunctionObjects.so"); timeStart 0; writeControl timeStep; writeInterval 1; writeFields no; fields ( wallShearStress { mean on; prime2Mean off; base time; // time average } ); } // step 4: manipulate mag_tauMean obtained in step 3. Here I only rename it but could do other thing. TAWSS1 { type exprField; libs (fieldFunctionObjects); writeControl timeStep; writeInterval 1; action new; // no, new(default), modify field TAWSS; readFields (mag_tauMean); autowrite true; //default: false store true; //default: true store on the object-registry // dimension [0 2 -2 0 0 0 0]; // note: mag_tauMean field looks good. expression "1000*mag_tauMean"; // dimension [Pa]; } Code:
dimensions [0 0 0 0 0 0 0]; internalField uniform 0; boundaryField { inlet { type zeroGradient; } inlet2 { type zeroGradient; } outlet { type zeroGradient; } wall { type zeroGradient; } procBoundary0to1 { type processor; value uniform 0; } procBoundary0to2 { type processor; value uniform 0; } procBoundary0to3 { type processor; value uniform 0; } procBoundary0to5 { type processor; value uniform 0; } } |
|
![]() |
![]() |
![]() |
![]() |
#6 | |
Senior Member
|
Quote:
|
||
![]() |
![]() |
![]() |
![]() |
#7 | |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,290
Rep Power: 30 ![]() ![]() |
Quote:
![]() |
||
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
functionObject to process field from scalarTransport, field not found | Tom Lauriks | Main CFD Forum | 6 | April 29, 2020 11:25 |
Access to field which is evaluated at the moment | Tobi | OpenFOAM Programming & Development | 6 | April 19, 2017 13:09 |
[General] How to create an additional vector with {Field 4, Field 5, Field 6} | Bombacar | ParaView | 1 | August 15, 2015 18:05 |
''unknown radialModelType type Gidaspow'' PROBLEM WITH THE BED TUTORIAL | AndoniBM | OpenFOAM Running, Solving & CFD | 2 | March 25, 2015 18:44 |
how to rename a field defined from others fields ? | Cyp | OpenFOAM Programming & Development | 2 | April 26, 2012 11:32 |