Carmen Code
 All Classes Files Functions Variables Macros Pages
Public Member Functions | Public Attributes | List of all members
Cell Class Reference

An object Cell contains all the informations of a cell for both multiresolution and finite volume computations. More...

#include <Cell.h>

Collaboration diagram for Cell:
Collaboration graph
[legend]

Public Member Functions

 Cell ()
 Cell constructor. More...
 
 ~Cell ()
 Cell distructor. More...
 
void operator= (const Cell &C)
 Defines the cell operators. It is possible to obtain the cell values as: More...
 
void setSize (const int AxisNo, const real UserSize)
 Sets the size of the cell in the direction AxisNo to UserSize. Example: More...
 
void setSize (const Vector &UserSize)
 Sets the size of the cell in every direction to the vector UserSize . Example: More...
 
void setCenter (const int AxisNo, const real UserX)
 Sets the coordinate of the cell-center in the direction AxisNo to UserX. Example: More...
 
void setCenter (const Vector &UserX)
 Sets the position of the cell-center to the vector UserX. Example: More...
 
void setAverage (const int QuantityNo, const real UserAverage)
 Sets the cell-average of the quantity QuantityNo to UserAverage. Example: More...
 
void setAverage (const Vector &UserAverage)
 Sets all the cell-average quantities to the vector UserAverage. Example: More...
 
void setAverageZero ()
 Sets all the cell-average values to zero. More...
 
void setTempAverage (const int QuantityNo, const real UserAverage)
 Identical to setAverage (int QuantityNo, real UserAverage), but for the vector of the temporary cell-average values. More...
 
void setTempAverage (const Vector &UserAverage)
 Identical to void setAverage (const Vector& UserAverage), but for the vector of the temporary cell-average values. More...
 
void setTempAverageZero ()
 Sets all the temmporary cell-average values to zero. More...
 
void setLowAverage (const int QuantityNo, const real UserAverage)
 Identical to setAverage (int QuantityNo, real UserAverage), but for the vector of the cell-average values with low precision in the Runge-Kutta-Fehlberg method. More...
 
void setLowAverage (const Vector &UserAverage)
 Identical to void setAverage (const Vector& UserAverage), void setAverage (const Vector& UserAverage), but for the vector of the cell-average values with low precision in the Runge-Kutta-Fehlberg method. More...
 
void setOldAverage (const int QuantityNo, const real UserAverage)
 Identical to setAverage (int QuantityNo, real UserAverage), but for the vector of the old cell-average values. More...
 
void setOldAverage (const Vector &UserAverage)
 Identical to void setAverage (const Vector& UserAverage), but for the vector of the cell-average values. More...
 
void setDivergence (const int QuantityNo, const real UserAverage)
 Identical to void setAverage (int QuantityNo, real UserAverage), but for the divergence vector. More...
 
void setDivergence (const Vector &UserAverage)
 Identical to void setAverage (const Vector& UserAverage), but for the divergence vector. More...
 
void setPsiGrad (const int Dimension, const real UserAverage)
 Identical to void setAverage (int QuantityNo, real UserAverage), but for the gradient of psi vector. More...
 
void setPsiGrad (const Vector &UserAverage)
 Identical to void setAverage (int QuantityNo, real UserAverage), but for the gradient of psi vector. More...
 
void setRes (const real UserAverage)
 Set resistivity. More...
 
void setDivergenceZero ()
 Sets all the components of the divergence vector to zero. More...
 
void setGradient (const int i, const int j, const real UserAverage)
 Sets the component no. i, j of the quantity gradient to UserAverage. More...
 
void setTempGradient (const int i, const int j, const real UserAverage)
 Identical to the previous one for the temporary values. Does not work for MHD! More...
 
void setGradient (const Matrix &UserAverage)
 Sets the quantity gradient to the matrix UserAverage. Does not work for MHD! Example: More...
 
void setTempGradient (const Matrix &UserAverage)
 dentical to the previous one for the temporary values. More...
 
void setGradientZero ()
 Sets all the components of the velocity gradient to zero. More...
 
bool isInsideBoundary () const
 Returns true if the cell is inside the boundary. More...
 
bool isInFluid () const
 Returns true if the cell is inside the fluid. More...
 
real size (const int AxisNo) const
 Returns the cell size in the direction AxisNo. More...
 
Vector size () const
 Returns the vector cointaining the cell size in every direction. More...
 
real center (const int AxisNo) const
 Returns the component no. AxisNo of the cell-center position. More...
 
Vector center () const
 Returns the cell-center position vector. More...
 
real average (const int QuantityNo) const
 Returns the component no. QuantityNo of the cell-average value. More...
 
Vector average () const
 Returns the cell-average value vector. More...
 
real tempAverage (const int QuantityNo) const
 Returns the component no. QuantityNo of the temporary cell-average value. More...
 
Vector tempAverage () const
 Returns the temporary cell-average value vector. More...
 
real lowAverage (const int QuantityNo) const
 Returns the component no. QuantityNo of the cell-average value with low precision in the Runge-Kutta-Fehlberg method. More...
 
Vector lowAverage () const
 Returns the cell-average vector with low precision in the Runge-Kutta-Fehlberg method. More...
 
real oldAverage (const int QuantityNo) const
 Returns the component no. QuantityNo of the old cell-average values. More...
 
Vector oldAverage () const
 Returns the old cell-average values. More...
 
real divergence (const int QuantityNo) const
 Returns the component no. QuantityNo of the divergence vector. More...
 
Vector divergence () const
 Returns the divergence vector. More...
 
real PsiGrad (const int Dimension) const
 Returns the component of PsiGrad vector. More...
 
Vector PsiGrad () const
 Returns the PsiGrad vector. More...
 
