|
[Sponsors] |
[swak4Foam] PostProcessing for finished calculation |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
Felix S
Join Date: Jun 2017
Posts: 11
Rep Power: 9 ![]() |
Hi All,
I am wondering if it is possible to use the swak4Foam functionality for an already finished simulation. I defined this Testfunction in my controlDict: Code:
functions { Testfunction { type swakExpression; valueType patch; patchName interface_name; outputControlMode outputTime; variables ( "Profil=sum(sqrt(pow(U.x*area(),2)+pow(U.y*area(),2)+pow((U.z-4.5129)*area(),2)))/sum(area());" ); accumulations ( average ); expression "Profil"; verbose true; writeStartTime no; autoInterpolate true; warnAutoInterpolate false; outputInterval 5000; } } Now I want to change the "Profil"-function and since I am only interested in the converged solution I only need to evaluate the function for my last timestep (5000). 1) Is there a way I can use the postProcess utility with swak4foam? Code:
postProcess -fields '(U p)' -time 5000 2) Is there a way I can use the sample utility with swak4foam? When I create a sampleDict with the function "Testfunction" (+ adding "libs ("libsampling.so");") and use Code:
postProcess -func sampleDict Code:
keyword type is undefined in dictionary ".functions.sampleDict" Code:
Testfunction2 { type expressionField; outputInterval 5000; pName p; Uname U; variables ( "BM=0;" "XM=pos().x+BM;" "thetaAngle=(XM!=0) ? acos(XM/sqrt(pow(XM,2)+pow(pos().y,2)))*pos().y/mag(pos().y) : ((pos().y>0) ? 0 : 3.1416);" ); fieldName Test; dimension [0 1 -1 0 0 0 0]; expression "-U.x*sin(thetaAngle)+U.y*cos(thetaAngle)"; autowrite true; } Code:
Parser Error for driver FieldValueExpressionDriver at "1.2" :"field U not existing or of wrong type" |
|
![]() |
![]() |
![]() |
![]() |
#2 |
New Member
Felix S
Join Date: Jun 2017
Posts: 11
Rep Power: 9 ![]() |
Seems like I didn't read enough before asking...
Maybe it is still usefull to somebody else ![]() The funkyDoCalc utility does exactly what I was looking for. Thanks to: http://openfoamwiki.net/images/2/2a/...esentation.pdf (page 111) and https://www.cfd-online.com/Forums/op...nkydocalc.html Create a i.e. "postDict" (file like Code:
Testfunction { type swakExpression; valueType patch; patchName interface_name; variables ( "Profil=sum(sqrt(pow(U.x*area(),2)+pow(U.y*area(),2)+pow((U.z-4.5129)*area(),2)))/sum(area());" ); accumulations ( average ); expression "Profil"; verbose true; writeStartTime no; autoInterpolate true; warnAutoInterpolate false; autowrite true; } Code:
funkyDoCalc -time 5000: postDict -writeCsv And I am still confused why the "postProcess" utility isn't doing the same jobs. In the post I mentioned above the "execFlowFunctionObjects" command is described as doing nearly the same, but for my OF version (2.0) it says that Code:
execFlowFunctionObjects has been superseded by the '-postProcess' solver command-line option, e.g. simpleFoam -help -postProcess Not all questions answered, but that is all I need for my case at the moment. |
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
Felix S
Join Date: Jun 2017
Posts: 11
Rep Power: 9 ![]() |
I found a solution for my problems by the funkyDoCalc command. I probably just didn't search long enough, but maybe this helps someone else.
Solution: http://openfoamwiki.net/images/2/2a/...esentation.pdf (page 111) https://www.cfd-online.com/Forums/op...nkydocalc.html I created a "postDict" file Code:
Testfunction { type swakExpression; valueType patch; patchName interface_name; variables ( "Profil=sum(sqrt(pow(U.x*area(),2)+pow(U.y*area(),2)+pow((U.z-4.5129)*area(),2)))/sum(area());" ); accumulations ( average ); expression "Profil"; verbose true; writeStartTime no; autoInterpolate true; warnAutoInterpolate false; autowrite true; } Code:
funkyDoCalc -time 5000: postDict -writeCsv I am still confused why the funkyDoCalc isn't working for expressionsFields. I still don't understand the postProcess utilty. In the post that I mentioned above, the execFlowFunctionObjects is described and that it might help. Problem is that in my OpenFOAM (Version 2.0) the execFlowFunctionObjects command give: Code:
execFlowFunctionObjects has been superseded by the '-postProcess' solver command-line option, e.g. simpleFoam -help -postProcess Last edited by CFDelix; December 21, 2017 at 09:07. Reason: forgot something in the code |
|
![]() |
![]() |
![]() |
![]() |
#4 |
New Member
Hungary (Ungarn)
Join Date: Sep 2017
Posts: 16
Rep Power: 8 ![]() |
Dear Felix.
It happened, that I'm having the same issue as you, trying to use swak4Foam functions after simulation. But in my case I am trying to use the swakExpressionAverageDistribution function. Have you got any idea how it should look like? What I tried this far is the following: Function { type swakExpressionAverageDistribution; libs ( "libOpenFOAM.so" "libsimpleSwakFunctionObjects.so" "libswakFunctionObjects.so" "libgroovyBC.so" ); writeStartTime no; valueType internalField; expression "T"; verbose true; weight "vol()"; mask "1"; abscissa "pos().z"; dynamicExtremesAbscissa false; minAbscissa 0; maxAbscissa 150; binNumber 75; valueIfZero 0; accumulations ( average ); } But this turned out with an error messege which I can not solve: --> FOAM FATAL ERROR: The expected return type bool is different from the stored result type "scalar" From function tmp<Field<Type> > ExpressionResult::getResult() in file ../../Libraries/swak4FoamParsers/lnInclude/ExpressionResultI.H at line 250. FOAM exiting Thanks, Gábor |
|
![]() |
![]() |
![]() |
![]() |
#5 |
New Member
Felix S
Join Date: Jun 2017
Posts: 11
Rep Power: 9 ![]() |
The postDict file needs to be in the main (simulation) folder not within your system folder. (So that it is on the same folder level as your system folder.)
Maybe that will solve your problem. Otherwise it would be helpful if you post your PostDict file and your folderstructure. |
|
![]() |
![]() |
![]() |
![]() |
#6 |
New Member
Hungary (Ungarn)
Join Date: Sep 2017
Posts: 16
Rep Power: 8 ![]() |
Thanks Felix.
I have solved that problem succesfully, but on the meantime I edited the question above for an other problem which is now actual. I would be thankfull is you could take a look at that. Thanks, Gábor |
|
![]() |
![]() |
![]() |
![]() |
#7 |
New Member
Felix S
Join Date: Jun 2017
Posts: 11
Rep Power: 9 ![]() |
I haven't used swakExpressionAverageDistribution myself so I am not sure how to use it correctly.
I get the same error though. Maybe you could use swakExpression and define your own "expression" for the averaging operation you want to do. |
|
![]() |
![]() |
![]() |
![]() |
#8 |
New Member
Felix S
Join Date: Jun 2017
Posts: 11
Rep Power: 9 ![]() |
Ok apparently the "mask "1";" is causing trouble.
Code:
averagePressureDistributionX { type swakExpressionAverageDistribution; verbose true; outputControlMode outputTime; valueType internalField; expression "p"; weight "vol()"; mask "p<1"; abscissa "pos().x"; binNumber 50; valueIfZero -100; accumulations ( max ); } |
|
![]() |
![]() |
![]() |
![]() |
#9 |
New Member
Hungary (Ungarn)
Join Date: Sep 2017
Posts: 16
Rep Power: 8 ![]() |
I applied what you have suggested, and luckily I also got something as a result.
It seems like process, but as I see it correct, it is an average (or max/min) of the whole domain, and what is needed, is a list of these averages at different i.e "pos().z". It seems like it do not handle this part: abscissa "pos().z"; dynamicExtremesAbscissa false; minAbscissa 0; maxAbscissa 150; binNumber 10; Have you got any idea? |
|
![]() |
![]() |
![]() |
![]() |
#10 |
New Member
Felix S
Join Date: Jun 2017
Posts: 11
Rep Power: 9 ![]() |
Since I am not familiar with swakExpressionAverageDistribution I would change the example I mentioned above for different surfaces.
You should check some examples (i.e. https://github.com/wyldckat/swak4foa...stCalculations) One example for a surface plane: Code:
surfacePlane{type swakExpression;valueType surface;surfaceName testPlane;surface {type plane;basePoint (0 0 0);normalVector (0 0 1);interpolate false;}verbose true;expression "mag(U)";accumulations (minmax); Code:
expression "sum(p*area())/sum(area())"; |
|
![]() |
![]() |
![]() |
![]() |
#11 | |
Senior Member
Join Date: Jul 2019
Posts: 148
Rep Power: 7 ![]() |
Quote:
|
||
![]() |
![]() |
![]() |
![]() |
#12 |
Member
Eren
Join Date: Aug 2018
Posts: 86
Rep Power: 9 ![]() |
Umm, is it possible to use funkyDoCalc for all* timeSteps? My simulation stopped due to power outage and when I restart simulation (dumb mistake, it started from timeStep 1) all my postProcess data overwriten. And It is really pain to do 1020(timesteps) "funkyDoCalc". When I use "noZero" for time, it gaves me same values for all timeSteps...
Code:
Time = 570 local : weightedAverage=30.85399601 bulk : weightedAverage=301.8301434 Time = 575 local: weightedAverage=30.85399601 bulk : weightedAverage=301.8301434 Last edited by ErenC; November 27, 2020 at 11:43. |
|
![]() |
![]() |
![]() |
![]() |
#13 |
Member
Eren
Join Date: Aug 2018
Posts: 86
Rep Power: 9 ![]() |
I also happened to realise when I use
Code:
funkyDoCalc -time '5,10,20' avgs Code:
Time = 5 fraction : swak4Foam: Setting default mesh swak4Foam: Allocating new repository for sampledMeshes swak4Foam: Allocating new repository for sampledGlobalVariables average=0.01949977306 Time = 10 fraction : average=0.01949977306 Time = 20 fraction : average=0.01949977306 End |
|
![]() |
![]() |
![]() |
![]() |
#14 |
Member
Eren
Join Date: Aug 2018
Posts: 86
Rep Power: 9 ![]() |
@gschaider I still couldnt fix the problem in last entry. Could it be a bug for OF2006? (also -time 5:600 is giving me same values for all timesteps)
Last edited by ErenC; December 14, 2020 at 02:45. |
|
![]() |
![]() |
![]() |
![]() |
#15 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 ![]() ![]() |
Quote:
I'll have a look but don't hold your breath (end-of-year project rush etc)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
![]() |
![]() |
![]() |
![]() |
#16 |
Member
Eren
Join Date: Aug 2018
Posts: 86
Rep Power: 9 ![]() |
||
![]() |
![]() |
![]() |
Tags |
postprocessing, sampledict, swak4foam, swakexpression |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic mesh adaption in parallel calculation | xh110120 | FLUENT | 1 | March 12, 2016 08:05 |
Determining the calculation sequence of the regions in multe regions calculation | peterhess | OpenFOAM Running, Solving & CFD | 4 | March 9, 2016 03:07 |
MRF and Heat transfer calculation | Susan YU | FLUENT | 0 | June 2, 2010 08:46 |
Warning 097- | AB | Siemens | 6 | November 15, 2004 04:41 |
Heat Flux Calculation under REPORTS | Alberto Schroth | FLUENT | 0 | May 16, 2000 08:19 |