Skip to content

Commit b24b19b

Browse files
authored
Fixed a calcObjStd bug that forgot to reset std for every primal call
1 parent d58cd15 commit b24b19b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/adjoint/DASolver/DASolver.C

+10-1
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,19 @@ void DASolver::calcObjStd(Time& runTime)
228228
is filled at least once, i.e., runTime.timeIndex() >= steps
229229
*/
230230

231-
if (!primalObjStdActive_ || runTime.timeIndex() < 1)
231+
if (!primalObjStdActive_)
232232
{
233233
return;
234234
}
235+
else if (runTime.timeIndex() < 1)
236+
{
237+
// if primalObjStd is active and timeIndex = 0, we need to reset primalObjStd_ to a large value
238+
// NOTE: we need to reset primalObjStd_ for each primal call!
239+
// Because timeIndex == 0, we don't need to compute the objStd, so we can return
240+
// we will start computing the ojbStd for timeIndex>=1
241+
primalObjStd_ = 999.0;
242+
return;
243+
}
235244

236245
label steps = daOptionPtr_->getSubDictOption<label>("primalObjStdTol", "steps");
237246

0 commit comments

Comments
 (0)