BUG: ISQP crashing with the ShermanMorrison preconditiooner (fixes #3077)

ISQP crashed during the first update of the design variables, if the
latter had no bounds and the ShermanMorrison preconditiooner was used.
This commit is contained in:
Vaggelis Papoutsis 2024-01-08 18:28:48 +02:00 committed by Andrew Heather
parent ad85b684bb
commit f6ec5c676e
4 changed files with 8 additions and 8 deletions

View File

@ -429,12 +429,12 @@ Foam::tmp<Foam::scalarField> Foam::ISQP::ShermanMorrisonPrecon
// process, the diagonal matrix related to bound constraints is treated as
// the initial matrix of the L-BFGS update.
// Constribution from bound constraints, treated as the seed of the
// Contribution from bound constraints, treated as the seed of the
// L-BFGS inverse
tmp<scalarField> tdiag(nullptr);
refPtr<scalarField> tdiag(nullptr);
if (includeBoundConstraints_)
{
tdiag.reset(lTilda_()/ls_() + uTilda_()/us_());
tdiag.reset((lTilda_()/ls_() + uTilda_()/us_()).ptr());
}
// List of vectors to be used in the rank-1 updates related to the flow
@ -462,7 +462,7 @@ Foam::tmp<Foam::scalarField> Foam::ISQP::ShermanMorrisonRank1Update
(
const PtrList<scalarField>& r1Updates,
const scalarField& p,
const tmp<scalarField>& diag,
const refPtr<scalarField>& diag,
const scalarField& mult,
label n
)
@ -472,7 +472,7 @@ Foam::tmp<Foam::scalarField> Foam::ISQP::ShermanMorrisonRank1Update
if (n == 0)
{
Ap = invHessianVectorProduct(p, counter_, diag);
Ap = invHessianVectorProduct(p, counter_, diag.shallowClone());
return tAp;
}

View File

@ -248,7 +248,7 @@ protected:
(
const PtrList<scalarField>& r1Updates,
const scalarField& p,
const tmp<scalarField>& diag,
const refPtr<scalarField>& diag,
const scalarField& mult,
label n
);

View File

@ -175,7 +175,7 @@ Foam::LBFGS::invHessianVectorProduct
(
const scalarField& vector,
const label counter,
tmp<scalarField> diag
const refPtr<scalarField> diag
)
{
// Sanity checks

View File

@ -131,7 +131,7 @@ protected:
(
const scalarField& vector,
const label counter,
tmp<scalarField> diag = nullptr
const refPtr<scalarField> diag = nullptr
);
//- Compute the Hessian - vector product