mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: changes in SIBase and derived classes
- Added function returning the underlaying surface sensitivities - Added boolean to control whether to write the underlaying sensitivity map (defaults to false)
This commit is contained in:
committed by
Andrew Heather
parent
d5c8dd52bb
commit
36b0c5ce15
@ -50,6 +50,8 @@ void SIBase::read()
|
|||||||
surfaceSensitivity_.read();
|
surfaceSensitivity_.read();
|
||||||
includeObjective_ =
|
includeObjective_ =
|
||||||
dict().getOrDefault<bool>("includeObjectiveContribution", true);
|
dict().getOrDefault<bool>("includeObjectiveContribution", true);
|
||||||
|
writeSensitivityMap_ =
|
||||||
|
dict().getOrDefault<bool>("writeSensitivityMap", false);
|
||||||
|
|
||||||
// If includeObjective is set to true both here and in the surface
|
// If includeObjective is set to true both here and in the surface
|
||||||
// sensitivities, set the one in the latter to false to avoid double
|
// sensitivities, set the one in the latter to false to avoid double
|
||||||
@ -105,7 +107,8 @@ SIBase::SIBase
|
|||||||
objectiveManager,
|
objectiveManager,
|
||||||
fvOptionsAdjoint
|
fvOptionsAdjoint
|
||||||
),
|
),
|
||||||
includeObjective_(true)
|
includeObjective_(true),
|
||||||
|
writeSensitivityMap_(true)
|
||||||
{
|
{
|
||||||
read();
|
read();
|
||||||
}
|
}
|
||||||
@ -152,6 +155,22 @@ void SIBase::clearSensitivities()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const sensitivitySurface& SIBase::getSurfaceSensitivities() const
|
||||||
|
{
|
||||||
|
return surfaceSensitivity_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SIBase::write(const word& baseName)
|
||||||
|
{
|
||||||
|
shapeSensitivities::write(baseName);
|
||||||
|
if (writeSensitivityMap_)
|
||||||
|
{
|
||||||
|
surfaceSensitivity_.write(baseName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace incompressible
|
} // End namespace incompressible
|
||||||
|
|||||||
@ -72,6 +72,9 @@ protected:
|
|||||||
// them
|
// them
|
||||||
bool includeObjective_;
|
bool includeObjective_;
|
||||||
|
|
||||||
|
//- Write sensitivity map upon write
|
||||||
|
bool writeSensitivityMap_;
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
@ -127,6 +130,12 @@ public:
|
|||||||
|
|
||||||
//- Zero sensitivity fields and their constituents
|
//- Zero sensitivity fields and their constituents
|
||||||
virtual void clearSensitivities();
|
virtual void clearSensitivities();
|
||||||
|
|
||||||
|
//- Return reference to underlaying surface sensitivities
|
||||||
|
const sensitivitySurface& getSurfaceSensitivities() const;
|
||||||
|
|
||||||
|
//- Write sensitivity map
|
||||||
|
virtual void write(const word& baseName = word::null);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -203,6 +203,9 @@ void sensitivityBezier::clearSensitivities()
|
|||||||
void sensitivityBezier::write(const word& baseName)
|
void sensitivityBezier::write(const word& baseName)
|
||||||
{
|
{
|
||||||
Info<< "Writing control point sensitivities to file" << endl;
|
Info<< "Writing control point sensitivities to file" << endl;
|
||||||
|
// Write sensitivity map
|
||||||
|
SIBase::write(baseName);
|
||||||
|
// Write control point sensitivities
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
OFstream derivFile
|
OFstream derivFile
|
||||||
|
|||||||
@ -268,6 +268,9 @@ void sensitivityVolBSplines::clearSensitivities()
|
|||||||
void sensitivityVolBSplines::write(const word& baseName)
|
void sensitivityVolBSplines::write(const word& baseName)
|
||||||
{
|
{
|
||||||
Info<< "Writing control point sensitivities to file" << endl;
|
Info<< "Writing control point sensitivities to file" << endl;
|
||||||
|
// Write sensitivity map
|
||||||
|
SIBase::write(baseName);
|
||||||
|
// Write control point sensitivities
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
OFstream derivFile
|
OFstream derivFile
|
||||||
|
|||||||
Reference in New Issue
Block a user