CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Read in "Mean" values during runTime

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 8, 2015, 10:38
Default Read in "Mean" values during runTime
  #1
New Member
 
Christoph Wenzel
Join Date: May 2014
Location: Germany
Posts: 21
Rep Power: 11
ChrisWe is on a distinguished road
Hey FOAMERS,

i want to calculate the Dissipation in OpenFOAM in my LES (pimpleFoam). Therefore I have to calculate <du'_i/dx_j * du'_i/dx_j>.
This value has to be averaged during runtime and so my solver needs the actual UPrime2Mean values of every time step.

In OpenFOAM-2.2.0 it is very easy to read in the averaged velocity fields. You only have to add the following code into your createFields.H of your solver:
Code:
 volVectorField UM
  (
  IOobject
  (
     "UMean",
     runTime.timeName(),
     mesh,
     IOobject::READ_IF_PRESENT,
     IOobject::AUTO_WRITE
  ),
     mesh,
     dimensionedVector("UM",dimLength/dimTime, vector::zero)
  );
When you compare UMean and UM, they are exactly the same (maybe deltaT shifted) and you can use UM in your solver.

When you do exactly the same in OpenFOAM-2.2.2 or OpenFOAM-2.3.0, UM will not be filled with the UMean values and UM will not be written in your timefolder.
OpenFOAM brings the following warning:

Code:
--> FOAM Warning : 
    From function GeometricField<Type, PatchField, GeoMesh>::readIfPresent()
    in file /home/iagwenze/opt/OpenFOAM/of230/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/GeometricField.C at line 108
    read option IOobject::MUST_READ or MUST_READ_IF_MODIFIED suggests that a read constructor for field UMean would be more appropriate.
Is there anybody who knows, why the presented code is not working anymore in OpenFOAM-2.2.2 or OpenFOAM-2.3.0?
Is there another possibility to read in Mean values to your solver?

Cheers,
Christoph

Last edited by ChrisWe; July 10, 2015 at 04:48.
ChrisWe is offline   Reply With Quote

Old   October 28, 2016, 14:40
Default i AM FACING SIMILAR PROBLEM
  #2
Member
 
Join Date: Oct 2013
Posts: 92
Rep Power: 12
fedvasu is on a distinguished road
Hi ChrisWe,

Did you solve this problem?

Or at least did you circumvent it?

Regards,
fedvasu is offline   Reply With Quote

Old   October 28, 2016, 15:34
Default
  #3
New Member
 
Christoph Wenzel
Join Date: May 2014
Location: Germany
Posts: 21
Rep Power: 11
ChrisWe is on a distinguished road
Hi,

I did not solve it in an elegant way, but as you mentioned, I circumvented it.
I do not exactly know how I solved it right know (I am not at my PC), but I created a new IOobject and calculated the average with some additional lines in my solver. Something like:
U_avg = U_avg * (timeSteps-1)/timeSteps + U / timeSteps

For example: When I am in my 1001th iteration, I calculate:
U_avg = U_avg * 1000/1001 + U / 1001

I was not happy with this solution, but it works.

I hope this helps...

All the best,
Christoph
ChrisWe is offline   Reply With Quote

Old   October 28, 2016, 16:39
Default
  #4
Member
 
Join Date: Oct 2013
Posts: 92
Rep Power: 12
fedvasu is on a distinguished road
Quote:
Originally Posted by ChrisWe View Post
Hi,

I did not solve it in an elegant way, but as you mentioned, I circumvented it.
I do not exactly know how I solved it right know (I am not at my PC), but I created a new IOobject and calculated the average with some additional lines in my solver. Something like:
U_avg = U_avg * (timeSteps-1)/timeSteps + U / timeSteps

For example: When I am in my 1001th iteration, I calculate:
U_avg = U_avg * 1000/1001 + U / 1001

I was not happy with this solution, but it works.

I hope this helps...

All the best,
Christoph

Ahh.. I think that should work for me.. Yeah not elegant.

Thanks,
fedvasu is offline   Reply With Quote

Old   March 31, 2018, 22:48
Default
  #5
New Member
 
benqing Liu
Join Date: Sep 2017
Posts: 8
Rep Power: 8
benqing is on a distinguished road
Quote:
I did not solve it in an elegant way, but as you mentioned, I circumvented it.
I do not exactly know how I solved it right know (I am not at my PC), but I created a new IOobject and calculated the average with some additional lines in my solver. Something like:
U_avg = U_avg * (timeSteps-1)/timeSteps + U / timeSteps

For example: When I am in my 1001th iteration, I calculate:
U_avg = U_avg * 1000/1001 + U / 1001
hi ChrisWe and fedvasu,

i am a new foamer . i want to Read in "Mean" values during runTime.
did you slove this problem? Or would you mind posting your code ?

Regards,
benqing
benqing is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read gradient values of constantAlphaContactAngle styleworker OpenFOAM Programming & Development 0 November 25, 2013 08:26
How to setup a simple OpenFOAM cluster? TommiPLaiho OpenFOAM Installation 3 October 27, 2013 15:15
Numerical errors in nested domain with pre-calculated boundary values Arnoldinho OpenFOAM Running, Solving & CFD 3 April 4, 2012 10:31
999999 (../../src/mpsystem.c@1123):mpt_read: failed:errno = 11 UDS_rambler FLUENT 2 November 22, 2011 09:46
read a file .txt with nurecial values of time and acceleration sicfred Fluent UDF and Scheme Programming 0 November 21, 2011 07:02


All times are GMT -4. The time now is 19:25.