real gradient (const int i, const int j) const
 Returns the component no. i, j of the velocity gradient. Does not work for MHD! More...
 
real tempGradient (const int i, const int j) const
 Identical to the previous one for the temporary values. More...
 
Matrix gradient () const
 Returns the velocity gradient in matrix form. More...
 
Matrix tempGradient () const
 Identical to the previous one for the temporary values. More...
 
real density () const
 Returns the cell-average density. More...
 
real tempDensity () const
 Identical to the previous one for the temporary values. More...
 
real psi () const
 Returns the cell-average density. More...
 
real tempPsi () const
 Identical to the previous one for the temporary values. More...
 
real etaConst () const
 Returns the cell-average resistivity. More...
 
real pressure () const
 Returns the cell-average pressure. More...
 
real tempPressure () const
 Identical to the previous one for the temporary values. More...
 
real oldPressure () const
 Identical to the previous one for the values at the instant n-1. More...
 
real temperature () const
 Returns the cell-average temperature. Does not work for MHD! More...
 
real tempTemperature () const
 Identical to the previous one for the temporary values. Does not work for MHD! More...
 
real concentration () const
 Returns the cell-average concentration of the limiting reactant. Does not work for MHD! More...
 
real energy () const
 Returns the cell-average energy per unit of volume. More...
 
real tempEnergy () const
 Identical to the previous one for the temporary values. More...
 
real magField (const int AxisNo) const
 Returns the component no. AxisNo of the cell-average magnetic field. More...
 
real tempMagField (const int AxisNo) const
 Identical to the previous one for the temporary values. More...
 
Vector magField () const
 Returns the cell-average magnetic field vector. More...
 
Vector tempMagField () const
 Identical to the previous one for the temporary values. More...
 
real velocity (const int AxisNo) const
 Returns the component no. AxisNo of the cell-average velocity. More...
 
real tempVelocity (const int AxisNo) const
 Identical to the previous one for the temporary values. More...
 
Vector velocity () const
 Returns the cell-average velocity vector. More...
 
Vector tempVelocity () const
 Identical to the previous one for the temporary values. More...
 
real speedOfSound () const
 Returns the cell-average speed of sound. More...
 
real entropy () const
 Returns the entropy (p/rho^Gamma). Does not work for MHD! More...
 
real fastSpeed (const int AxisNo) const
 Returns the fast speed vector. More...
 
real volume () const
 Returns the volume of the cell (length in 1D, area in 2D, volume in 3D). More...
 
bool isOverflow () const
 Return true if one of the cell-average quantities is greater than the maximum. This usually means the computation is numerically unstable. More...
 

Public Attributes

Vector X
 
Vector dX
 
Vector Q
 
Vector Qs
 
Vector Qlow
 
Vector Qold
 
Vector D
 
real Res
 
Vector PGrad
 
Matrix Grad
 
Matrix Grads
 

Detailed Description

An object Cell contains all the informations of a cell for both multiresolution and finite volume computations.

Constructor & Destructor Documentation

Cell::Cell ( )

Cell constructor.

34  :
35  X(Dimension),
36  dX(Dimension),
37  Q(QuantityNb),
38  Qs(QuantityNb),
41  D(QuantityNb),
42  Res(),
44  Grad(((EquationType==6))? Dimension:0, ((EquationType==6))? QuantityNb:0),
45  Grads(((EquationType==6) && SchemeNb > 5)? Dimension:0, ((EquationType==6) && SchemeNb > 5)? QuantityNb:0)
46 {
47  // Empty constructor
48  ;
49 }
bool TimeAdaptivity
Definition: Parameters.cpp:85
Vector dX
Definition: Cell.h:813
int QuantityNb
Definition: Parameters.cpp:171
real Res
Definition: Cell.h:857
int Dimension
Definition: Parameters.cpp:74
Vector PGrad
Definition: Cell.h:863
Matrix Grads
Definition: Cell.h:877
int StepNb
Definition: Parameters.cpp:36
Vector D
Definition: Cell.h:851
Vector Qs
Definition: Cell.h:827
Vector Q
Definition: Cell.h:819
int SchemeNb
Definition: Parameters.cpp:67
bool ConstantTimeStep
Definition: Parameters.cpp:94
int EquationType
Definition: Parameters.cpp:66
Vector Qlow
Definition: Cell.h:837
bool UseBoundaryRegions
Definition: Parameters.cpp:80
Vector X
Definition: Cell.h:807
Vector Qold
Definition: Cell.h:845
Matrix Grad
Definition: Cell.h:870
Cell::~Cell ( )

Cell distructor.

62 {
63  // Empty distructor
64 }

Member Function Documentation

real Cell::average ( const int  QuantityNo) const
inline

Returns the component no. QuantityNo of the cell-average value.

Parameters
QuantityNoNumber of MHD variables = 9.
Returns
real
1129 {
1130  return Q.value(QuantityNo);
1131 }
Vector Q
Definition: Cell.h:819
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565

Here is the caller graph for this function:

Vector Cell::average ( ) const
inline

Returns the cell-average value vector.

Returns
Vector
1137 {
1138  return Q;
1139 }
Vector Q
Definition: Cell.h:819

Here is the caller graph for this function:

real Cell::center ( const int  AxisNo) const
inline

Returns the component no. AxisNo of the cell-center position.

Parameters
AxisNoSpace direction the function is computed.
Returns
real
1113 {
1114  return X.value(AxisNo);
1115 }
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565
Vector X
Definition: Cell.h:807

Here is the caller graph for this function:

Vector Cell::center ( ) const
inline

Returns the cell-center position vector.

Returns
Vector
1121 {
1122  return X;
1123 }
Vector X
Definition: Cell.h:807

Here is the caller graph for this function:

real Cell::concentration ( ) const
inline

Returns the cell-average concentration of the limiting reactant. Does not work for MHD!

