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

Continuing fieldAverage on restart?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 22, 2009, 05:14
Default Continuing fieldAverage on restart?
  #1
Member
 
Juho Peltola
Join Date: Mar 2009
Location: Finland
Posts: 89
Rep Power: 17
juho is on a distinguished road
Hi,

I'm using the fieldAverage function object to calculate average fields. The averaging works fine if the simulation is completed in a single run. However if the simulation is interrupted and restarted the averages calculated so far are reset. The averages are also reset if prime2Mean calculation is turned on in middle of a run.

Looking at /src/postProcessing/fieldAverage/fieldAverage/fieldAverageTemplates.C
it would seem that this should not be the case? If the mean field is present it should be read and not reset?

Excerpt from fieldAverageTemplates.C:
================================================== ======

Info<< "Reading/calculating field " << meanFieldName << nl << endl;

if (obr_.foundObject<fieldType>(meanFieldName))
{
meanFieldList[fieldi] = meanFieldName;
}
else if (obr_.found(meanFieldName))
{
Info<< "Cannot allocate average field " << meanFieldName
<< " since an object with that name already exists."
<< " Disabling averaging." << nl << endl;
meanFieldList[fieldi] = word::null;
}
else
{
const fieldType& baseField =
obr_.lookupObject<fieldType>(fieldName);

fieldType* fPtr = new fieldType
(
IOobject
(
meanFieldName,
obr_.time().timeName(),
obr_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
baseField
);

// Store on registry
fPtr->store();

meanFieldList[fieldi] = meanFieldName;
}

================================================== ======

controlDict:
================================================== ======
functions
(
fieldAverage1
{
// Type of functionObject
type fieldAverage;

// Where to load it from (if not already in solver)
functionObjectLibs ("libfieldAverage.so");

// Fields to be averaged - runTime modifiable
fields
(
Ua
{
mean on;
prime2Mean on;
base time;
}
);
}
);

================================================== ======

I'm using a couple of days old 1.5.x from GIT.

Continuing the averages would be very important for me, as the simulations take a quite a bit of time and interrupting the simulation is sometimes necessary. Am I doing something wrong or what?

Thank you for reading and any input is appreciated!

Juho
juho is offline   Reply With Quote

Old   March 25, 2009, 16:53
Default
  #2
Member
 
Juho Peltola
Join Date: Mar 2009
Location: Finland
Posts: 89
Rep Power: 17
juho is on a distinguished road
I ended up coding the averaging directly into the solver, which is fine as I would have had to do it eventually anyway. Although a function object would be a more elegant way to handle it. Whether it's the standard stuff or something else.

I would still appreciate comments on the fieldAverage function object. Is it supposed to work like I described in the above post, or did I do something wrong?
juho is offline   Reply With Quote

Old   June 5, 2009, 08:43
Default
  #3
Senior Member
 
Dr. Fabian Schlegel
Join Date: Apr 2009
Location: Dresden, Germany
Posts: 222
Rep Power: 17
fs82 is on a distinguished road
Due to your post I was a bit afraid of using the averaging function and I tested the problem you mentioned. I started from zero, performed one step, restarted the calculation and performed again one step. For me everything looks fine. The averages are correct after each time step and after a restart OpenFoam reads the previous averages successfully and continues averaging. I use OpenFoam 1.5. So I could reproduce your problem.
fs82 is offline   Reply With Quote

Old   June 5, 2009, 09:38
Default
  #4
Member
 
Leonardo Giampani Morita
Join Date: Apr 2009
Location: Paris, France
Posts: 58
Rep Power: 17
leonardo.morita is on a distinguished road
Hi Fabian,

Are you sure the values you used could not have tricked you? I remember having tested a simple case too, but I verified that the start time of averaging is startTime from controlDict...so each time the simulation was paused and resumed, averaging was reset.

Regards
leonardo.morita is offline   Reply With Quote

Old   June 5, 2009, 10:01
Default
  #5
Senior Member
 
Dr. Fabian Schlegel
Join Date: Apr 2009
Location: Dresden, Germany
Posts: 222
Rep Power: 17
fs82 is on a distinguished road
Allright, I hope not :-D
The plot I attached hopefully explain what I mean. This is a simple channel with constant volume force acting in streamwise direction. The initial conditon for Ux is 0. You could see that Ux after one timestep (Ux(0) in plot, red line is behind the blue one) is about 0.0025. The average value Uxm(0) is about 0.00125 which is correct ((0+0.0025)/2).
After that timestep I aborted the run and restart it. If you have a look at the yellow line showing you one time step after the restart, namely Ux(1), you see the velocity increases to 0.005. If you now look at Uxm(1) you will find it about 0.0025 which is only correct if he uses the avarages from before the restart: (0 + 0.0025 + 0.005)/3 = 0.0025. Without using this files from before the restart you will get: (0.0025+0.005)/2 = 0.00375.
Attached Images
File Type: jpg compare.jpg (26.3 KB, 79 views)
fs82 is offline   Reply With Quote

Old   June 5, 2009, 10:35
Default
  #6
Member
 
Leonardo Giampani Morita
Join Date: Apr 2009
Location: Paris, France
Posts: 58
Rep Power: 17
leonardo.morita is on a distinguished road
Well, I've tested some new cases and I found the same results you did Fabian...however it seems to me there's still something unclear...
Actually, it would be much more interesting for me too if averaging was always cumulative, but Juho's results are bizarre, aren't they?
Did somebody else have problems with averaging?
leonardo.morita is offline   Reply With Quote

Old   June 5, 2009, 13:56
Default
  #7
Senior Member
 
xinguang cui
Join Date: Mar 2009
Posts: 116
Rep Power: 17
flying is on a distinguished road
Hey juho!

If you post the error informaiton, I think it will be more helpful.
flying is offline   Reply With Quote

Old   June 8, 2009, 02:43
Default
  #8
Senior Member
 
Dr. Fabian Schlegel
Join Date: Apr 2009
Location: Dresden, Germany
Posts: 222
Rep Power: 17
fs82 is on a distinguished road
May be I understand something wrong, but Juho is complaining about that the averages are reset after a restart. But my test and his excerpt from source code did not confirm his assumption. For me the averaging function works correct. But I will continue testing with my full turbulent channel and see what happens ...
fs82 is offline   Reply With Quote

Old   June 8, 2009, 08:09
Default
  #9
Senior Member
 
xinguang cui
Join Date: Mar 2009
Posts: 116
Rep Power: 17
flying is on a distinguished road
Me too, I also think the average field function has no problem
flying is offline   Reply With Quote

Old   February 27, 2010, 08:23
Default
  #10
Member
 
Matthias Kern
Join Date: Mar 2009
Location: Karlsruhe, Germany
Posts: 36
Rep Power: 17
make is on a distinguished road
I have problems doing the averaging as well. Everytime I restart my simulation totalIter and totalTime are resetted despite the mean fields are present.
I simply tried the pitzDaily tutorial case as well to check if it is my setup. So I set startFrom to latestTime and stopAt to nextWrite in the controlDict and restarted a few times. After every run totalIter is 11 and totalTime 0.00011. So it clearly did not use the correct weighting for the averages.
Did I misunderstood anything?
I came to that point after I sadly run a huge LES in three restart steps and wondered why my averages did not proceed after every run. Nevertheless due to resource managment on our cluster system I am forced to restart.

Help would be so appreciated!!!

Regards and have a nice weekend,
Matthias
make is offline   Reply With Quote

Old   February 27, 2010, 08:24
Default
  #11
Member
 
Matthias Kern
Join Date: Mar 2009
Location: Karlsruhe, Germany
Posts: 36
Rep Power: 17
make is on a distinguished road
Ups, forgot to mention that I am still using OpenFOAM-1.5.x
make is offline   Reply With Quote

Old   March 1, 2010, 08:23
Default
  #12
Member
 
Matthias Kern
Join Date: Mar 2009
Location: Karlsruhe, Germany
Posts: 36
Rep Power: 17
make is on a distinguished road
I figured out that when it calls the readAveragingProperties() function in fieldAverage.C the fieldAveragingProperties file of the requested time step of the restart is found but claimed to be empty. Nevertheless, the file is present and not empty! I then checked the fieldAverage of OF-1.6.x and it works. So I copied the OF-1.6.x version to OF-1.5.x installation and replaced the write() function in fieldAverage.C by the write function of OF-1.5.x so that in does not write out the mean fields every time step (exec() is not yet known for function objects in OF-1.5.x). This seems to work properly and is a valid workaround for me.
However I didn't find out what the issue in OF-1.5.x is exactly. So if anybody finds out please let me know.

regards,
Matthias
make 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
v4 restart bug optima prime Siemens 3 February 2, 2009 22:51
Restart of FSI simulation V. Kumar CFX 3 July 20, 2006 13:23
restart & ecd files cirilo Siemens 0 November 21, 2005 12:15
transient restart Pete Siemens 1 July 22, 2005 08:11
restart Dmitry Siemens 0 March 22, 2002 10:28


All times are GMT -4. The time now is 23:28.