DAFoam
v4.0.2
Discrete Adjoint with OpenFOAM
dafoam
src
adjoint
DAOutput
DAOutputFunction.C
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
3
DAFoam : Discrete Adjoint with OpenFOAM
4
Version : v4
5
6
\*---------------------------------------------------------------------------*/
7
8
#include "
DAOutputFunction.H
"
9
10
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
11
12
namespace
Foam
13
{
14
15
defineTypeNameAndDebug
(DAOutputFunction, 0);
16
addToRunTimeSelectionTable
(DAOutput, DAOutputFunction, dictionary);
17
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
18
19
DAOutputFunction::DAOutputFunction
(
20
const
word outputName,
21
const
word outputType,
22
fvMesh&
mesh
,
23
const
DAOption
& daOption,
24
DAModel
& daModel,
25
const
DAIndex
& daIndex,
26
DAResidual
& daResidual,
27
UPtrList<DAFunction>& daFunctionList)
28
:
DAOutput
(
29
outputName,
30
outputType,
31
mesh
,
32
daOption,
33
daModel,
34
daIndex,
35
daResidual,
36
daFunctionList)
37
{
38
}
39
40
void
DAOutputFunction::run
(scalarList& output)
41
{
42
/*
43
Description:
44
Compute the function value and assign them to the output array
45
*/
46
47
word functionName =
outputName_
;
48
49
label idxI = this->
getFunctionListIndex
(functionName,
daFunctionList_
);
50
DAFunction
& daFunction =
daFunctionList_
[idxI];
51
52
// compute the objective function
53
scalar fVal = daFunction.
calcFunction
();
54
55
output[0] = fVal;
56
}
57
58
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59
60
}
// End namespace Foam
61
62
// ************************************************************************* //
Foam::DAOption
Definition:
DAOption.H:29
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(DAFunction, DAFunctionForce, dictionary)
DAOutputFunction.H
Foam::DAOutputFunction::run
virtual void run(scalarList &output)
Definition:
DAOutputFunction.C:40
Foam::DAOutput::daFunctionList_
UPtrList< DAFunction > & daFunctionList_
Definition:
DAOutput.H:63
mesh
fvMesh & mesh
Definition:
createRefsHeatTransfer.H:4
Foam::DAOutput::outputName_
const word outputName_
name of the output
Definition:
DAOutput.H:44
Foam::DAIndex
Definition:
DAIndex.H:32
Foam::DAOutput
Definition:
DAOutput.H:32
Foam::DAModel
Definition:
DAModel.H:57
Foam::DAFunction
Definition:
DAFunction.H:31
Foam::DAFunction::calcFunction
virtual scalar calcFunction()=0
calculate the value of objective function
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(DAFunction, 0)
Foam
Definition:
checkGeometry.C:32
Foam::DAOutputFunction::DAOutputFunction
DAOutputFunction(const word outputName, const word outputType, fvMesh &mesh, const DAOption &daOption, DAModel &daModel, const DAIndex &daIndex, DAResidual &daResidual, UPtrList< DAFunction > &daFunctionList)
Definition:
DAOutputFunction.C:19
Foam::DAResidual
Definition:
DAResidual.H:36
Foam::DAOutputFunction::getFunctionListIndex
label getFunctionListIndex(const word functionName, UPtrList< DAFunction > &daFunctionList)
return the index of a give functionName in daFunctionList
Definition:
DAOutputFunction.H:53
Generated by
1.8.17