Returns
real
1326 {
1327  // Warning: only for flame ball, flame front and flame-vortex equations
1328 
1329  return Q.value(2);
1330 }
Vector Q
Definition: Cell.h:819
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565
real Cell::density ( ) const
inline

Returns the cell-average density.

Returns
real
1263 {
1264  return Q.value(1);
1265 }
Vector Q
Definition: Cell.h:819
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565

Here is the caller graph for this function:

real Cell::divergence ( const int  QuantityNo) const
inline

Returns the component no. QuantityNo of the divergence vector.

Parameters
QuantityNoNumber of MHD variables = 9.
Returns
real
1193 {
1194  return D.value(QuantityNo);
1195 }
Vector D
Definition: Cell.h:851
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565

Here is the caller graph for this function:

Vector Cell::divergence ( ) const
inline

Returns the divergence vector.

Returns
Vector
1201 {
1202  return D;
1203 }
Vector D
Definition: Cell.h:851
real Cell::energy ( ) const
inline

Returns the cell-average energy per unit of volume.

Returns
real
1308 {
1309  return Q.value(5);
1310 }
Vector Q
Definition: Cell.h:819
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565

Here is the caller graph for this function:

real Cell::entropy ( ) const
inline

Returns the entropy (p/rho^Gamma). Does not work for MHD!

Returns
real
1380 {
1381  return pressure()*exp(-Gamma*log(density()));
1382 }
real density() const
Returns the cell-average density.
Definition: Cell.h:1262
real Gamma
Definition: Parameters.cpp:109
real pressure() const
Returns the cell-average pressure.
Definition: Cell.cpp:84
real Cell::etaConst ( ) const
inline

Returns the cell-average resistivity.

Returns
real
1299 {
1300  return Res;
1301 }
real Res
Definition: Cell.h:857
real Cell::fastSpeed ( const int  AxisNo) const

Returns the fast speed vector.

Computes the fast magnetoacoustic wave at each direction.

Parameters
AxisNo
Returns
real
Parameters
AxisNoNumber of axis of interest. 1: x-direction, 2: y-direction, 3: z-direction.
Returns
double
341 {
342  real result;
343  real a = Gamma*pressure()/density();
344  real b = (magField()*magField())/density();
345  real bk= (magField(AxisNo)*magField(AxisNo))/density();
346 
347 
348  result = sqrt(.5*(a+b+sqrt((a+b)*(a+b) - 4.0*a*bk)));
349 
350  return result;
351 }
real density() const
Returns the cell-average density.
Definition: Cell.h:1262
real Gamma
Definition: Parameters.cpp:109
real pressure() const
Returns the cell-average pressure.
Definition: Cell.cpp:84
Vector magField() const
Returns the cell-average magnetic field vector.
Definition: Cell.cpp:243
#define real
Definition: PreProcessor.h:31

Here is the caller graph for this function:

real Cell::gradient ( const int  i,
const int  j 
) const
inline

Returns the component no. i, j of the velocity gradient. Does not work for MHD!

Parameters
i
j
Returns
real
1226 {
1227  return Grad.value(i,j);
1228 }
real value(const int i, const int j) const
Returns the value of the component i, j.
Definition: Matrix.h:515
Matrix Grad
Definition: Cell.h:870

Here is the caller graph for this function:

Matrix Cell::gradient ( ) const
inline

Returns the velocity gradient in matrix form.

Returns
Matrix
1246 {
1247  return Grad;
1248 }
Matrix Grad
Definition: Cell.h:870
bool Cell::isInFluid ( ) const

Returns true if the cell is inside the fluid.

Returns
bool

brief Returns true if the cell is inside the boundary

return bool

488 {
489  return (!isInsideBoundary());
490 }
bool isInsideBoundary() const
Returns true if the cell is inside the boundary.
Definition: Cell.cpp:444
bool Cell::isInsideBoundary ( ) const

Returns true if the cell is inside the boundary.

Returns
bool
445 {
446  int ei = 1;
447  int ej = (Dimension > 1) ? 1:0;
448  int ek = (Dimension > 2) ? 1:0;
449 
450  int i, j, k;
451 
452  Vector Edge(Dimension);
453 
454  bool result=false;
455 
456  // Loop: if one edge of the cell is in the boundary, return true
457  for (i=-ei; i <= ei; i+=2)
458  for (j=-ej; j <= ej; j+=2)
459  for (k=-ek; k <= ek; k+=2)
460  {
461  Edge.setValue(1,center(1) + i*0.5*size(1));
462 
463  if (Dimension > 1)
464  Edge.setValue(2,center(2) + j*0.5*size(2));
465  if (Dimension > 2)
466  Edge.setValue(3,center(3) + k*0.5*size(3));
467 
468  if (BoundaryRegion(Edge) != 0) result = true;
469  }
470 
471  return result;
472 
473 }
Standard class for every vector in Carmen.
Definition: Vector.h:29
Vector size() const
Returns the vector cointaining the cell size in every direction.
Definition: Cell.h:1104
int Dimension
Definition: Parameters.cpp:74
int BoundaryRegion(const Vector &X)
Returns the boundary region type at the position X=(x,y,z). The returned value correspond to: 0 = Fl...
Definition: BoundaryRegion.cpp:63
Vector center() const
Returns the cell-center position vector.
Definition: Cell.h:1120

Here is the caller graph for this function:

bool Cell::isOverflow ( ) const

Return true if one of the cell-average quantities is greater than the maximum. This usually means the computation is numerically unstable.

Returns
bool
383 {
384  // --- Local variables ---
385 
386  int n; // Counter on the quantities
387 
388  // --- If one of the values is overflow, return true ---
389 
390  for (n = 1; n <= QuantityNb; n++)
391  if (average().isNaN()) return true;
392 
393  return false;
394 }
Vector average() const
Returns the cell-average value vector.
Definition: Cell.h:1136
int QuantityNb
Definition: Parameters.cpp:171

