Carmen Code
 All Classes Files Functions Variables Macros Pages
Functions
ArtificialViscosity.cpp File Reference

Computes the Laplacian terms for density, energy and momentum equations. It helps with the stability. More...

#include "Carmen.h"
Include dependency graph for ArtificialViscosity.cpp:

Functions

Vector ArtificialViscosity (const Vector &Cell1, const Vector &Cell2, real dx, int AxisNo)
 Returns the artificial diffusion source terms in the cell UserCell. More...
 

Detailed Description

Computes the Laplacian terms for density, energy and momentum equations. It helps with the stability.

Author
Anna Karina Fontes Gomes
Version
2.0
Date
Oct-2016

Function Documentation

Vector ArtificialViscosity ( const Vector Cell1,
const Vector Cell2,
real  dx,
int  AxisNo 
)

Returns the artificial diffusion source terms in the cell UserCell.

Parameters
Cell1Left cell value
Cell2Right cell value
AxisNoAxis of interest
Returns
Vector

X - direction

Y - direction

Z - direction

12 {
13  // --- Local variables ---
14  Vector ML(3), MR(3);
15  Vector Result(QuantityNb);
16  real EL,ER,RL,RR;
17  real viscR, viscX, viscY, viscZ, viscE;
18 
19 
20  for(int i=1; i <= 3; i++){
21  ML.setValue(i, Cell1.value(i+1));
22  MR.setValue(i, Cell2.value(i+1));
23  }
24 
25  RL = Cell1.value(1);
26  RR = Cell2.value(1);
27  EL = Cell1.value(5);
28  ER = Cell2.value(5);
29 
30 
31  if(AxisNo == 1){
33  viscR = (RR - RL)/dx;
34  viscE = (ER - EL)/dx;
35 
36  viscX = (MR.value(1) - ML.value(1))/dx;
37  viscY = (MR.value(2) - ML.value(2))/dx;
38  viscZ = (MR.value(3) - ML.value(3))/dx;
39 
40 
41  }else if(AxisNo == 2){
43  viscR = (RR - RL)/dx;
44  viscE = (ER - EL)/dx;
45 
46  viscX = (MR.value(1) - ML.value(1))/dx;
47  viscY = (MR.value(2) - ML.value(2))/dx;
48  viscZ = (MR.value(3) - ML.value(3))/dx;
49 
50  }else{
52  viscR = (RR - RL)/dx;
53  viscE = (ER - EL)/dx;
54 
55  viscX = (MR.value(1) - ML.value(1))/dx;
56  viscY = (MR.value(2) - ML.value(2))/dx;
57  viscZ = (MR.value(3) - ML.value(3))/dx;
58 
59  }
60 
61 
62  Result.setZero();
63 
64  // These values will be added to the numerical flux
65  Result.setValue(1, chi*viscR);
66  Result.setValue(2, chi*viscX);
67  Result.setValue(3, chi*viscY);
68  Result.setValue(4, chi*viscZ);
69  Result.setValue(5, chi*viscE);
70 
71  return Result;
72 
73 }
int QuantityNb
Definition: Parameters.cpp:171
Standard class for every vector in Carmen.
Definition: Vector.h:29
real chi
Definition: Parameters.cpp:124
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: