The .h that includes all functions headers. More...
#include "carmen.pre"
#include "PreProcessor.h"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include "Vector.h"
#include "Matrix.h"
#include "Timer.h"
#include "Parameters.h"
#include "PrintGrid.h"
#include "TimeAverageGrid.h"
#include "Cell.h"
#include "Node.h"
#include "FineMesh.h"
Go to the source code of this file.
Macros | |
#define | Max(x, y) (((x) > (y)) ? (x):(y)) |
#define | Max3(x, y, z) (Max((x),Max((y),(z)))) |
#define | Min(x, y) (((x) < (y)) ? (x):(y)) |
#define | Min3(x, y, z) (Min((x),Min((y),(z)))) |
#define | power2(x) ((x)*(x)) |
#define | power3(x) ((x)*(x)*(x)) |
#define | Abs(x) ( ((x) < 0)? -(x):(x) ) |
Functions | |
void | AdaptTimeStep () |
Adapts time step when required. More... | |
int | BC (int i, int AxisNo, int N=(1<< ScaleNb)) |
Returns the position of i taking into account the boundary conditions in the direction AxisNo. The number of points in this direction is N. Example: for AxisNo=1 and for N=256, i must be between 0 and 255. If i=-1, the function returns 255 for periodic boundary conditions and 0 for Neumann boundary conditions. More... | |
int | BoundaryRegion (const Vector &X) |
Returns the boundary region type at the position X=(x,y,z). The returned value correspond to: 0 = Fluid (not in the boundary) 1 = Inflow 2 = Outflow 3 = Solid with free-slip walls 4 = Solid with adiabatic walls 5 = Solid with isothermal walls. More... | |
void | Backup (Node *Root) |
Stores the tree structure and data in order to restart a multiresolution computation. More... | |
void | Backup (FineMesh *Root) |
Stores the data countained in a regular mesh Root in order to restart a finite volume computation. More... | |
double | CPUTimeRef (int iterations, int scales) |
Returns the time required by a finite volume computation using iterations iterations and scales scales. It is use to estimate the CPU time compression. More... | |
real | ComputedTolerance (const int ScaleNo) |
Returns the computed tolerance at the scale ScaleNo, either using Harten or Donoho thresholding (if CVS=true). More... | |
int | DigitNumber (int arg) |
Returns the number of digits of the integer arg. More... | |
int | FileWrite (FILE *f, const char *format, real arg) |
Writes in binary or ASCII mode the real number arg into the file f with the format format. The global parameter DataIsBinary determines this choice. More... | |
Vector | Flux (Cell &Cell1, Cell &Cell2, Cell &Cell3, Cell &Cell4, int AxisNo) |
Returns the flux at the interface between Cell2 and Cell3. Here a 4-point space scheme is used. Cell2 and Cell3 are the first neighbours on the left and right sides. Cell1 and Cell4 are the second neighbours on the left and right sides. More... | |
void | GetBoundaryCells (Cell &Cell1, Cell &Cell2, Cell &Cell3, Cell &Cell4, Cell &C1, Cell &C2, Cell &C3, Cell &C4, int AxisNo) |
Transform the 4 cells of the flux Cell1, Cell2, Cell3, Cell4 into C1, C2, C3, C4, to take into account boundary conditions (used in Flux.cpp). More... | |
Vector | InitAverage (real x, real y=0., real z=0.) |
Returns the initial condition in (x, y, z) form the one defined in carmen.ini. More... | |
real | InitResistivity (real x, real y=0., real z=0.) |
Returns the initial resistivity condition in (x, y, z) form the one defined in carmen.eta. More... | |
void | InitParameters () |
Inits parameters from file carmen.par. If a parameter is not mentioned in this file, the default value is used. More... | |
void | InitTimeStep () |
Inits time step and all the parameters which depend on it. More... | |
void | InitTree (Node *Root) |
Inits tree structure from initial condition, starting form the node Root. Only for multiresolution computations. More... | |
Vector | Limiter (const Vector u, const Vector v) |
Returns the value of the slope limiter between the slopes u and v. More... | |
real | Limiter (const real x) |
Returns the valur of slope limiter from a real value x. More... | |
real | MinAbs (const real a, const real b) |
Returns the minimum in module of a and b. More... | |
real | NormMaxQuantities (const Vector &V) |
Returns the Max-norm of the vector where every quantity is divided by its characteristic value. More... | |
void | Performance (const char *FileName) |
Computes the performance of the computation and, for cluster computations, write it into file FileName. More... | |
void | PrintIntegral (const char *FileName) |
Writes the integral values, like e.g flame velocity, global error, into file FileName. More... | |
void | RefreshTree (Node *Root) |
Refresh the tree structure, i.e. compute the cell-averages of the internal nodes by projection and those of the virtual leaves by prediction. The root node is Root. Only for multiresolution computations. More... | |
void | Remesh (Node *Root) |
Remesh the tree structure after a time evolution. The root node is Root. Only for multiresolution computations. More... | |
Vector | FluxX (const Vector &Avg) |
Returns the physical flux of MHD equations in X direction. More... | |
Vector | FluxY (const Vector &Avg) |
Returns the physical flux of MHD equations in Y direction. More... | |
Vector | FluxZ (const Vector &Avg) |
Returns the physical flux of MHD equations in Z direction. More... | |
Vector | SchemeHLL (const Cell &Cell1, const Cell &Cell2, const Cell &Cell3, const Cell &Cell4, const int AxisNo) |
Returns the HLL numerical flux for MHD equations. The scheme uses four cells to estimate the flux at the interface. Cell2 and Cell3 are the first neighbours on the left and right sides. Cell1 and Cell4 are the second neighbours on the left and right sides. More... | |
Vector | SchemeHLLD (const Cell &Cell1, const Cell &Cell2, const Cell &Cell3, const Cell &Cell4, const int AxisNo) |
Returns the HLLD numerical flux for MHD equations. The scheme uses four cells to estimate the flux at the interface. Cell2 and Cell3 are the first neighbours on the left and right sides. Cell1 and Cell4 are the second neighbours on the left and right sides. More... | |
Matrix | stateUstar (const Vector &AvgL, const Vector &AvgR, const real prel, const real prer, real &slopeLeft, real &slopeRight, real &slopeM, real &slopeLeftStar, real &slopeRightStar, int AxisNo) |
Returns the intermediary states of HLLD numerical flux for MHD equations. More... | |
void | fluxCorrection (Vector &Flux, const Vector &AvgL, const Vector &AvgR, int AxisNo) |
This function apply the divergence-free correction to the numerical flux. More... | |
void | ShowTime (Timer arg) |
Writes on screen the estimation of total and remaining CPU times. These informations are stored in the timer arg. More... | |
int | Sign (const real a) |
Returns 1 if a is non-negative, -1 elsewhere. More... | |
Vector | ArtificialViscosity (const Vector &Cell1, const Vector &Cell2, real dx, int AxisNo) |
Returns the artificial diffusion source terms in the cell UserCell. More... | |
Vector | ResistiveTerms (Cell &Cell1, Cell &Cell2, Cell &Cell3, Cell &Cell4, int AxisNo) |
Returns the resistive source terms in the cell UserCell. More... | |
Vector | Source (Cell &UserCell) |
Returns the source term in the cell UserCell. More... | |
real | Step (real x) |
Returns a step (1 if x <0, 0 if x >0, 0.5 if x=0) More... | |
void | TimeEvolution (FineMesh *Root) |
Computes a time evolution on the regular fine mesh Root. Only for finite volume computations. More... | |
void | TimeEvolution (Node *Root) |
Computes a time evolution on the tree structure, the root node being Root. Only for multiresolution computations. More... | |
void | View (FineMesh *Root, const char *AverageFileName) |
Writes the current cel–averages of the fine mesh Root into file AverageFileName. Only for finite volume computations. More... | |
void | View (Node *Root, const char *TreeFileName, const char *MeshFileName, const char *AverageFileName) |
Writes the data of the tree structure into files TreeFileName (tree structure), MeshFileName (mesh) and AverageFileName (cell-averages). The root node is Root. Only for multiresolution computations. More... | |
void | ViewEvery (FineMesh *Root, int arg) |
Same as previous for a fine mesh Root. Only for finite volume computations. More... | |
void | ViewEvery (Node *Root, int arg) |
Writes into file the data of the tree structure at iteration arg. The output file names are AverageNNN.dat and MeshNNN.dat, NNN being the iteration in an accurate format. The root node is Root. Only for multiresolution computations. More... | |
void | ViewIteration (FineMesh *Root) |
Same as previous for a fine mesh Root. Only for finite volume computations. More... | |
void | ViewIteration (Node *Root) |
Writes into file the data of the tree structure from physical time PrintTime1 to physical time PrintTime6. The output file names are Average_N.dat and Mesh_N.dat, N being between 1 and 6. The root node is Root. Only for multiresolution computations. More... | |
void | CreateMPIType (FineMesh *Root) |
void | CPUExchange (FineMesh *Root, int) |
Parallel function DOES NOT WORK! More... | |
void | FreeMPIType () |
Parallel function DOES NOT WORK! More... | |
void | CreateMPITopology () |
Parallel function DOES NOT WORK! More... | |
void | CreateMPILinks () |
Parallel function DOES NOT WORK! More... | |
void | ReduceIntegralValues () |
Parallel function DOES NOT WORK! More... | |
The .h that includes all functions headers.
#define Abs | ( | x | ) | ( ((x) < 0)? -(x):(x) ) |
Returns the absolute value of x.
#define Max | ( | x, | |
y | |||
) | (((x) > (y)) ? (x):(y)) |
Returns the Maximum value between x and y.
#define Min | ( | x, | |
y | |||
) | (((x) < (y)) ? (x):(y)) |
Returns the mininum value between x and y.
#define power2 | ( | x | ) | ((x)*(x)) |
Returns the square of x.
#define power3 | ( | x | ) | ((x)*(x)*(x)) |
Returns the cube of x.
void AdaptTimeStep | ( | ) |
Adapts time step when required.
Returns the artificial diffusion source terms in the cell UserCell.
Cell1 | Left cell value |
Cell2 | Right cell value |
AxisNo | Axis of interest |
X - direction
Y - direction
Z - direction
void Backup | ( | Node * | Root | ) |
Stores the tree structure and data in order to restart a multiresolution computation.
Root denotes the pointer to the first node of the tree structure.
Root | Root |
void Backup | ( | FineMesh * | Root | ) |
Stores the data countained in a regular mesh Root in order to restart a finite volume computation.
Root | Root |
int BC | ( | int | i, |
int | AxisNo, | ||
int | N = (1<< ScaleNb) |
||
) |
Returns the position of i taking into account the boundary conditions in the direction AxisNo. The number of points in this direction is N.
Example: for AxisNo=1 and for N=256, i must be between 0 and 255. If i=-1, the function returns 255 for periodic boundary conditions and 0 for Neumann boundary conditions.
i | Position |
AxisNo | Axis of interest |
N | Defaults to (1<<ScaleNb). |
int BoundaryRegion | ( | const Vector & | X | ) |
Returns the boundary region type at the position X=(x,y,z).
The returned value correspond to: 0 = Fluid (not in the boundary) 1 = Inflow 2 = Outflow 3 = Solid with free-slip walls 4 = Solid with adiabatic walls 5 = Solid with isothermal walls.
X | Vector |
real ComputedTolerance | ( | const int | ScaleNo | ) |
Returns the computed tolerance at the scale ScaleNo, either using Harten or Donoho thresholding (if CVS=true).
ScaleNo | Level of interest. |
void CPUExchange | ( | FineMesh * | Root, |
int | |||
) |
Parallel function DOES NOT WORK!
Root | Fine mesh |
double CPUTimeRef | ( | int | iterations, |
int | scales | ||
) |
Returns the time required by a finite volume computation using iterations iterations and scales scales. It is use to estimate the CPU time compression.
iterations | Number of iterations. |
scales | Scales |
void CreateMPILinks | ( | ) |
Parallel function DOES NOT WORK!
void CreateMPITopology | ( | ) |
Parallel function DOES NOT WORK!
void CreateMPIType | ( | FineMesh * | Root | ) |
int DigitNumber | ( | int | arg | ) |
int FileWrite | ( | FILE * | f, |
const char * | format, | ||
real | arg | ||
) |
Writes in binary or ASCII mode the real number arg into the file f with the format format. The global parameter DataIsBinary determines this choice.
f | File name |
format | Format |
arg | Argument |
Returns the flux at the interface between Cell2 and Cell3. Here a 4-point space scheme is used. Cell2 and Cell3 are the first neighbours on the left and right sides. Cell1 and Cell4 are the second neighbours on the left and right sides.
Cell1 | second neighbour on the left side |
Cell2 | first neighbour on the left side |
Cell3 | first neighbour on the right side |
Cell4 | second neighbour on the right side |
AxisNo | Axis of interest |
This function apply the divergence-free correction to the numerical flux.
Flux | Numerical flux vector |
AvgL | Left average vector |
AvgR | Right average vector |
AxisNo | Axis of interest |
Returns the physical flux of MHD equations in X direction.
Avg | Average vector. |
Returns the physical flux of MHD equations in Y direction.
Avg | Average vector. |
Returns the physical flux of MHD equations in Z direction.
Avg | Average vector. |
void FreeMPIType | ( | ) |
Parallel function DOES NOT WORK!
void GetBoundaryCells | ( | Cell & | Cell1, |
Cell & | Cell2, | ||
Cell & | Cell3, | ||
Cell & | Cell4, | ||
Cell & | C1, | ||
Cell & | C2, | ||
Cell & | C3, | ||
Cell & | C4, | ||
int | AxisNo | ||
) |
Transform the 4 cells of the flux Cell1, Cell2, Cell3, Cell4 into C1, C2, C3, C4, to take into account boundary conditions (used in Flux.cpp).
Cell1 | second neighbour on the left side |
Cell2 | first neighbour on the left side |
Cell3 | first neighbour on the right side |
Cell4 | second neighbour on the right side |
C1 | Auxiliar cell1 |
C2 | Auxiliar cell2 |
C3 | Auxiliar cell3 |
C4 | Auxiliar cell4 |
AxisNo | ... |
Returns the initial condition in (x, y, z) form the one defined in carmen.ini.
x | Position x |
y | Position y. Defaults to 0.. |
z | Position z. Defaults to 0.. |
void InitParameters | ( | ) |
Inits parameters from file carmen.par. If a parameter is not mentioned in this file, the default value is used.
— Compute ch --------------------------------------------------------—
Returns the initial resistivity condition in (x, y, z) form the one defined in carmen.eta.
x | Position x |
y | Position y. Defaults to 0.. |
z | Position z. Defaults to 0.. |
void InitTimeStep | ( | ) |
Inits time step and all the parameters which depend on it.
void InitTree | ( | Node * | Root | ) |
Inits tree structure from initial condition, starting form the node Root. Only for multiresolution computations.
Root | Root |
Returns the value of the slope limiter between the slopes u and v.
Returns the valur of slope limiter from a real value x.
x | ... |
Returns the Max-norm of the vector where every quantity is divided by its characteristic value.
V | Vector |
void Performance | ( | const char * | FileName | ) |
Computes the performance of the computation and, for cluster computations, write it into file FileName.
FileName | Name of the file. |
void PrintIntegral | ( | const char * | FileName | ) |
Writes the integral values, like e.g flame velocity, global error, into file FileName.
FileName | Name of the file |
void ReduceIntegralValues | ( | ) |
Parallel function DOES NOT WORK!
void RefreshTree | ( | Node * | Root | ) |
Refresh the tree structure, i.e. compute the cell-averages of the internal nodes by projection and those of the virtual leaves by prediction. The root node is Root. Only for multiresolution computations.
Root | Root |
void Remesh | ( | Node * | Root | ) |
Remesh the tree structure after a time evolution. The root node is Root. Only for multiresolution computations.
Root | Root |
Returns the resistive source terms in the cell UserCell.
X - direction
2D
Y - direction
2D
Z - direction
3D
Vector SchemeHLL | ( | const Cell & | Cell1, |
const Cell & | Cell2, | ||
const Cell & | Cell3, | ||
const Cell & | Cell4, | ||
const int | AxisNo | ||
) |
Returns the HLL numerical flux for MHD equations. The scheme uses four cells to estimate the flux at the interface. Cell2 and Cell3 are the first neighbours on the left and right sides. Cell1 and Cell4 are the second neighbours on the left and right sides.
Cell1 | second neighbour on the left side |
Cell2 | first neighbour on the left side |
Cell3 | first neighbour on the right side |
Cell4 | second neighbour on the right side |
AxisNo | Axis of interest. |
Vector SchemeHLLD | ( | const Cell & | Cell1, |
const Cell & | Cell2, | ||
const Cell & | Cell3, | ||
const Cell & | Cell4, | ||
const int | AxisNo | ||
) |
Returns the HLLD numerical flux for MHD equations. The scheme uses four cells to estimate the flux at the interface. Cell2 and Cell3 are the first neighbours on the left and right sides. Cell1 and Cell4 are the second neighbours on the left and right sides.
Cell1 | second neighbour on the left side |
Cell2 | first neighbour on the left side |
Cell3 | first neighbour on the right side |
Cell4 | second neighbour on the right side |
AxisNo | Axis of interest. |
void ShowTime | ( | Timer | arg | ) |
Writes on screen the estimation of total and remaining CPU times. These informations are stored in the timer arg.
arg | Argument |
int Sign | ( | const real | a | ) |
Matrix stateUstar | ( | const Vector & | AvgL, |
const Vector & | AvgR, | ||
const real | prel, | ||
const real | prer, | ||
real & | slopeLeft, | ||
real & | slopeRight, | ||
real & | slopeM, | ||
real & | slopeLeftStar, | ||
real & | slopeRightStar, | ||
int | AxisNo | ||
) |
Returns the intermediary states of HLLD numerical flux for MHD equations.
AvgL | Left average vector |
AvgR | Right average vector |
prel | Left pressure |
prer | Right pressure |
slopeLeft | Left slope |
slopeRight | Right slope |
slopeM | Slope value computed for HLLD |
slopeLeftStar | Left star slope (intermediary states) |
slopeRightStar | Right star slope (intermediary states) |
AxisNo | Axis of interest |
variables U-star
variables U-star-star
void TimeEvolution | ( | FineMesh * | Root | ) |
Computes a time evolution on the regular fine mesh Root. Only for finite volume computations.
Root | Fine mesh |
void TimeEvolution | ( | Node * | Root | ) |
Computes a time evolution on the tree structure, the root node being Root. Only for multiresolution computations.
Root | Root node |
void View | ( | FineMesh * | Root, |
const char * | AverageFileName | ||
) |
Writes the current cel–averages of the fine mesh Root into file AverageFileName. Only for finite volume computations.
Root | Fine mesh |
AverageFileName | File name |
void View | ( | Node * | Root, |
const char * | TreeFileName, | ||
const char * | MeshFileName, | ||
const char * | AverageFileName | ||
) |
Writes the data of the tree structure into files TreeFileName (tree structure), MeshFileName (mesh) and AverageFileName (cell-averages). The root node is Root. Only for multiresolution computations.
Root | Root node |
TreeFileName | Tree file name |
MeshFileName | Mesh file name |
AverageFileName | Average file name |
void ViewEvery | ( | FineMesh * | Root, |
int | arg | ||
) |
Same as previous for a fine mesh Root. Only for finite volume computations.
Root | Fine mesh |
arg | argument |
void ViewEvery | ( | Node * | Root, |
int | arg | ||
) |
Writes into file the data of the tree structure at iteration arg. The output file names are AverageNNN.dat and MeshNNN.dat, NNN being the iteration in an accurate format. The root node is Root. Only for multiresolution computations.
Root | Root node |
arg | Argument |
void ViewIteration | ( | FineMesh * | Root | ) |
Same as previous for a fine mesh Root. Only for finite volume computations.
Root | Fine mesh |
void ViewIteration | ( | Node * | Root | ) |
Writes into file the data of the tree structure from physical time PrintTime1 to physical time PrintTime6. The output file names are Average_N.dat and Mesh_N.dat, N being between 1 and 6. The root node is Root. Only for multiresolution computations.
Root | Root node |