35#ifndef sequentialIHTP_H
36#define sequentialIHTP_H
39#include "interpolation.H"
41#include "simpleControl.H"
51#include "mixedFvPatchFields.H"
52#include "cellDistFuncs.H"
55#define _USE_MATH_DEFINES
57using namespace SPLINTER;
60class sequentialIHTP:
public laplacianProblem
67 sequentialIHTP(
int argc,
char* argv[]);
69 virtual ~sequentialIHTP() {};
75 autoPtr<volScalarField>
_T;
76 PtrList<volScalarField> Ttime;
77 List<PtrList<volScalarField>> Tbasis;
80 autoPtr<volScalarField>
_Tad;
81 PtrList<volScalarField> Tad_time;
82 PtrList<volScalarField> T0_time;
95 autoPtr<Time> _runTimeShort;
148 List<scalar> timeSteps;
211 bool offlineFlag = 0;
212 bool interpolationFlag = 0;
217 scalar homogeneousBC = 0.0;
218 List<scalar> homogeneousBCcoldSide;
220 List<scalar> refGrad;
221 List<scalar> valueFraction;
230 List<List<scalar>>
g;
261 Eigen::VectorXd addSol;
262 Eigen::VectorXd T0_vector;
263 Eigen::VectorXd Tcomp;
264 Eigen::MatrixXd Theta;
265 word timeBasisType =
"None";
269 scalar Tikhonov_filter;
272 List<vector> thermocouplesPos;
273 List<int> thermocouplesCellID;
274 List<int> thermocouplesCellProc;
275 List<Foam::vector> thermocouplesCellC;
276 Eigen::VectorXd Tmeas;
279 Eigen::VectorXd Tdirect;
280 Eigen::VectorXd Tdiff;
292 void setSpaceBasis(word type, scalar shapeParameter, label Npod = 0);
299 scalar shapeParameter_space);
304 volScalarField
list2Field(List<scalar> list, scalar innerField = 0.0);
345 Eigen::VectorXd
reconstrucT(Eigen::VectorXi cells);
351 void parameterizedBC(word folder, volScalarField initialField);
373 virtual void solveT0(volScalarField initialField);
493 void parameterizedBC_postProcess(List<Eigen::MatrixXd> linSys,
494 Eigen::VectorXd weigths, word outputFolder, label verbose = 0);
Header file of the Foam2Eigen class.
Header file of the ITHACAregularization class, it contains the implementation of several methods for ...
Header file of the ITHACAutilities namespace.
Class for the definition of some general parameters, the parameters must be defined from the file ITH...
virtual void readThermocouples()
Identifies in the mesh the cells corresponding to the termocouples locations.
void parameterizedBCoffline(bool force=0)
Performs offline computation for the parameterized BC method, if the offline directory "".
Eigen::MatrixXd T0explicitMatrix_red
T0 reduced explicit matrix.
label timeSamplesNum
Number of time samples (filled in createThermocouples.H).
label NbasisInTime
Number of basis in time.
label coldSide_ind
Index of the coldSide patch.
Eigen::VectorXd pointTad_reconstructed
Reconstruction of Tsd at the magic points.
scalar diffusivity
Diffusivity value.
virtual void assignT0_IF(volScalarField &T0_init)=0
Set IF of the T0 problem.
double HTC
Heat transfer coefficient [W/(m2 K)].
scalar timeSamplesDeltaT
Time interval in between samples (read from thermocouplesDict).
double specificHeat
Specific heat capacity [J/kg/K].
void restartT0()
Restart fields.
int NmodesT0
Number of POD modes.
void restartOffline()
Restart fields.
int thermocouplesNum
Number of thermocouples.
void T0offline(int NmagicPoints)
Assemble all the matrices required in the online phase.
dimensionedScalar DT
Dummy thermal diffusivity with unitary value.
volScalarModes T0modes
List of POD modes.
Eigen::VectorXd Jlist
List of cost funtions [K^2].
label hotSide_ind
Index of the hotSide patch.
Eigen::MatrixXd Tbasis_projectionMat
Projection of the Tbasis on the reduced space.
int gBasisSize
Number of heat flux bases (both in time and space).
label timeSampleI
Time sample index.
Eigen::VectorXd Tad_projected
Projection of Tad on the reduced space.
Eigen::MatrixXd pointsReconstructMatrix
Matrix that reconstruct some points into the full order space.
List< List< scalar > > gTrue
True heat flux at hotSide [W/m2].
label NtimestepsInSequence
Number of timesteps considered in each acquisition sequence.
List< scalar > gWeightsOld
Weights of the parameterization.
void reconstrucT(word outputFolder)
Reconstructs the temperature field using superposition of effects.
PtrList< volScalarField > projectionErrorTad
L2 norm of the projection error of Tad on the T0 modes.
Eigen::MatrixXd T0implicitMatrix_red
T0 reduced implicit matrix.
List< List< scalar > > interpolateWeights(List< scalar > Wold, List< scalar > Wnew)
double thermalCond
Thermal conductivity [W/(m K)].
PtrList< volScalarField > projectionErrorTbasis
L2 norm of the projection error of Tbasis on the T0 modes.
void findMagicPoints(int NmagicPoints)
Find the points at with the projection error is computed.
List< List< scalar > > heatFluxSpaceBasis
Heat flux space basis.
PtrList< volScalarField > T0field
List of snapshots for the T0 solutions.
word folderOffline
Folder where the offline solutions are saved.
List< List< List< scalar > > > gBaseFunctions
Bases of the heat flux.
scalar startTime
Time discretization (filled in the constructor).
void solveAdditional()
Set BC and IF of the additional problem for the parameterized heat flux.
void projectionErrorOffline()
Compute the L2 norm of the projection error for each Tbasis and Tad.
autoPtr< volScalarField > _T
Temperature field.
List< label > magicPoints
Magic points for the T0 projection error estimation.
void update_gParametrized(List< scalar > weights)
Update the boundary condition g when g is parameterized.
virtual void solveT0(volScalarField initialField)
Solve the T0 problem.
void sampling2symulationTime()
Fills the vector samplingSteps which contains the timesteps at which the measurements are taken.
label NbasisInSpace
Number of basis in space.
List< scalar > samplingTime
List of times at which the measurements are acquired (this List is filled by readThermocouples()).
bool thermocouplesRead
1 if readThermocouples() was called, 0 elsewise
autoPtr< volScalarField > _Tad
Additional temperature field.
double J
Cost funtion [K^2].
label basisDeltaSample
Number of sampling steps to consider when computing offline phase.
autoPtr< Time > _runTime
Time.
void set_gParametrized(word spaceBaseFuncType, scalar shapeParameter_space)
Set parameterized heat flux defining the basis.
Eigen::VectorXd residual
Parametrized BC.
volScalarField list2Field(List< scalar > list, scalar innerField=0.0)
Convert list of boundary heat flux into field.
scalar offlineEndTime
End time for the ofline computation.
void setDiffusivity(scalar _diff)
Set diffusivity.
void projectT0()
Project T0 matrices onto the reduced spaced.
void projectDirectOntoT0()
Assemble the matrices to go from the gWeights to the T0 reduced space.
autoPtr< fvMesh > _mesh
Mesh.
scalar timeSamplesT0
First sampling time (read from thermocouplesDict).
List< List< scalar > > g
Heat flux at hotSide.
List< label > samplingSteps
List of timesteps at which measurements are available.
Eigen::VectorXd fieldValueAtThermocouples(volScalarField &field)
Interpolates the field value at the thermocouples points NOTE: do NOT call whe field is an element of...
label NtimeStepsBetweenSamples
Number of timesteps between two samples.
label offlineTimestepsSize
Number of timestep to solve for during offline phase.
autoPtr< simpleControl > _simple
simpleControl
label Nbasis
Number of basis.
autoPtr< fv::options > _fvOptions
fvOptions
virtual void assignDirectBC(label timeI)
Set BC of the direct problem.
Eigen::MatrixXd pointTbasis_reconstructionMat
Matrix that reconstructs the Tbasis at the magic points.
void solveDirect()
Solve direct problem.
label NsamplesWindow
Number of samples considered in the offline phase.
void set_valueFraction()
Set valueFraction list values for Robin condition.
double density
Density [kg /m3].
void pointProjectionOffline()
Assemble the matrix pointsProjectionMatrix to project some points on the reduced basis space.
List< scalar > gWeights
Weights of the parameterization.
void setSpaceBasis(word type, scalar shapeParameter, label Npod=0)
Define the base functions used for the parametrization of g.
void getT0modes()
Compute T0 modes prome snapshots.
void restart()
Restart temperature field.
Header file of the laplacianProblem class.