Here is the caller graph for this function:

real Cell::lowAverage ( const int  QuantityNo) const
inline

Returns the component no. QuantityNo of the cell-average value with low precision in the Runge-Kutta-Fehlberg method.

Parameters
QuantityNoNumber of MHD variables = 9.
Returns
real
1161 {
1162  return Qlow.value(QuantityNo);
1163 }
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565
Vector Qlow
Definition: Cell.h:837

Here is the caller graph for this function:

Vector Cell::lowAverage ( ) const
inline

Returns the cell-average vector with low precision in the Runge-Kutta-Fehlberg method.

Returns
Vector
1169 {
1170  return Qlow;
1171 }
Vector Qlow
Definition: Cell.h:837
real Cell::magField ( const int  AxisNo) const
inline

Returns the component no. AxisNo of the cell-average magnetic field.

Parameters
AxisNo
Returns
real
1337 {
1338  return Q.value(6+AxisNo);
1339 }
Vector Q
Definition: Cell.h:819
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565

Here is the caller graph for this function:

Vector Cell::magField ( ) const

Returns the cell-average magnetic field vector.

Computes the magnetic field. Allocates the magnetic field initial condition Q[i+6] to its components.

Returns
Vector
244 {
245 
246  // Local variables
247  Vector B(3);
248  int i;
249 
250  for (i=1; i<=3; i++)
251  B.setValue(i,Q.value(i+6));
252 
253  return B;
254 }
Standard class for every vector in Carmen.
Definition: Vector.h:29
Vector Q
Definition: Cell.h:819
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565

Here is the caller graph for this function:

real Cell::oldAverage ( const int  QuantityNo) const
inline

Returns the component no. QuantityNo of the old cell-average values.

Parameters
QuantityNoNumber of MHD variables = 9.
Returns
real
1177 {
1178  return Qold.value(QuantityNo);
1179 }
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565
Vector Qold
Definition: Cell.h:845

Here is the caller graph for this function:

Vector Cell::oldAverage ( ) const
inline

Returns the old cell-average values.

Returns
Vector
1185 {
1186  return Qold;
1187 }
Vector Qold
Definition: Cell.h:845
real Cell::oldPressure ( ) const

Identical to the previous one for the values at the instant n-1.

Computes the pressure of the fluid at the instant n-1. This value is useful for time integration computations.

Returns
real
double
152 {
153  // Conservative quantities;
154 
155  real rho, rhoE;
156  Vector rhoV(3), B(3);
157 
158  // Get conservative quantities
159 
160  rho = Qold.value(1);
161 
162  for (int i=1 ; i<=3 ; i++){
163  rhoV.setValue(i,Qold.value(i+1));
164  B.setValue(i, Qold.value(i+6));
165  }
166  rhoE = Qold.value(5);
167 
168  // Return pressure
169 
170  return (Gamma-1.)*(rhoE - .5*(rhoV*rhoV)/rho -.5*(B*B));
171 
172 }
Standard class for every vector in Carmen.
Definition: Vector.h:29
real Gamma
Definition: Parameters.cpp:109
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565
Vector Qold
Definition: Cell.h:845
#define real
Definition: PreProcessor.h:31

Here is the caller graph for this function:

void Cell::operator= ( const Cell C)

Defines the cell operators. It is possible to obtain the cell values as:

  • Center coordinates
  • Size
  • Average
  • Temporary average
  • Divergence
  • Gradient of Psi
Parameters
CCell of interest
Returns
void
417 {
418  // local cell becomes equal to cell C
419 
420  setCenter(C.center());
421  setSize(C.size());
422  setAverage(C.average());
425  setPsiGrad(C.PsiGrad());
426 
427  return;
428 
429 }
real center(const int AxisNo) const
Returns the component no. AxisNo of the cell-center position.
Definition: Cell.h:1112
void setDivergence(const int QuantityNo, const real UserAverage)
Identical to void setAverage (int QuantityNo, real UserAverage), but for the divergence vector...
Definition: Cell.h:1019
real PsiGrad(const int Dimension) const
Returns the component of PsiGrad vector.
Definition: Cell.h:1208
real divergence(const int QuantityNo) const
Returns the component no. QuantityNo of the divergence vector.
Definition: Cell.h:1192
real size(const int AxisNo) const
Returns the cell size in the direction AxisNo.
Definition: Cell.h:1095
void setTempAverage(const int QuantityNo, const real UserAverage)
Identical to setAverage (int QuantityNo, real UserAverage), but for the vector of the temporary cell-...
Definition: Cell.h:945
void setSize(const int AxisNo, const real UserSize)
Sets the size of the cell in the direction AxisNo to UserSize. Example:
Definition: Cell.h:888
real average(const int QuantityNo) const
Returns the component no. QuantityNo of the cell-average value.
Definition: Cell.h:1128
real tempAverage(const int QuantityNo) const
Returns the component no. QuantityNo of the temporary cell-average value.
Definition: Cell.h:1144
void setPsiGrad(const int Dimension, const real UserAverage)
Identical to void setAverage (int QuantityNo, real UserAverage), but for the gradient of psi vector...
Definition: Cell.h:1002
void setCenter(const int AxisNo, const real UserX)
Sets the coordinate of the cell-center in the direction AxisNo to UserX. Example: ...
Definition: Cell.h:905
void setAverage(const int QuantityNo, const real UserAverage)
Sets the cell-average of the quantity QuantityNo to UserAverage. Example:
Definition: Cell.h:921
real Cell::pressure ( ) const

Returns the cell-average pressure.

