Loading...
Searching...
No Matches
23burgers Directory Reference

Files

 
23burgers.C

Detailed Description

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 "Burgers.H"
#include "ITHACAPOD.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:

class tutorial23: public Burgers
{
public:
explicit tutorial23(int argc, char* argv[])
: Burgers(argc, argv), U(_U()) {}
volVectorField& U;
void offlineSolve(word folder = "./ITHACAoutput/Offline/")
{
if (offline)
{
}
else
{
truthSolve(folder);
}
}
};
Implementation of a parametrized full order Burgers and preparation of the the reduced matrices for...
Definition Burgers.H:58
PtrList< volVectorField > Ufield
List of pointers used to form the velocity snapshots matrix.
Definition Burgers.H:73
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.
Definition 23burgers.C:44
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:

tutorial23 train(argc, argv);
train._runTime());
int NmodesUout = para->ITHACAdict->lookupOrDefault<int>("NmodesUout", 15);
train.offlineSolve();
ITHACAPOD::getModes(train.Ufield, train.Umodes, train._U().name(),
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.
Definition ITHACAPOD.C:93

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.