mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: extened fvOptions to support sensitivity derivative
computations necessary in topology optimisation
This commit is contained in:
committed by
Andrew Heather
parent
b6a30fae61
commit
58cfb58b1a
@ -7,8 +7,8 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2020 PCOpt/NTUA
|
||||
Copyright (C) 2020 FOSS GP
|
||||
Copyright (C) 2020,2023 PCOpt/NTUA
|
||||
Copyright (C) 2020,2023 FOSS GP
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -335,6 +335,18 @@ void Foam::fv::option::correct(volTensorField& field)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fv::option::correct(surfaceScalarField& field)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fv::option::correct(surfaceVectorField& field)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fv::option::correct(surfaceTensorField& field)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fv::option::postProcessSens
|
||||
(
|
||||
scalarField& sensField,
|
||||
@ -362,4 +374,34 @@ void Foam::fv::option::postProcessSens
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fv::option::postProcessAuxSens
|
||||
(
|
||||
const volScalarField& primalField,
|
||||
const volScalarField& adjointField,
|
||||
scalarField& sensField,
|
||||
const word& fieldName
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fv::option::postProcessAuxSens
|
||||
(
|
||||
const volVectorField& primalField,
|
||||
const volVectorField& adjointField,
|
||||
scalarField& sensField,
|
||||
const word& fieldName
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fv::option::postProcessAuxSens
|
||||
(
|
||||
const volTensorField& primalField,
|
||||
const volTensorField& adjointField,
|
||||
scalarField& sensField,
|
||||
const word& fieldName
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020 PCOpt/NTUA
|
||||
Copyright (C) 2020 FOSS GP
|
||||
Copyright (C) 2020,2023 PCOpt/NTUA
|
||||
Copyright (C) 2020,2023 FOSS GP
|
||||
------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -74,6 +74,7 @@ SourceFiles
|
||||
#include "fvMatricesFwd.H"
|
||||
#include "primitiveFieldsFwd.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "dictionary.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
@ -417,6 +418,10 @@ public:
|
||||
virtual void correct(volSymmTensorField& field);
|
||||
virtual void correct(volTensorField& field);
|
||||
|
||||
virtual void correct(surfaceScalarField& field);
|
||||
virtual void correct(surfaceVectorField& field);
|
||||
virtual void correct(surfaceTensorField& field);
|
||||
|
||||
|
||||
// Post process sensitivity field related to the fvOption
|
||||
|
||||
@ -439,6 +444,28 @@ public:
|
||||
const word& designVariablesName = word::null
|
||||
);
|
||||
|
||||
virtual void postProcessAuxSens
|
||||
(
|
||||
const volScalarField& primalField,
|
||||
const volScalarField& adjointField,
|
||||
scalarField& sensField,
|
||||
const word& fieldName = word::null
|
||||
);
|
||||
virtual void postProcessAuxSens
|
||||
(
|
||||
const volVectorField& primalField,
|
||||
const volVectorField& adjointField,
|
||||
scalarField& sensField,
|
||||
const word& fieldName = word::null
|
||||
);
|
||||
virtual void postProcessAuxSens
|
||||
(
|
||||
const volTensorField& primalField,
|
||||
const volTensorField& adjointField,
|
||||
scalarField& sensField,
|
||||
const word& fieldName = word::null
|
||||
);
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2020 PCOpt/NTUA
|
||||
Copyright (C) 2020 FOSS GP
|
||||
Copyright (C) 2020,2023 PCOpt/NTUA
|
||||
Copyright (C) 2020,2023 FOSS GP
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -243,8 +243,11 @@ public:
|
||||
// Correction
|
||||
|
||||
//- Apply correction to field
|
||||
template<class Type>
|
||||
void correct(GeometricField<Type, fvPatchField, volMesh>& field);
|
||||
template
|
||||
<
|
||||
class Type, template<class> class PatchField, class GeoMesh
|
||||
>
|
||||
void correct(GeometricField<Type, PatchField, GeoMesh>& field);
|
||||
|
||||
|
||||
//- Post process sensitivity field related to the fvOption
|
||||
@ -256,6 +259,16 @@ public:
|
||||
const word& designVariablesName = word::null
|
||||
);
|
||||
|
||||
//- Post process auxiliary sensitivity field related to the fvOption
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void postProcessAuxSens
|
||||
(
|
||||
const GeometricField<Type, PatchField, GeoMesh>& primal,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& adjoint,
|
||||
scalarField& sensField,
|
||||
const word& fieldName = word::null
|
||||
);
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2020 PCOpt/NTUA
|
||||
Copyright (C) 2020 FOSS GP
|
||||
Copyright (C) 2020,2023 PCOpt/NTUA
|
||||
Copyright (C) 2020,2023 FOSS GP
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -350,10 +350,10 @@ void Foam::fv::optionList::constrain(fvMatrix<Type>& eqn)
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void Foam::fv::optionList::correct
|
||||
(
|
||||
GeometricField<Type, fvPatchField, volMesh>& field
|
||||
GeometricField<Type, PatchField, GeoMesh>& field
|
||||
)
|
||||
{
|
||||
const word& fieldName = field.name();
|
||||
@ -431,4 +431,45 @@ void Foam::fv::optionList::postProcessSens
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void Foam::fv::optionList::postProcessAuxSens
|
||||
(
|
||||
const GeometricField<Type, PatchField, GeoMesh>& primal,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& adjoint,
|
||||
scalarField& sensField,
|
||||
const word& fieldName
|
||||
)
|
||||
{
|
||||
for (fv::option& source : *this)
|
||||
{
|
||||
const label fieldi = source.applyToField(fieldName);
|
||||
|
||||
if (fieldi != -1)
|
||||
{
|
||||
addProfiling
|
||||
(fvopt, "fvOption::postProcessAuxSens." + source.name());
|
||||
|
||||
const bool ok = source.isActive();
|
||||
|
||||
if (debug && ok)
|
||||
{
|
||||
Info<< "Post processing sensitivity source "
|
||||
<< source.name() << " for field " << fieldName << endl;
|
||||
}
|
||||
|
||||
if (ok)
|
||||
{
|
||||
source.postProcessAuxSens
|
||||
(
|
||||
primal,
|
||||
adjoint,
|
||||
sensField,
|
||||
fieldName
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user