Computes the pressure of the fluid. The pressure is computed in terms of the energy density, velocity and magnetic field. It is given by (Gamma-1.)*(rhoE - .5*(rhoV*rhoV)/rho - .5*(B*B)); return double.

Returns
real
85 {
86  // Conservative quantities;
87 
88  real rho, rhoE;
89  Vector rhoV(3), B(3);
90 
91  // Get conservative quantities
92 
93  rho = Q.value(1);
94 
95  for (int i=1 ; i<=3; i++){
96  B.setValue(i, Q.value(i+6));
97  rhoV.setValue(i,Q.value(i+1));
98  }
99  rhoE = Q.value(5);
100 
101  // Return pressure
102 
103  return (Gamma-1.)*(rhoE - .5*(rhoV*rhoV)/rho - .5*(B*B));
104 
105 
106 }
Standard class for every vector in Carmen.
Definition: Vector.h:29
real Gamma
Definition: Parameters.cpp:109
Vector Q
Definition: Cell.h:819
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565
#define real
Definition: PreProcessor.h:31

Here is the caller graph for this function:

real Cell::psi ( ) const
inline

Returns the cell-average density.

Returns
real
1281 {
1282  return Q.value(6);
1283 }
Vector Q
Definition: Cell.h:819
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565

Here is the caller graph for this function:

real Cell::PsiGrad ( const int  Dimension) const
inline

Returns the component of PsiGrad vector.

Parameters
Dimension
Returns
real
1209 {
1210  return PGrad.value(Dimension);
1211 }
int Dimension
Definition: Parameters.cpp:74
Vector PGrad
Definition: Cell.h:863
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565

Here is the caller graph for this function:

Vector Cell::PsiGrad ( ) const
inline

Returns the PsiGrad vector.

Returns
Vector
1217 {
1218  return PGrad;
1219 }
Vector PGrad
Definition: Cell.h:863
void Cell::setAverage ( const int  QuantityNo,
const real  UserAverage 
)
inline

Sets the cell-average of the quantity QuantityNo to UserAverage. Example:

#include "Carmen.h"

QuantityNb = 2;
real T=0.,Y=1.;
Cell c;
c.setAverage(1,T);
c.setAverage(2,Y);

Parameters
QuantityNoNumber of MHD variables
UserAverageAverage value
Returns
void

922 {
923  Q.setValue(QuantityNo, UserAverage);
924 }
void setValue(const int n, const real a)
Sets the component n to value a.
Definition: Vector.h:545
Vector Q
Definition: Cell.h:819

Here is the caller graph for this function:

void Cell::setAverage ( const Vector UserAverage)
inline

Sets all the cell-average quantities to the vector UserAverage. Example:

#include "Carmen.h"

QuantityNb = 2;
Vector Q(1.,0.);
Cell c;
c.setAverage(Q);

Parameters
UserAverageAverage value
Returns
void

930 {
931  Q = UserAverage;
932 }
Vector Q
Definition: Cell.h:819
void Cell::setAverageZero ( )
inline

Sets all the cell-average values to zero.

Returns
void
938 {
939  Q.setZero();
940 }
Vector Q
Definition: Cell.h:819
void setZero()
Sets all the components to zero.
Definition: Vector.cpp:228

Here is the caller graph for this function:

void Cell::setCenter ( const int  AxisNo,
const real  UserX 
)
inline

Sets the coordinate of the cell-center in the direction AxisNo to UserX. Example:

#include "Carmen.h"

Dimension = 3;
real x=1., y=0., z=0.;
Cell c;
c.setCenter(1,x);
c.setCenter(2,y);
c.setCenter(3,z);

Parameters
AxisNoNumber of axis of interest. 1: x-direction, 2: y-direction, 3: z-direction.
UserXCenter of the cell.
Returns
void

906 {
907  X.setValue(AxisNo, UserX);
908 }
void setValue(const int n, const real a)
Sets the component n to value a.
Definition: Vector.h:545
Vector X
Definition: Cell.h:807

Here is the caller graph for this function:

void Cell::setCenter ( const Vector UserX)
inline

Sets the position of the cell-center to the vector UserX. Example:

#include "Carmen.h"

Dimension = 3;
Vector V(1.,0.,0.);
Cell c;
c.setCenter(V);

Parameters
UserXCenter of the cell.
Returns
void

914 {
915  X = UserX;
916 }
Vector X
Definition: Cell.h:807
void Cell::setDivergence ( const int  QuantityNo,
const real  UserAverage 
)
inline

Identical to void setAverage (int QuantityNo, real UserAverage), but for the divergence vector.

Parameters
QuantityNoNumber of MHD variables
UserAverageDivergence values
Returns
void
1020 {
1021  D.setValue(QuantityNo, UserAverage);
1022 }
void setValue(const int n, const real a)
Sets the component n to value a.
Definition: Vector.h:545
Vector D
Definition: Cell.h:851

Here is the caller graph for this function:

void Cell::setDivergence ( const Vector UserAverage)
inline

Identical to void setAverage (const Vector& UserAverage), but for the divergence vector.

Parameters
UserAverageDivergence values
Returns
void
1036 {
1037  D = UserAverage;
1038 }
Vector D
Definition: Cell.h:851
void Cell::setDivergenceZero ( )
inline

Sets all the components of the divergence vector to zero.

Returns
void
1044 {
1045  D.setZero();
1046 }
Vector D
Definition: Cell.h:851
void setZero()
Sets all the components to zero.
Definition: Vector.cpp:228
void Cell::setGradient ( const int  i,
const int  j,
const real  UserAverage 
)
inline

Sets the component no. i, j of the quantity gradient to UserAverage.

Does not work for MHD!

Example:

#include "Carmen.h"

