|
[Sponsors] |
[swak4Foam] PostProcessing for finished calculation |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 8, 2017, 04:04 |
PostProcessing for finished calculation
|
#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" |
|
December 21, 2017, 09:19 |
Problem solved by funkyDoCalc
|
#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. |
|
December 21, 2017, 10:05 |
Solved by funkyDoCalc
|
#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 10:07. Reason: forgot something in the code |
|
March 23, 2018, 08:43 |
funkyDoCalc error
|
#4 |
New Member
Hungary (Ungarn)
Join Date: Sep 2017
Posts: 16
Rep Power: 9 |
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 |
|
March 23, 2018, 09:20 |
|
#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. |
|
March 23, 2018, 09:27 |
|
#6 |
New Member
Hungary (Ungarn)
Join Date: Sep 2017
Posts: 16
Rep Power: 9 |
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 |
|
March 23, 2018, 10:11 |
|
#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. |
|
March 23, 2018, 10:15 |
|
#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 ); } |
|
March 23, 2018, 14:09 |
|
#9 |
New Member
Hungary (Ungarn)
Join Date: Sep 2017
Posts: 16
Rep Power: 9 |
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? |
|
March 26, 2018, 05:57 |
|
#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())"; |
|
November 3, 2020, 12:45 |
|
#11 | |
Senior Member
Join Date: Jul 2019
Posts: 148
Rep Power: 7 |
Quote:
|
||
November 27, 2020, 10:09 |
|
#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 12:43. |
|
November 27, 2020, 15:12 |
|
#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 |
|
December 13, 2020, 06:23 |
|
#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 03:45. |
|
December 15, 2020, 15:31 |
|
#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 |
||
December 16, 2020, 07:49 |
|
#16 |
Member
Eren
Join Date: Aug 2018
Posts: 86
Rep Power: 9 |
||
Tags |
postprocessing, sampledict, swak4foam, swakexpression |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic mesh adaption in parallel calculation | xh110120 | FLUENT | 1 | March 12, 2016 09:05 |
Determining the calculation sequence of the regions in multe regions calculation | peterhess | OpenFOAM Running, Solving & CFD | 4 | March 9, 2016 04:07 |
MRF and Heat transfer calculation | Susan YU | FLUENT | 0 | June 2, 2010 09:46 |
Warning 097- | AB | Siemens | 6 | November 15, 2004 05:41 |
Heat Flux Calculation under REPORTS | Alberto Schroth | FLUENT | 0 | May 16, 2000 09:19 |