|
[Sponsors] |
[swak4Foam] How to read in fields from previous time-steps in swak4foam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 21, 2016, 19:27 |
How to read in fields from previous time-steps in swak4foam
|
#1 |
Member
Sami
Join Date: Nov 2012
Location: Cap Town, South Africa
Posts: 87
Rep Power: 13 |
Hi Foamers,
I am trying to build a groovyBC in which I need the average of the velocity (and pressure) field at the last output time. Do you have an idea how can I read or access the velocity field at the previous output time ? I know that I can use "oldTime(p)" for the last time step (=/= last output time). Thank you for your help. Mhrz |
|
March 22, 2016, 14:11 |
|
#2 |
Member
Sami
Join Date: Nov 2012
Location: Cap Town, South Africa
Posts: 87
Rep Power: 13 |
I found that using "swak4Foam", I can read a field of the previous time step: oldTime(fieldName) but nothing to read the previous output time.
Mhrz |
|
April 5, 2016, 05:56 |
How to read in fields from previous time-steps in swak4foam
|
#3 |
Member
Join Date: Jun 2015
Posts: 30
Rep Power: 10 |
Hi,
Let's assume we have solved a transient scalar transport equation. Now for each time-step we want to evaluated the following global quantity (sort of an average of the entire field variable, so we end up with a scalar): Now the issue is how i can read in the initial field , and in a more general context any of the previous time-steps? Also a side-note that assuming I just have the following to compute: I was thinking of putting the code like: Code:
Index { type swakExpression; valueType internalField; variables ( "Tmean = 0.05;" ); accumulations ( sum ); expression "mag(T-Tmean)*vol()"; verbose true; outputControlMode timeStep; outputInterval 1; } Code:
Parser Error for driver FieldValueExpressionDriver at "1.7-11" :"field Tmean not existing or of wrong type" Best Ali |
|
April 10, 2016, 17:17 |
|
#4 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
Quick answer: Tested with OpenFOAM 3.0.x, tutorial case "heatTransfer/buoyantSimpleFoam/circuitBoardCooling":
Code:
libs ("libthermalBaffleModels.so" "libOpenFOAM.so" "libsimpleFunctionObjects.so" "libsimpleSwakFunctionObjects.so"); functions { Index { type swakExpression; valueType internalField; variables ("Tmean=0.05;"); accumulations ( sum ); expression "mag(T-Tmean)*vol()"; verbose true; outputControlMode timeStep; outputInterval 1; } }
__________________
|
|
April 11, 2016, 09:40 |
|
#5 |
Member
Join Date: Jun 2015
Posts: 30
Rep Power: 10 |
Thanks a lot Bruno!
Completely overlooked that I was also wondering if you would know how I can read-in the initial field , and well perhaps more generally previous time-step solutions, as I've indicated in the early part of my post. Best Ali |
|
April 13, 2016, 05:22 |
|
#6 |
Member
Join Date: Jun 2015
Posts: 30
Rep Power: 10 |
So can anyone suggest on how I can read-in previous time-steps solution into swak4foam?
Thanks Ali |
|
April 15, 2016, 19:45 |
|
#7 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
Quick answer: swak4Foam has a function known as "oldTime". Some details and examples are available here: http://www.cfd-online.com/Forums/ope...ormations.html - there you'll also find a few tricks on how to store fields from previous times.
But as demonstrated in that thread, you cannot easily store/retrieve the field for any specific time step. You will need to do some clever gradual storage of values, so that you can continuously update only for the current time step, while accounting only for the previous accumulated values.
__________________
|
|
April 19, 2016, 13:00 |
|
#8 |
Member
Sami
Join Date: Nov 2012
Location: Cap Town, South Africa
Posts: 87
Rep Power: 13 |
Thank you for participating in this tread.
The swak4Foam "storedVariables" is a good way to use the old fields averages but there is a bug when using it in parallel. Regards, Mhrz |
|
May 24, 2016, 16:36 |
|
#9 |
Member
Sami
Join Date: Nov 2012
Location: Cap Town, South Africa
Posts: 87
Rep Power: 13 |
Any idea ?
Thanks, Mhrz |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
pimpleDyMFoam computation randomly stops | babapeti | OpenFOAM Running, Solving & CFD | 5 | January 24, 2018 05:28 |
How to export time series of variables for one point? | mary mor | OpenFOAM Post-Processing | 8 | July 19, 2017 10:54 |
Read and average fields over different time steps | yanyanh | OpenFOAM Running, Solving & CFD | 0 | September 24, 2014 09:32 |
mixerVesselAMI2D's mass is not balancing | sharonyue | OpenFOAM Running, Solving & CFD | 6 | June 10, 2013 09:34 |