QuantityNb = 2;
real Gxx=0., Gxy=1., Gyx=1., Gyy=0.;
Cell c;
c.setGradient(1,1,Gxx);
c.setGradient(1,2,Gxy);
c.setGradient(2,1,Gyx);
c.setGradient(2,2,Gyy);

Parameters
i
j
UserAverageGradient value
Returns
void

1052 {
1053  Grad.setValue(i, j, UserAverage);
1054 }
void setValue(const int i, const int j, const real a)
Sets the component i, j to value a.
Definition: Matrix.h:505
Matrix Grad
Definition: Cell.h:870

Here is the caller graph for this function:

void Cell::setGradient ( const Matrix UserAverage)
inline

Sets the quantity gradient to the matrix UserAverage. Does not work for MHD! Example:

#include "Carmen.h"

QuantityNb = 5;
Dimension = 3;
Matrix G(3,5);

  • Cell c
  • ...
    c.SetGradient(G);

    Parameters
    UserAverageGradient value
    Returns
    void

1068 {
1069  Grad = UserAverage;
1070 }
Matrix Grad
Definition: Cell.h:870
void Cell::setGradientZero ( )
inline

Sets all the components of the velocity gradient to zero.

Returns
void
1085 {
1086  Grad.setZero();
1087 }
void setZero()
Sets all the components to zero.
Definition: Matrix.cpp:127
Matrix Grad
Definition: Cell.h:870
void Cell::setLowAverage ( const int  QuantityNo,
const real  UserAverage 
)
inline

Identical to setAverage (int QuantityNo, real UserAverage), but for the vector of the cell-average values with low precision in the Runge-Kutta-Fehlberg method.

Parameters
QuantityNoNumber of MHD variables
UserAverageAverage value
Returns
void
970 {
971  Qlow.setValue(QuantityNo, UserAverage);
972 }
void setValue(const int n, const real a)
Sets the component n to value a.
Definition: Vector.h:545
Vector Qlow
Definition: Cell.h:837

Here is the caller graph for this function:

void Cell::setLowAverage ( const Vector UserAverage)
inline

Identical to void setAverage (const Vector& UserAverage), void setAverage (const Vector& UserAverage), but for the vector of the cell-average values with low precision in the Runge-Kutta-Fehlberg method.

Parameters
UserAverageAverage value
Returns
void
978 {
979  Qlow = UserAverage;
980 }
Vector Qlow
Definition: Cell.h:837
void Cell::setOldAverage ( const int  QuantityNo,
const real  UserAverage 
)
inline

Identical to setAverage (int QuantityNo, real UserAverage), but for the vector of the old cell-average values.

Parameters
QuantityNoNumber of MHD variables
UserAverageAverage value
Returns
void
986 {
987  Qold.setValue(QuantityNo, UserAverage);
988 }
void setValue(const int n, const real a)
Sets the component n to value a.
Definition: Vector.h:545
Vector Qold
Definition: Cell.h:845

Here is the caller graph for this function:

void Cell::setOldAverage ( const Vector UserAverage)
inline

Identical to void setAverage (const Vector& UserAverage), but for the vector of the cell-average values.

Parameters
UserAverageAverage value
Returns
void
994 {
995  Qold = UserAverage;
996 }
Vector Qold
Definition: Cell.h:845
void Cell::setPsiGrad ( const int  Dimension,
const real  UserAverage 
)
inline

Identical to void setAverage (int QuantityNo, real UserAverage), but for the gradient of psi vector.

Parameters
DimensionDimension of the system
UserAverageGradient of psi value
Returns
void
1003 {
1004  PGrad.setValue(Dimension, UserAverage);
1005 }
int Dimension
Definition: Parameters.cpp:74
Vector PGrad
Definition: Cell.h:863
void setValue(const int n, const real a)
Sets the component n to value a.
Definition: Vector.h:545

Here is the caller graph for this function:

void Cell::setPsiGrad ( const Vector UserAverage)
inline

Identical to void setAverage (int QuantityNo, real UserAverage), but for the gradient of psi vector.

Parameters
UserAverageGradient of psi value
Returns
void
1028 {
1029  PGrad = UserAverage;
1030 }
Vector PGrad
Definition: Cell.h:863
void Cell::setRes ( const real  UserAverage)
inline

Set resistivity.

Parameters
UserAverageResistivity values
Returns
void
1012 {
1013  Res = UserAverage;
1014 }
real Res
Definition: Cell.h:857

Here is the caller graph for this function:

void Cell::setSize ( const int  AxisNo,
const real  UserSize 
)
inline

Sets the size of the cell in the direction AxisNo to UserSize. Example:

#include "Carmen.h"

Dimension = 2;
real dx=1., dy=2.;
Cell c;
c.setSize(1, dx);
c.setSize(2, dy);

Parameters
AxisNoNumber of axis of interest. 1: x-direction, 2: y-direction, 3: z-direction.
UserSizeSize of the cell.
Returns
void

889 {
890  dX.setValue(AxisNo, UserSize);
891 }
Vector dX
Definition: Cell.h:813
void setValue(const int n, const real a)
Sets the component n to value a.
Definition: Vector.h:545

Here is the caller graph for this function:

void Cell::setSize ( const Vector UserSize)
inline

Sets the size of the cell in every direction to the vector UserSize . Example:

#include "Carmen.h"

Dimension = 2;
Vector W(1.,2.);
Cell c;
c.setSize(W);

Parameters
UserSizeSize of the cell (vector)
Returns
void

898 {
899  dX = UserSize;
900 }
Vector dX
Definition: Cell.h:813
void Cell::setTempAverage ( const int  QuantityNo,
const real  UserAverage 
)
inline

Identical to setAverage (int QuantityNo, real UserAverage), but for the vector of the temporary cell-average values.

