Loading...
Searching...
No Matches
inverseLaplacianProblem.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ██╗████████╗██╗ ██╗ █████╗ ██████╗ █████╗ ███████╗██╗ ██╗
3 ██║╚══██╔══╝██║ ██║██╔══██╗██╔════╝██╔══██╗ ██╔════╝██║ ██║
4 ██║ ██║ ███████║███████║██║ ███████║█████╗█████╗ ██║ ██║
5 ██║ ██║ ██╔══██║██╔══██║██║ ██╔══██║╚════╝██╔══╝ ╚██╗ ██╔╝
6 ██║ ██║ ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ╚████╔╝
7 ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═══╝
8
9 * In real Time Highly Advanced Computational Applications for Finite Volumes
10 * Copyright (C) 2017 by the ITHACA-FV authors
11-------------------------------------------------------------------------------
12License
13 This file is part of ITHACA-FV
14 ITHACA-FV is free software: you can redistribute it and/or modify
15 it under the terms of the GNU Lesser General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18 ITHACA-FV is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU Lesser General Public License for more details.
22 You should have received a copy of the GNU Lesser General Public License
23 along with ITHACA-FV. If not, see <http://www.gnu.org/licenses/>.
24Class
25 inverseLaplacianProblem
26Description
27 A general full order implementation of an inverse boundary condition estimation
28 problem
29SourceFiles
30 inverseLaplacianProblem.C
31\*---------------------------------------------------------------------------*/
32
37
38
39#ifndef inverseLaplacianProblem_H
40#define inverseLaplacianProblem_H
41#include <iostream>
42#include "fvCFD.H"
43#include "interpolation.H"
44#include "fvOptions.H"
45#include "simpleControl.H"
46#include "IOmanip.H"
47#include "Time.H"
48#include "laplacianProblem.H"
49#include "ITHACAPOD.H"
50#include "ITHACAutilities.H"
52#include <Eigen/Dense>
53#include <cmath>
54#include "Foam2Eigen.H"
55#include "cnpy.H"
56#include "mixedFvPatchFields.H"
57#include "cellDistFuncs.H"
58#include "reductionProblem.H"
59#include "Modes.H"
60#define _USE_MATH_DEFINES
61
62
63// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64
65/*---------------------------------------------------------------------------*\
66 Class inverseLaplacianProblem Declaration
67\*---------------------------------------------------------------------------*/
68
70
75{
76
77 public:
78 // Constructors
82 inverseLaplacianProblem(int argc, char* argv[]);
85
87
89 autoPtr<volScalarField> _T;
90
92 mutable autoPtr<fvMesh> _mesh;
93
95 autoPtr<simpleControl> _simple;
96
98 autoPtr<fv::options> _fvOptions;
99
101 autoPtr<Time> _runTime;
102
104 dimensionedScalar DT;
105
107 double k;
108
110 double H;
111
114
117
119 double J;
120 double L2norm;
121 double LinfNorm;
122
124 scalar homogeneousBC = 0.0;
125
128
130 List<scalar> Tf;
131
133 List<scalar> refGrad;
134
136 List<scalar> valueFraction;
137
140
143
145 List<scalar> g;
146
148 List<List<scalar>> gList;
149
151 List<scalar> gTrue;
152
154 List<scalar> faceCellArea;
155
157 List<vector> thermocouplesPos;
158
161
164
166 Eigen::VectorXd Tmeas;
167
169 Eigen::VectorXd Tdirect;
170
172 Eigen::VectorXd Tdiff;
173
175 label nProcs;
176
177
178 // Functions
179
180 //--------------------------------------------------------------------------
183 void set_g();
184
185 //--------------------------------------------------------------------------
194 volScalarField list2Field(List<scalar> list, scalar innerField = 0.0);
195
196 //--------------------------------------------------------------------------
199 void set_valueFraction();
200
201 //--------------------------------------------------------------------------
205 virtual void solveTrue() {};
206
207 //--------------------------------------------------------------------------
209 virtual void assignDirectBC();
210
211 //--------------------------------------------------------------------------
214 void solveDirect();
215
216 //--------------------------------------------------------------------------
219 void solve(const char* problem);
220
221 //--------------------------------------------------------------------------
225 virtual void readThermocouples();
226
227 //--------------------------------------------------------------------------
234 Eigen::VectorXd fieldValueAtThermocouples(volScalarField& field);
235
236 //--------------------------------------------------------------------------
241
242 //--------------------------------------------------------------------------
253 Foam::vector cellDim(const faceList& ff, const pointField& pp,
254 const cell& cc, labelList pLabels, pointField pLocal);
255
256 //--------------------------------------------------------------------------
259 void restart();
260};
261
262#endif
Header file of the Foam2Eigen class.
Header file of the ITHACAPOD class.
Header file of the ITHACAregularization class, it contains the implementation of several methods for ...
Header file of the ITHACAutilities namespace.
Header file of the Modes class.
TEqn solve()
Class for the definition of some general parameters, the parameters must be defined from the file ITH...
Implementation of a inverse Laplacian problem .
Eigen::VectorXd Tdiff
Difference between computed and measured temperatures at the thermocouples.
label hotSide_ind
Index of the hotSide patch.
dimensionedScalar DT
Dummy thermal conductivity with unitary value.
List< vector > thermocouplesPos
List containing the positions of the thermocouples.
double H
Heat transfer coefficient [W/(m2 K)].
List< scalar > Tf
Temperature at coldSide [K].
virtual ~inverseLaplacianProblem()
Destructor.
autoPtr< simpleControl > _simple
simpleControl
List< scalar > g
Heat flux at hotSide [W/m2].
bool thermocouplesRead
Flag to know if thermocouples file was read.
List< scalar > faceCellArea
List of patch faces areas [m2].
autoPtr< fv::options > _fvOptions
fvOptions
double J
Cost funtion [K^2].
Eigen::VectorXd Tdirect
Vector of computed temperatures at the thermocouples locations [K].
List< scalar > homogeneousBCcoldSide
List of zeros of the size of coldSide patch.
List< scalar > valueFraction
Value fraction for the Robin BC.
scalar homogeneousBC
Homogenerous BC.
volScalarField list2Field(List< scalar > list, scalar innerField=0.0)
Create a field with the hotSide boundary heat flux at the hotSide bounday cells for visualization.
Eigen::VectorXd Tmeas
Vector of measured temperatures at the thermocouples locations [K].
virtual void assignDirectBC()
Set boundary condition of the direct problem.
List< List< scalar > > gList
List of boundary heat fluxes.
void set_valueFraction()
Set valueFraction list values for Robin condition.
Foam::vector cellDim(const faceList &ff, const pointField &pp, const cell &cc, labelList pLabels, pointField pLocal)
Compute maximum cell dimension in x, y and z.
void set_g()
Set the right g size and fills it with zeros.
label coldSide_ind
Index of the coldSide patch.
autoPtr< fvMesh > _mesh
Mesh.
Eigen::VectorXd fieldValueAtThermocouples(volScalarField &field)
Interpolates the field value at the thermocouples points.
List< scalar > gTrue
True heat flux at hotSide [w/m2].
List< scalar > refGrad
Reference gradient for the Robin BC.
List< int > thermocouplesCellProc
List of incedes of the processors contining each thermocouple.
virtual void readThermocouples()
Identifies in the mesh the cells corresponding to the termocouples locations.
inverseLaplacianProblem()
Null constructor.
void differenceBetweenDirectAndMeasure()
Computes the difference between direct problem solution and measures Saves the difference vector in T...
int thermocouplesNum
Number of thermocouples.
double k
Thermal diffusivity [W/(m K)].
virtual void solveTrue()
Solve the direct problem with the true heat flux as boundary condition and fills the measured temepra...
void solveDirect()
Solve direct problem.
label nProcs
Number of processors.
autoPtr< volScalarField > _T
Temperature field.
List< int > thermocouplesCellID
List of cells indices containing a thermocouple.
Class to implement a full order laplacian parametrized problem.
Header file of the laplacianProblem class.
Header file of the reductionProblem class.