View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0002510||OpenFOAM||[All Projects] Bug||public||2017-03-21 12:39||2017-05-03 18:46|
|Fixed in Version||4.x|
|Summary||0002510: Subtle bug in fieldAverage function object|
|Description||The recent changes to fieldAverage (https://bugs.openfoam.org/view.php?id=2459) introduce a subtle bug, where totalTime_[fieldi] is not properly initialized for fields that are not present in the Properties-dict during restart. |
1. In line 245 give a default value obr_.time().deltaTValue() to totalTime_[fieldi]. This corresponds to earlier behavior, but may not be accurate for variable time step cases.
2. Give an invalid value for totalTime_[fieldi], eg. negative, and detect these in initialize(). So in addition to checking for size, loop over totalTimes and initialize if necessary.
3. Disallow adding new fields to the same fieldAverage-function. Throw a warning or crash if props are not found for all fields.
|Steps To Reproduce||Steps to reproduce|
1. Start averaging, run until write and kill solver
2. Add new fields to the same fieldAverage-object
3. Restart averaging, totalTime for new fields is now arbitrary leading to incorrect results or crash
|Tags||No tags attached.|
Option 1 is not good because it recreates the previous error is a slightly different form.
Option 2 is a bit clunky but workable.
Option 3 is the cleanest but least flexible.
Which option do you prefer?
||I think option 2 would be best, because the properties-dict supports having different averaging times for different fields and I see no reason to prevent user from adding new fields. Also this has worked before and the changed behavior may confuse users.|
||Can you provide a patch for option 2?|
Ok, I have attached a very straightforward patch which uses -1.0 as a dummy value.
fieldAverage.C (8,948 bytes)
Resolved by commit c95bf5e31d627456713266e29f5ca32e1bad9216
||I just noticed that this bug also affects 4.x. The fix should probably be also added to 4.x?|
Resolved in OpenFOAM-4.x by commit f10cfe3fb0ab9360a9b47bd0cfba4c7dfc0c56d3
|2017-03-21 12:39||tniemi||New Issue|
|2017-03-21 12:53||henry||Note Added: 0007956|
|2017-03-21 12:59||tniemi||Note Added: 0007957|
|2017-03-21 13:03||henry||Note Added: 0007958|
|2017-03-21 13:30||tniemi||File Added: fieldAverage.C|
|2017-03-21 13:30||tniemi||Note Added: 0007959|
|2017-03-22 18:39||henry||Assigned To||=> henry|
|2017-03-22 18:39||henry||Status||new => resolved|
|2017-03-22 18:39||henry||Resolution||open => fixed|
|2017-03-22 18:39||henry||Fixed in Version||=> dev|
|2017-03-22 18:39||henry||Note Added: 0007968|
|2017-04-20 07:59||tniemi||Status||resolved => feedback|
|2017-04-20 07:59||tniemi||Resolution||fixed => reopened|
|2017-04-20 07:59||tniemi||Note Added: 0008033|
|2017-05-03 18:46||henry||Status||feedback => resolved|
|2017-05-03 18:46||henry||Resolution||reopened => fixed|
|2017-05-03 18:46||henry||Fixed in Version||dev => 4.x|
|2017-05-03 18:46||henry||Note Added: 0008076|