Parameters
QuantityNoNumber of MHD variables
UserAverageAverage value
Returns
void
946 {
947  Qs.setValue(QuantityNo, UserAverage);
948 }
void setValue(const int n, const real a)
Sets the component n to value a.
Definition: Vector.h:545
Vector Qs
Definition: Cell.h:827

Here is the caller graph for this function:

void Cell::setTempAverage ( const Vector UserAverage)
inline

Identical to void setAverage (const Vector& UserAverage), but for the vector of the temporary cell-average values.

Parameters
UserAverageAverage value
Returns
void
954 {
955  Qs = UserAverage;
956 }
Vector Qs
Definition: Cell.h:827
void Cell::setTempAverageZero ( )
inline

Sets all the temmporary cell-average values to zero.

Returns
void
962 {
963  Qs.setZero();
964 }
Vector Qs
Definition: Cell.h:827
void setZero()
Sets all the components to zero.
Definition: Vector.cpp:228
void Cell::setTempGradient ( const int  i,
const int  j,
const real  UserAverage 
)
inline

Identical to the previous one for the temporary values. Does not work for MHD!

Parameters
i
j
UserAverageGradient value
Returns
void
1060 {
1061  Grads.setValue(i, j, UserAverage);
1062 }
Matrix Grads
Definition: Cell.h:877
void setValue(const int i, const int j, const real a)
Sets the component i, j to value a.
Definition: Matrix.h:505

Here is the caller graph for this function:

void Cell::setTempGradient ( const Matrix UserAverage)
inline

dentical to the previous one for the temporary values.

Parameters
UserAverageGradient value
Returns
void
1076 {
1077  Grads = UserAverage;
1078 }
Matrix Grads
Definition: Cell.h:877
real Cell::size ( const int  AxisNo) const
inline

Returns the cell size in the direction AxisNo.

Parameters
AxisNoSpace direction the function is computed.
Returns
real
1096 {
1097  return dX.value(AxisNo);
1098 }
Vector dX
Definition: Cell.h:813
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565

Here is the caller graph for this function:

Vector Cell::size ( ) const
inline

Returns the vector cointaining the cell size in every direction.

Returns
Vector
1105 {
1106  return dX;
1107 }
Vector dX
Definition: Cell.h:813

Here is the caller graph for this function:

real Cell::speedOfSound ( ) const
inline

Returns the cell-average speed of sound.

Returns
real
1372 {
1373  return sqrt(Gamma*pressure()/density());
1374 }
real density() const
Returns the cell-average density.
Definition: Cell.h:1262
real Gamma
Definition: Parameters.cpp:109
real pressure() const
Returns the cell-average pressure.
Definition: Cell.cpp:84
real Cell::tempAverage ( const int  QuantityNo) const
inline

Returns the component no. QuantityNo of the temporary cell-average value.

Parameters
QuantityNoNumber of MHD variables = 9.
Returns
real
1145 {
1146  return Qs.value(QuantityNo);
1147 }
Vector Qs
Definition: Cell.h:827
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565

Here is the caller graph for this function:

Vector Cell::tempAverage ( ) const
inline

Returns the temporary cell-average value vector.

Returns
Vector
1153 {
1154  return Qs;
1155 }
Vector Qs
Definition: Cell.h:827
real Cell::tempDensity ( ) const
inline

Identical to the previous one for the temporary values.

Returns
real
1272 {
1273  return Qs.value(1);
1274 }
Vector Qs
Definition: Cell.h:827
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565

Here is the caller graph for this function:

real Cell::tempEnergy ( ) const
inline

Identical to the previous one for the temporary values.

Returns
real
1317 {
1318  return Qs.value(5);
1319 }
Vector Qs
Definition: Cell.h:827
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565
real Cell::temperature ( ) const

Returns the cell-average temperature. Does not work for MHD!

Computes the temperature. Not useful for MHD computarions.

Returns
real
double
185 {
186 
187  if(!ComputeTemp) exit(1);
188 
189  // Conservative quantities;
190  real rho, p, T;
191 
192  // Get conservative quantities
193  rho = density();
194  p = pressure();
195  T = p/rho;
196 
197  // Return temperature
198 
199  return T;
200 }
real density() const
Returns the cell-average density.
Definition: Cell.h:1262
bool ComputeTemp
Definition: Parameters.cpp:122
real pressure() const
Returns the cell-average pressure.
Definition: Cell.cpp:84
#define real
Definition: PreProcessor.h:31

Here is the caller graph for this function:

real Cell::tempGradient ( const int  i,
const int  j 
) const
inline

Identical to the previous one for the temporary values.

Parameters
i
j
Returns
real
1236 {
1237  return Grads.value(i,j);
1238 }
real value(const int i, const int j) const
Returns the value of the component i, j.
Definition: Matrix.h:515
Matrix Grads
Definition: Cell.h:877
Matrix Cell::tempGradient ( ) const
inline

Identical to the previous one for the temporary values.

Returns
Matrix
1255 {
1256  return Grads;
1257 }
Matrix Grads
Definition: Cell.h:877
real Cell::tempMagField ( const int  AxisNo) const
inline

Identical to the previous one for the temporary values.

Parameters
AxisNo
Returns
real
1346 {
1347  return Qs.value(6+AxisNo);
1348 }
Vector Qs
Definition: Cell.h:827
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565
Vector Cell::tempMagField ( ) const

Identical to the previous one for the temporary values.

Computes temporary the magnetic field. This value is useful for time integration computations.

Returns
Vector
267 {
268 
269  // Local variables
270 
271  Vector B(3);
272  int i;
273 
274  for (i=1; i<=3; i++)
275  B.setValue(i,Qs.value(i+6));
276 
277  return B;
278 }
Standard class for every vector in Carmen.
Definition: Vector.h:29
Vector Qs
Definition: Cell.h:827
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565
real Cell::tempPressure ( ) const

