Introduction
This tutorial considers a parameterized heat-transfer–type problem based on the Burgers equation. Although the class name is Burgers, the implemented equations are scalar advection–diffusion; the objective is to compute a reduced basis for the velocity field using a simple offline/online split.
A detailed look into the code
This section explains the code of tutorial 23.
Header files
The program includes both standard and ITHACA-FV headers:
#include <iostream>
#include "fvCFD.H"
#include "IOmanip.H"
#include "Time.H"
#include <Eigen/Dense>
Header file of the Burgers class.
Header file of the ITHACAPOD class.
<Burgers.H> defines the full-order problem derived from laplacianProblem.
Implementation
The tutorial23 class inherits from Burgers and stores a reference to the velocity field U:
{
public:
volVectorField& U;
void offlineSolve(word folder = "./ITHACAoutput/Offline/")
{
{
}
else
{
}
}
};
Implementation of a parametrized full order Burgers and preparation of the the reduced matrices for...
PtrList< volVectorField > Ufield
List of pointers used to form the velocity snapshots matrix.
bool offline
Boolean variable, it is 1 if the Offline phase has already been computed, else 0.
void truthSolve()
Perform a TruthSolve.
Class where the tutorial number 2 is implemented.
void readMiddleFields(PtrList< GeometricField< Type, PatchField, GeoMesh > > &Lfield, GeometricField< Type, PatchField, GeoMesh > &field, fileName casename)
Funtion to read a list of volVectorField from name of the field including all the intermediate snapsh...
During offline execution the code either reads existing snapshots or runs the full-order solver once and saves the resulting velocity fields.
Main function
In main the tutorial object is created and POD mode numbers are extracted from the dictionary file:
train._runTime());
int NmodesUout = para->ITHACAdict->lookupOrDefault<int>("NmodesUout", 15);
train.offlineSolve();
train.podex, 0, 0, NmodesUout);
Class for the definition of some general parameters, the parameters must be defined from the file ITH...
static ITHACAparameters * getInstance()
Gets an instance of ITHACAparameters, to be used if the instance is already existing.
void getModes(PtrList< GeometricField< Type, PatchField, GeoMesh > > &snapshots, PtrList< GeometricField< Type, PatchField, GeoMesh > > &modes, word fieldName, bool podex, bool supex, bool sup, label nmodes, bool correctBC)
Computes the bases or reads them for a field.
The reduced velocity basis is written to train.Umodes and can subsequently be used for online reduced computations.
The plain code
The plain code is available here.