INT: Minor integration updates

This commit is contained in:
Andrew Heather
2020-06-12 14:34:56 +01:00
parent c344520474
commit d6104bd497
17 changed files with 39 additions and 33 deletions

View File

@ -266,10 +266,8 @@ template<class Type>
const ATCModel& adjointBoundaryCondition<Type>::getATC() const const ATCModel& adjointBoundaryCondition<Type>::getATC() const
{ {
return return
patch_.boundaryMesh().mesh().lookupObject<ATCModel> patch_.boundaryMesh().mesh().template
( lookupObject<ATCModel>("ATCModel" + adjointSolverName_);
"ATCModel" + adjointSolverName_
);
} }

View File

@ -70,8 +70,8 @@ adjointRotatingWallVelocityFvPatchVectorField
) )
: :
adjointWallVelocityFvPatchVectorField(p, iF, dict), adjointWallVelocityFvPatchVectorField(p, iF, dict),
origin_(dict.lookup("origin")), origin_(dict.get<vector>("origin")),
axis_(dict.lookup("axis")), axis_(dict.get<vector>("axis")),
omega_(Function1<scalar>::New("omega", dict)) omega_(Function1<scalar>::New("omega", dict))
{} {}

View File

@ -177,7 +177,7 @@ void objectiveManager::update()
void objectiveManager::updateOrNullify() void objectiveManager::updateOrNullify()
{ {
//- Update contributions to adjoint if true, otherwise return nulls // Update contributions to adjoint if true, otherwise return nulls
for (objective& obj : objectives_) for (objective& obj : objectives_)
{ {
if (obj.isWithinIntegrationTime()) if (obj.isWithinIntegrationTime())

View File

@ -7,7 +7,7 @@
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2007-2019 PCOpt/NTUA Copyright (C) 2007-2019 PCOpt/NTUA
Copyright (C) 2013-2019 FOSS GP Copyright (C) 2013-2019 FOSS GP
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -75,7 +75,7 @@ scalar objectiveForceTarget::J()
} }
void objectiveForceTarget::write() const bool objectiveForceTarget::write(const bool valid) const
{ {
if (Pstream::master()) if (Pstream::master())
{ {
@ -99,6 +99,8 @@ void objectiveForceTarget::write() const
<< setw(width) << force_ << " " << setw(width) << force_ << " "
<< setw(width) << target_ << endl; << setw(width) << target_ << endl;
} }
return true;
} }

View File

@ -7,7 +7,7 @@
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2007-2019 PCOpt/NTUA Copyright (C) 2007-2019 PCOpt/NTUA
Copyright (C) 2013-2019 FOSS GP Copyright (C) 2013-2019 FOSS GP
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -92,7 +92,7 @@ public:
scalar J(); scalar J();
//- Write objective value //- Write objective value
void write() const; virtual bool write(const bool valid = true) const;
}; };

View File

@ -7,7 +7,7 @@
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2007-2019 PCOpt/NTUA Copyright (C) 2007-2019 PCOpt/NTUA
Copyright (C) 2013-2019 FOSS GP Copyright (C) 2013-2019 FOSS GP
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -546,9 +546,9 @@ void objectiveIncompressible::nullify()
} }
void objectiveIncompressible::write() const bool objectiveIncompressible::write(const bool valid) const
{ {
objective::write(); return objective::write(valid);
} }

View File

@ -7,7 +7,7 @@
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2007-2019 PCOpt/NTUA Copyright (C) 2007-2019 PCOpt/NTUA
Copyright (C) 2013-2019 FOSS GP Copyright (C) 2013-2019 FOSS GP
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -306,7 +306,7 @@ public:
{} {}
//- Write objective function history //- Write objective function history
virtual void write() const; virtual bool write(const bool valid = true) const;
//- Inline functions for checking whether pointers are set or not //- Inline functions for checking whether pointers are set or not
inline bool hasdJdv() const; inline bool hasdJdv() const;

View File

@ -65,7 +65,7 @@ objectiveNutSqr::objectiveNutSqr
mesh_.cellZones().indices(this->dict().get<wordRes>("zones")) mesh_.cellZones().indices(this->dict().get<wordRes>("zones"))
) )
{ {
//- Allocate source term for the adjoint turbulence model // Allocate source term for the adjoint turbulence model
dJdTMvar1Ptr_.reset dJdTMvar1Ptr_.reset
( (
createZeroFieldPtr<scalar> createZeroFieldPtr<scalar>
@ -75,7 +75,7 @@ objectiveNutSqr::objectiveNutSqr
(dimless/dimTime/dimTime) (dimless/dimTime/dimTime)
) )
); );
//- Allocate term to be added to volume-based sensitivity derivatives // Allocate term to be added to volume-based sensitivity derivatives
divDxDbMultPtr_.reset divDxDbMultPtr_.reset
( (
createZeroFieldPtr<scalar> createZeroFieldPtr<scalar>
@ -87,7 +87,7 @@ objectiveNutSqr::objectiveNutSqr
dimensionSet(0,0,0,0,0,0,0) dimensionSet(0,0,0,0,0,0,0)
) )
); );
//- set file pointer // set file pointer
//objFunctionFilePtr_ = new OFstream(objFunctionFolder_/type()); //objFunctionFilePtr_ = new OFstream(objFunctionFolder_/type());
} }