Identical to the previous one for the temporary values.

Computes the temporary pressure of the fluid. This computation is needed for the Runge-Kutta time integration.

Returns
real
double
118 {
119  // Conservative quantities;
120 
121  real rho, rhoE;
122  Vector rhoV(3), B(3);
123 
124  // Get conservative quantities
125 
126  rho = Qs.value(1);
127 
128  for (int i=1 ; i<=3 ; i++){
129  rhoV.setValue(i,Qs.value(i+1));
130  B.setValue(i, Qs.value(i+6));
131  }
132 
133  rhoE = Qs.value(5);
134 
135  // Return pressure
136 
137  return (Gamma-1.)*(rhoE - .5*(rhoV*rhoV)/rho - .5*(B*B));
138 
139 }
Standard class for every vector in Carmen.
Definition: Vector.h:29
real Gamma
Definition: Parameters.cpp:109
Vector Qs
Definition: Cell.h:827
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565
#define real
Definition: PreProcessor.h:31

Here is the caller graph for this function:

real Cell::tempPsi ( ) const
inline

Identical to the previous one for the temporary values.

Returns
real
1290 {
1291  return Qs.value(6);
1292 }
Vector Qs
Definition: Cell.h:827
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565
real Cell::tempTemperature ( ) const

Identical to the previous one for the temporary values. Does not work for MHD!

Computes the temporary temperature. Not useful for MHD computarions.

Returns
real
double
213 {
214 
215  if(!ComputeTemp) exit(1);
216 
217  // Conservative quantities;
218  real rho, p, T;
219  T = Qs.value(1);
220 
221  // Get conservative quantities
222  rho = tempDensity();
223  p = tempPressure();
224  T = Gamma*Ma*Ma*p/rho;
225 
226 
227  // Return temperature
228 
229  return T;
230 }
real tempPressure() const
Identical to the previous one for the temporary values.
Definition: Cell.cpp:117
real tempDensity() const
Identical to the previous one for the temporary values.
Definition: Cell.h:1271
real Gamma
Definition: Parameters.cpp:109
bool ComputeTemp
Definition: Parameters.cpp:122
Vector Qs
Definition: Cell.h:827
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565
real Ma
Definition: Parameters.cpp:110
#define real
Definition: PreProcessor.h:31
real Cell::tempVelocity ( const int  AxisNo) const
inline

Identical to the previous one for the temporary values.

Parameters
AxisNo
Returns
real
1364 {
1365  return Qs.value(1+AxisNo)/Qs.value(1);
1366 }
Vector Qs
Definition: Cell.h:827
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565
Vector Cell::tempVelocity ( ) const

Identical to the previous one for the temporary values.

Computes the temporary velocity of the fluid. This value is useful for time integration computations.

Returns
Vector
315 {
316 
317  // Local variables
318 
319  Vector V(3);
320  int i;
321 
322  for (i=1; i<=3; i++)
323  V.setValue(i,Qs.value(i+1)/Qs.value(1));
324 
325  return V;
326 }
Standard class for every vector in Carmen.
Definition: Vector.h:29
Vector Qs
Definition: Cell.h:827
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565
real Cell::velocity ( const int  AxisNo) const
inline

Returns the component no. AxisNo of the cell-average velocity.

Parameters
AxisNo
Returns
real
1355 {
1356  return Q.value(1+AxisNo)/Q.value(1);
1357 }
Vector Q
Definition: Cell.h:819
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565

Here is the caller graph for this function:

Vector Cell::velocity ( ) const

Returns the cell-average velocity vector.

Computes the velocity of the fluid. Allocates the velocity initial condition Q[i+6] to its components.

Returns
Vector
291 {
292 
293  // Local variables
294 
295  Vector V(3);
296  int i;
297 
298  for (i=1; i<=3; i++)
299  V.setValue(i,Q.value(i+1)/Q.value(1));
300 
301  return V;
302 }
Standard class for every vector in Carmen.
Definition: Vector.h:29
Vector Q
Definition: Cell.h:819
real value(const int n) const
Returns the value of the component n.
Definition: Vector.h:565
real Cell::volume ( ) const

Returns the volume of the cell (length in 1D, area in 2D, volume in 3D).

Computes the volume of a cell.

Returns
real
double
364 {
365  int AxisNo = 1;
366  real result = 1.;
367 
368  for (AxisNo = 1; AxisNo <= Dimension; AxisNo++)
369  result *= size(AxisNo);
370 
371  return result;
372 
373 }
Vector size() const
Returns the vector cointaining the cell size in every direction.
Definition: Cell.h:1104
int Dimension
Definition: Parameters.cpp:74
#define real
Definition: PreProcessor.h:31

Member Data Documentation

Vector Cell::D

Divergence vector. Its dimension is QuantityNb.

Vector Cell::dX

Cell size in each direction. Its dimension is Dimension.

Matrix Cell::Grad

Quantity gradient. Only necessary for a Navier-Stokes computation. Not working!

Matrix Cell::Grads

Temporary quantity gradient. Only necessary for a Navier-Stokes computation. Not working!

Vector Cell::PGrad

Gradient of psi scalar function. Its dimension is Dimension.

Vector Cell::Q

Vector containing the cell-average values. Its dimension is QuantityNb.

Vector Cell::Qlow

This vector is used to store the cell-averages computed with the N-stage Runge-Kutta-Fehlberg N(N+1) method.

Vector Cell::Qold

Cell-average values at the instant n-1.

Vector Cell::Qs

Temporary cell-average values. This vector is used to store the intermediary value in a multi-step Runge-Kutta or McCormack time integration.

real Cell::Res

Resistivity scalar function.

Vector Cell::X

Position of the cell center. Its dimension is Dimension.


The documentation for this class was generated from the following files: