Loading...
Searching...
No Matches
objectiveI.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2007-2023 PCOpt/NTUA
9 Copyright (C) 2013-2023 FOSS GP
10 Copyright (C) 2019-2020 OpenCFD Ltd.
11-------------------------------------------------------------------------------
12License
13 This file is part of OpenFOAM.
14
15 OpenFOAM is free software: you can redistribute it and/or modify it
16 under the terms of the GNU General Public License as published by
17 the Free Software Foundation, either version 3 of the License, or
18 (at your option) any later version.
19
20 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27
28
29\*---------------------------------------------------------------------------*/
30
31// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
34{
35 return objectiveName_;
36}
37
39inline bool Foam::objective::shouldWrite() const
40{
41 return shouldWrite_;
42}
43
48}
49
52{
53 return *dJdbPtr_;
54}
55
56
58{
59 return *dJdbFieldPtr_;
60}
61
62
63inline const Foam::fvPatchVectorField&
64Foam::objective::boundarydJdb(const label patchI) const
65{
66 return bdJdbPtr_()[patchI];
67}
68
69
70inline const Foam::fvPatchVectorField&
71Foam::objective::dSdbMultiplier(const label patchI) const
72{
73 return bdSdbMultPtr_()[patchI];
74}
75
76
77inline const Foam::fvPatchVectorField&
78Foam::objective::dndbMultiplier(const label patchI) const
79{
80 return bdndbMultPtr_()[patchI];
81}
82
83
84inline const Foam::fvPatchVectorField&
85Foam::objective::dxdbMultiplier(const label patchI) const
86{
87 return bdxdbMultPtr_()[patchI];
88}
89
90
92Foam::objective::dxdbDirectMultiplier(const label patchI) const
93{
94 return bdxdbDirectMultPtr_()[patchI];
95}
96
97
99(
100 const label patchI,
101 const label edgeI
102) const
103{
104 if (!bdxdbDirectMultPtr_)
105 {
107 << "Unallocated boundaryEdgeMultiplier field"
108 << exit(FatalError);
109 }
110 return bEdgeContribution_()[patchI][edgeI];
111}
112
115{
116 return *bdJdbPtr_;
117}
118
123}
124
129}
130
131
136
137
140{
141 return *bdxdbDirectMultPtr_;
142}
143
144
146{
147 if (!bdxdbDirectMultPtr_)
148 {
150 << "Unallocated boundaryEdgeMultiplier field"
151 << endl << endl
152 << exit(FatalError);
153 }
154 return *bEdgeContribution_;
155}
156
161}
162
167}
168
170inline bool Foam::objective::hasdJdb() const noexcept
171{
172 return bool(dJdbPtr_);
173}
174
176inline bool Foam::objective::hasdJdbField() const noexcept
177{
178 return bool(dJdbFieldPtr_);
179}
180
183{
184 return bool(bdJdbPtr_);
185}
186
188inline bool Foam::objective::hasdSdbMult() const noexcept
189{
190 return bool(bdSdbMultPtr_);
191}
192
194inline bool Foam::objective::hasdndbMult() const noexcept
195{
196 return bool(bdndbMultPtr_);
197}
198
200inline bool Foam::objective::hasdxdbMult() const noexcept
201{
202 return bool(bdxdbMultPtr_);
203}
204
207{
208 return bool(bdxdbDirectMultPtr_);
209}
210
213{
214 return bool(bEdgeContribution_);
215}
216
219{
220 return bool(divDxDbMultPtr_);
221}
222
225{
226 return bool(gradDxDbMultPtr_);
227}
228
233}
234
237{
238 return bool(integrationEndTimePtr_);
239}
240
241
242inline void Foam::objective::setComputed(const bool isComputed) noexcept
243{
244 computed_ = isComputed;
245}
246
247
248// ************************************************************************* //
bool hasdSdbMult() const noexcept
Definition objectiveI.H:181
bool hasIntegrationStartTime() const noexcept
Definition objectiveI.H:223
autoPtr< boundaryVectorField > bdJdbPtr_
Contribution to field sensitivity derivatives.
Definition objective.H:156
void setComputed(const bool isComputed) noexcept
Set the computed status of the objective.
Definition objectiveI.H:235
autoPtr< boundaryVectorField > bdSdbMultPtr_
Term multiplying delta(n dS)/delta b.
Definition objective.H:161
const boundaryVectorField & dxdbMultiplier() const
Multiplier of delta(x)/delta b for all patches.
Definition objectiveI.H:125
const word objectiveName_
Definition objective.H:67
bool hasGradDxDbMult() const noexcept
Definition objectiveI.H:217
bool hasBoundarydJdb() const noexcept
Definition objectiveI.H:175
bool hasdJdb() const noexcept
Definition objectiveI.H:163
const boundaryVectorField & dxdbDirectMultiplier() const
Multiplier of delta(x)/delta b for all patches.
Definition objectiveI.H:132
autoPtr< boundaryVectorField > bdxdbDirectMultPtr_
Term multiplying delta(x)/delta b at the boundary for objectives that directly depend on x,...
Definition objective.H:178
autoPtr< scalar > integrationStartTimePtr_
Objective integration start and end times (for unsteady flows).
Definition objective.H:121
const word & objectiveName() const
Return the objective name.
Definition objectiveI.H:26
const scalarField & dJdbField() const
Contribution to sensitivities with a random number of designVars.
Definition objectiveI.H:50
bool hasIntegrationEndTime() const noexcept
Definition objectiveI.H:229
bool hasdndbMult() const noexcept
Definition objectiveI.H:187
const boundaryVectorField & dSdbMultiplier() const
Multiplier of delta(n dS)/delta b for all patches.
Definition objectiveI.H:113
autoPtr< scalar > integrationEndTimePtr_
Definition objective.H:122
void setWrite(const bool shouldWrite)
Should the objective be written to file upon calling write()?
Definition objectiveI.H:38
const volScalarField & divDxDbMultiplier() const
Multiplier of grad( delta(x)/delta b) for volume-based sensitivities.
Definition objectiveI.H:151
bool hasdJdbField() const noexcept
Definition objectiveI.H:169
autoPtr< volScalarField > divDxDbMultPtr_
Multiplier of d(Volume)/db.
Definition objective.H:194
const volScalarField & dJdb() const
Contribution to field sensitivities.
Definition objectiveI.H:44
bool hasDivDxDbMult() const noexcept
Definition objectiveI.H:211
bool hasBoundaryEdgeContribution() const noexcept
Definition objectiveI.H:205
const boundaryVectorField & dndbMultiplier() const
Multiplier of delta(n dS)/delta b for all patches.
Definition objectiveI.H:119
bool computed_
Whether the objective is computed or not.
Definition objective.H:96
const boundaryVectorField & boundarydJdb() const
Contribution to surface sensitivities for all patches.
Definition objectiveI.H:107
autoPtr< boundaryVectorField > bdndbMultPtr_
Term multiplying delta(n)/delta b.
Definition objective.H:166
autoPtr< boundaryVectorField > bdxdbMultPtr_
Term multiplying delta(x)/delta b at the boundary.
Definition objective.H:171
bool hasdxdbDirectMult() const noexcept
Definition objectiveI.H:199
bool shouldWrite() const
Should the objective be written to file upon calling write()?
Definition objectiveI.H:32
autoPtr< vectorField3 > bEdgeContribution_
Contribution located in specific parts of a patch. Mainly intended for patch boundary edges contribut...
Definition objective.H:185
bool hasdxdbMult() const noexcept
Definition objectiveI.H:193
const vectorField3 & boundaryEdgeMultiplier() const
Multiplier located at patch boundary edges.
Definition objectiveI.H:138
const volTensorField & gradDxDbMultiplier() const
Multiplier of grad( delta(x)/delta b) for volume-based sensitivities.
Definition objectiveI.H:157
autoPtr< volTensorField > gradDxDbMultPtr_
Emerging from volume objectives that include spatial derivatives.
Definition objective.H:199
A class for handling words, derived from Foam::string.
Definition word.H:66
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
Field< Field< vectorField > > vectorField3
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
GeometricField< tensor, fvPatchField, volMesh > volTensorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
const direction noexcept
Definition scalarImpl.H:265
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
volVectorField::Boundary boundaryVectorField
fvPatchField< vector > fvPatchVectorField