View File

@ -85,7 +85,7 @@ public:
// Constructors // Constructors
//- from components //- From components
objectiveNutSqr objectiveNutSqr
( (
const fvMesh& mesh, const fvMesh& mesh,
@ -110,7 +110,7 @@ public:
void update_dJdTMvar1(); void update_dJdTMvar1();
//- Update field to be added to be added to volume-based //- Update field to be added to be added to volume-based
// sensitivity derivatives, emerging from delta ( dV ) / delta b //- sensitivity derivatives, emerging from delta ( dV ) / delta b
void update_divDxDbMultiplier(); void update_divDxDbMultiplier();
}; };

View File

@ -133,7 +133,7 @@ void objectivePartialVolume::update_dSdbMultiplier()
} }
void objectivePartialVolume::write() const bool objectivePartialVolume::write(const bool valid) const
{ {
if (Pstream::master()) if (Pstream::master())
{ {
@ -153,6 +153,8 @@ void objectivePartialVolume::write() const
objFunctionFilePtr_() << setw(width) << J_ << " "; objFunctionFilePtr_() << setw(width) << J_ << " ";
objFunctionFilePtr_() << setw(width) << initVol_ << endl; objFunctionFilePtr_() << setw(width) << initVol_ << endl;
} }
return true;
} }

View File

@ -7,7 +7,7 @@
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2007-2019 PCOpt/NTUA Copyright (C) 2007-2019 PCOpt/NTUA
Copyright (C) 2013-2019 FOSS GP Copyright (C) 2013-2019 FOSS GP
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -99,7 +99,7 @@ public:
void update_dSdbMultiplier(); void update_dSdbMultiplier();
//- Write objective function history //- Write objective function history
void write() const; virtual bool write(const bool valid = true) const;
}; };

View File

@ -234,7 +234,7 @@ void objectivePtLosses::update_boundarydJdvt()
} }
void objectivePtLosses::write() const bool objectivePtLosses::write(const bool valid) const
{ {
if (Pstream::master()) if (Pstream::master())
{ {
@ -266,6 +266,8 @@ void objectivePtLosses::write() const
} }
objFunctionFilePtr_() << endl; objFunctionFilePtr_() << endl;
} }
return true;
} }

View File

@ -7,7 +7,7 @@
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2007-2019 PCOpt/NTUA Copyright (C) 2007-2019 PCOpt/NTUA
Copyright (C) 2013-2019 FOSS GP Copyright (C) 2013-2019 FOSS GP
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -109,7 +109,7 @@ public:
void update_boundarydJdvt(); void update_boundarydJdvt();
//- Write objective function values and its contrituents //- Write objective function values and its contrituents
void write() const; virtual bool write(const bool valid = true) const;
}; };

View File

@ -7,7 +7,7 @@
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2007-2020 PCOpt/NTUA Copyright (C) 2007-2020 PCOpt/NTUA
Copyright (C) 2013-2020 FOSS GP Copyright (C) 2013-2020 FOSS GP
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -677,7 +677,7 @@ void objective::nullify()
} }
void objective::write() const bool objective::write(const bool valid) const
{ {
if (Pstream::master()) if (Pstream::master())
{ {
@ -691,6 +691,8 @@ void objective::write() const
objFunctionFilePtr_() << mesh_.time().value() << tab << J_ << endl; objFunctionFilePtr_() << mesh_.time().value() << tab << J_ << endl;
} }
return true;
} }

View File

@ -7,7 +7,7 @@
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2007-2020 PCOpt/NTUA Copyright (C) 2007-2020 PCOpt/NTUA
Copyright (C) 2013-2020 FOSS GP Copyright (C) 2013-2020 FOSS GP
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -373,7 +373,7 @@ public:
{} {}
//- Write objective function history //- Write objective function history
virtual void write() const; virtual bool write(const bool valid = true) const;
//- Write objective function history at each primal solver iteration //- Write objective function history at each primal solver iteration
virtual void writeInstantaneousValue() const; virtual void writeInstantaneousValue() const;

View File

@ -76,7 +76,7 @@ Foam::optMeshMovement::optMeshMovement
dict.getOrDefault("writeMeshQualityMetrics", false) dict.getOrDefault("writeMeshQualityMetrics", false)
) )
{ {
//- Set maxAllowedDisplacement if provided // Set maxAllowedDisplacement if provided
if (dict.found("maxAllowedDisplacement")) if (dict.found("maxAllowedDisplacement"))
{ {
maxAllowedDisplacement_.reset maxAllowedDisplacement_.reset

View File

@ -127,7 +127,7 @@ Foam::updateMethod::inv(SquareMatrix<scalar> A)
label n(A.n()); label n(A.n());
SquareMatrix<scalar> invA(n, Zero); SquareMatrix<scalar> invA(n, Zero);
//- LU decomposition of A // LU decomposition of A
labelList pivotIndices(n, Zero); labelList pivotIndices(n, Zero);
LUDecompose(A, pivotIndices); LUDecompose(A, pivotIndices);
DebugInfo DebugInfo