Euler equations



All the necessary routines that implement the 2D Euler Equations (given in conservative variables) are defined in GoverningEquations/EulerEquations.py




Governing equations


class 3_LESARD.SourceCode.ProblemDefinition.GoverningEquations.EulerEquations.Equations(FluidProp, EOs)

Class furnishing all the methods that are required to define numerical schemes and evolve the solution according to the Euler Equation


Fields

It contains the following initialisation parameters (later available as well as attributes)

  •   FluidProp (list of FluidModel) – the list of fluid property instances (NbFluids)

  •   EOS (list of callbacks) – the list of Equation of state functions (NbFluids)

It further contains the following attributes, filled upon initialisation

  •   NbVariables (integer) – number of variables of the model

  •   VariablesNames (list of strings) – ordered name of the variables

  •   VariablesUnits (list of strings) – symbols of the units of the variables

  •   VariablesLatexNames (list of strings) – ordered name of the variables, latex encoding

  •   VariablesLatexUnits (list of strings) – symbols of the units of the variables, latex encoding

  •   XYLatexUnits (list of strings) – units of the x-y coordinates in latex encoding

Parameters
  • FluidProp (list of FluidModel) – the list of fluid property instances (NbFluids)

  • EOs (list of EOS) – the list of Equation of state instances (NbFluids)


Methods

ConservativeToPrimary(Var, FluidIndex, *args)

Converts the conservative variables to the primary ones

Parameters
  • Var (2D numpy array) – the variables of the problem (NbVars x NbGivenPoints)

  • FluidIndex (integer numpy array) – the fluid present at each given point (NbGivenPoints)

Returns

(NbVars x NbGivenPoints) the corresponding primary variables

Return type

Var (numpy array)

Note

  • *args is there only for compatibility reason at call time
PrimaryToConservative(PrimVar, FluidIndex, *args)

Converts the primary variables to the conservative ones

Parameters
  • Var (2D numpy array) – the primary variables of the problem (NbVars x NbGivenPoints)

  • FluidIndex (integer numpy array) – the fluid present at each given point (NbGivenPoints)

Returns

(NbVars x NbGivenPoints) the corresponding conservative variables

Return type

Var (numpy array)

Note

  • *args is there only for compatibility reason at call time
Flux(Var, *args)

Flux function of the (conservative) EulerEquations

Parameters

Var (float numpy array) – the value of the variables (NbVariables x NbGivenPoints)

Optional argument

  •   x (float numpy array), – (optional, not impacting here) x-y coordinates of the given points (NbGivenPoints x 2)

  •   FluidIndex (integer numpy array) – the fluid present at each given point (NbGivenPoints)

Returns

fills direclty the Parameters data structure

Return type

None


Note

  • This function is Vectorised
  • Fluid index is the fluid index in the initially given list, not the fluid type
  • FluidProp is the list of all the fluid properties for each fluid (given the list, not the type)
  • *args is there only for compatibility reason at call time
GetUV(Var, *args)

Function giving back the x-y velocity at the considered point, given the variational values given for the the conservative Euler equation’s variables.

Parameters
  • Var (float numpy array) – the value of the variables (NbVariables x NbGivenPoints)

  • x (float numpy array) – (generally optional, required for this problem), x-y coordinates of the given points (NbGivenPoints x 2)

Optional argument

  •   FluidIndex (integer numpy array) – the fluid present at each given point (NbGivenPoints)

Returns

UV (float numpy array) – the velocities values at the points (2 x NbGivenPoints)

Note

  • This function is Vectorised
  • *args is there only for compatibility reason at call time
Jacobian(Var, x, FluidIndex, *args)

Computes the Jacobian of the flux for the Euler equations

Parameters
  • Var (float numpy array) – the value of the variables (NbVariables x NbGivenPoints)

  • x (float numpy array) – (generally optional, required for this problem), x-y coordinates of the given points (NbGivenPoints x 2)

  • FluidIndex (integer numpy array) – the fluid present at each given point (NbGivenPoints)

Returns

J[:,:,i] gives the jacobian of the flux taking care of the dynamic of the ith spatial coordinate.

Return type

J (3D numpy array)


Note

  • For each flux fi = (fi1,…, fin), the returned Jacobian reads:
      J[:,:] = [dfi1/dx1, ….., dfi1/dxn
                ….
                df in/dx1, ….., dfin/dxn]
  • *args is there only for compatibility reason at call time
EigenValues(Var, FluidIndex, n, x, *args)

Computes the eigenvalues associated to the flux.

Parameters
  • Var (2D numpy array) – the variables of the problem (NbVars x NbGivenPoints)

  • FluidIndex (integer numpy array) – the fluid present at each given point (NbGivenPoints)

  • n (2D numpy array) – the x-y values of the normal at each given point (NbGivenPoints x 2)

  • x (2D numpy array) – (generally optional, required for this problem) the x-y locations at which the variables are given (NbGivenPoints x 2)

Returns

(NbGivenPoints x 4) the four eigenvalues at each given point

Return type

lbd (numpy array)

Note

  • *args is there only for compatibility reason at call time
RightEigenVectors(Var, FluidIndex, n, x, *args)

Computes the right eigenvectors associated to the eigenvalues.

Parameters
  • Var (2D numpy array) – the variables of the problem (NbVars x NbGivenPoints)

  • FluidIndex (integer numpy array) – the fluid present at each given point (NbGivenPoints)

  • n (2D numpy array) – the x-y values of the normal at each given point (NbGivenPoints x 2)

  • x (2D numpy array) – (generally optional, required for this problem) the x-y locations at which the variables are given (NbGivenPoints x 2)

Returns

(NbVars x MbVars x NbGivenPoints) the matrix of eigenvectors for each given point

Return type

reg (numpy array)

Note

  • *args is there only for compatibility reason at call time
LeftEigenVectors(Var, FluidIndex, n, x, *args)

Computes the left eigenvectors associated to the eigenvalues.

Parameters
  • Var (2D numpy array) – the variables of the problem (NbVars x NbGivenPoints)

  • FluidIndex (integer numpy array) – the fluid present at each given point (NbGivenPoints)

  • n (2D numpy array) – the x-y values of the normal at each given point (NbGivenPoints x 2)

  • x (2D numpy array) – (generally optional, required for this problem) the x-y locations at which the variables are given (NbGivenPoints x 2)

Returns

(NbVars x MbVars x NbGivenPoints) the matrix of eigenvectors for each given point

Return type

reg (numpy array)

Note

  • *args is there only for compatibility reason at call time
SpectralRadius(Var, FluidIndex, n, x, *args)

Computes the spectral radius associated to the flux.

Parameters
  • Var (2D numpy array) – the variables of the problem (NbVars x NbGivenPoints)

  • FluidIndex (integer numpy array) – the fluid present at each given point (NbGivenPoints)

  • n (2D numpy array) – the x-y values of the normal at each given point (NbGivenPoints x 2)

  • x (2D numpy array) – (generally optional, required for this problem) the x-y locations at which the variables are given (NbGivenPoints x 2)

Returns

the spectral radius computed at each given point

Return type

Lmb (numpy array)

Note

  • *args is there only for compatibility reason at call time
RoeMatrix(Var, n, FluidIndex, *args)

A Roe matrix corresponding to the Euler Equations, accross one given edge

Parameters
  • n (float numpy array) – the outward normal of the considered element (nx, ny)

  • Var (float numpy array) – the value of the variables (NbVariables x 2). Var[:,1] average value of the considered element, Var[:,2] average value of the neigborhing element.

  • FluidIndex (integer numpy array) – the fluid present at each given point (NbGivenPoints)

  • x (float numpy array) – (optional, not impacting here) x-y coordinates of the given points (NbGivenPoints x 2)

Returns

a Roe matrix of the system

Return type

RoeMatrix (float numpy array)


Note

  • This function is NOT vectorised

  • Fluid index is the fluid index in the initially given list, not the fluid type

  • FluidProp is the list of all the fluid properties for each fluid (given the list, not the type)





Equations of state


class 3_LESARD.SourceCode.ProblemDefinition.GoverningEquations.EulerEquations.EOS(Id)

Class furnishing the methods giving the Equation of State that can be used in combination with the SimpleFluid definition. Upon creation, fills the field EOS with the function callback corresponding to the wished initialisation function and the field EOSName with the associated label. The implemented EoS are linked as follows. See their respective documentation for more information.

  1. Stiff fluid
  2. Ideal
Parameters

Id (integer) – the index corresponding to the equation of fluid the user wants when considering the governing equations given in this module and the associated fluid.


Methods

Stiff(Var, FluidProp, Type)

Equation of State for stiff fluids, giving back either the internal energy or pressure.

Parameters
  • Type (string) – desired output: “e”: internal energy, “p”: pressure

  • Var (float numpy array) – the value of the variables (NbVariables x NbGivenPoints). If type “e”, the variables should be [rho, rhoU, rhoV, p].T. If type “p”, the variables should be [rho, rhoU, rhoV, E].

  • FluidProp (FluidModel list) – the list of the fluid properties associated to each given Point

Returns

the pressure values at the given points (NbGivenPoints)

Return type

p (float numpy array)

dEoSRhoStiff(Var, FluidProp)

Derivative of the Equation of State for stiff fluids along the density variable at the given points.

Parameters
  • Type (string) – desired output: “e”: internal energy, “p”: pressure

  • Var (float numpy array) – the value of the conservative variables (NbVariables x NbGivenPoints).

  • FluidProp (FluidModel list) – the list of the fluid properties associated to each given Point

Returns

derivative of the Equation of State for stiff fluids along the density variable (NbGivenPoints)

Return type

deos (float numpy array)

dEoSEStiff(Var, FluidProp)

Derivative of the Equation of State for stiff fluids along the Energy variable at the given points.

Parameters
  • Type (string) – desired output: “e”: internal energy, “p”: pressure

  • Var (float numpy array) – the value of the conservative variables (NbVariables x NbGivenPoints).

  • FluidProp (FluidModel list) – the list of the fluid properties associated to each given Point

Returns

derivative of the Equation of State for stiff fluids along the Energy variable (NbGivenPoints)

Return type

deos (float numpy array)

Ideal(Var, FluidProp, Type)

Equation of State for ideal fluids, giving back either the internal energy or pressure.

Parameters
  • Type (string) – desired output: “e”: internal energy, “p”: pressure

  • Var (float numpy array) – the value of the variables (NbVariables x NbGivenPoints). If type “e”, the variables should be [rho, rhoU, rhoV, p].T. If type “p”, the variables should be [rho, rhoU, rhoV, E].

  • FluidProp (FluidModel list) – the list of the fluid properties associated to each given Point

Returns

the pressure values at the given points (NbGivenPoints)

Return type

p (float numpy array)

dEoSRhoIdeal(Var, FluidProp)

Derivative of the Equation of State for ideal fluids along the density variable at the given points.

Parameters
  • Type (string) – desired output: “e”: internal energy, “p”: pressure

  • Var (float numpy array) – the value of the conservative variables (NbVariables x NbGivenPoints).

  • FluidProp (FluidModel list) – the list of the fluid properties associated to each given Point

Returns

derivative of the Equation of State for stiff fluids along the density variable (NbGivenPoints)

Return type

deos (float numpy array)

dEoSEIdeal(Var, FluidProp)

Derivative of the Equation of State for ideal fluids along the Energy variable at the given points.

Parameters
  • Type (string) – desired output: “e”: internal energy, “p”: pressure

  • Var (float numpy array) – the value of the conservative variables (NbVariables x NbGivenPoints).

  • FluidProp (FluidModel list) – the list of the fluid properties associated to each given Point

Returns

derivative of the Equation of State for stiff fluids along the Energy variable (NbGivenPoints)

Return type

deos (float numpy array)





Initial conditions


class 3_LESARD.SourceCode.ProblemDefinition.GoverningEquations.EulerEquations.InitialConditions(Id, *params)

Class furnishing the solution initialisation routines that are suitable to study the the Euler Equations, defined for working on a subdomain. Access the routine computing the initial conditions through the field IC, filled upon creation with the function callback corresponding to the index of the wished initialisation function. The implemented initialisation method are linked as follows. See their respective documentation for more information.

  1. ConstantState
  2. ConstantState2
  3. StationaryVortex
  4. SOD
  5. SOD_Fluid1
  6. SOD_Fluid2
  7. Karni_Fluid1(bublle)
  8. Karni_Fluid2(complement to the bubble)
Parameters
  • Id (integer) – the index corresponding to the initialisation method the user wants when considering the governing equations given in this module.

  • params (list of arguments) – the (fixed arguments to pass to the selected function)


Methods

SOD_Fluid1(PointsID, Mesh, EoS, FluidProp, *args)

Initialising the solution to a constant state that matches the SOD-inner value. (The given points should all belonging to a same subdomain).

Parameters
  • PointsID (integer array-like) – the index of the points to consider

  • Mesh (MeshStructure) – the considered mesh

  • EOS (function callback) – (optional), the equation of state given by the model of the fluid that is present at the given points

  • FluidProp (FluidSpecs) – (optional, not used here) the the properties of the fluid present where the given points are

Returns

The initialised values at the considered points (NbVariables x NbGivenPoints)

Return type

Init (float numpy array)


Note

  • *args is here only for compatibility on call

  • There is usually one initialisation routine per subdomain, and the PointsID are not necessarily contigous, be careful when assigning the values back in the regular solution.

  • For running smothly the inner circle diameter of the given subdomain should be at least 2

SOD_Fluid2(PointsID, Mesh, EoS, FluidProp, *args)

Initialising the solution to a constant state that matches the SOD-outer value. (The given points should all belonging to a same subdomain).

Parameters
  • PointsID (integer array-like) – the index of the points to consider

  • Mesh (MeshStructure) – the considered mesh

  • EOS (function callback) – the equation of state given by the model of the fluid that is present at the given points

  • FluidProp (FluidSpecs) – the the properties of the fluid present where the given points are

Returns

The initialised values at the considered points (NbVariables x NbGivenPoints)

Return type

Init (float numpy array)


Note

  • *args is here only for compatibility on call

  • There is usually one initialisation routine per subdomain, and the PointsID are not necessarily contigous, be careful when assigning the values back in the regular solution.

  • For running smothly the inner circle diameter of the given subdomain should be at least 2

ConstantState(PointsID, Mesh, EoS, FluidProp, *args)

Initialising the solution to a constant state on the given points, all belonging to a same subdomain.

Parameters
  • PointsID (integer array-like) – the index of the points to consider

  • Mesh (MeshStructure) – the considered mesh

  • EOS (function callback) – the equation of state given by the model of the fluid that is present at the given points

  • FluidProp (FluidSpecs) – the the properties of the fluid present where the given points are

Returns

The initialised values at the considered points (NbVariables x NbGivenPoints)

Return type

Init (float numpy array)


Note

  • *args is here only for compatibility on call

  • There is usually one initialisation routine per subdomain, and the PointsID are not necessarily contigous, be careful when assigning the values back in the regular solution.

ConstantState2(PointsID, Mesh, EoS, FluidProp, *args)

Initialising the solution to a constant state on the given points, all belonging to a same subdomain.

Parameters
  • PointsID (integer array-like) – the index of the points to consider

  • Mesh (MeshStructure) – the considered mesh

  • EOS (function callback) – (optional), the equation of state given by the model of the fluid that is present at the given points

  • FluidProp (FluidSpecs) – (optional, not used here) the the properties of the fluid present where the given points are

Returns

The initialised values at the considered points (NbVariables x NbGivenPoints)

Return type

Init (float numpy array)


Note

  • *args is here only for compatibility on call

  • There is usually one initialisation routine per subdomain, and the PointsID are not necessarily contigous, be careful when assigning the values back in the regular solution.

StationaryVortex(PointsID, Mesh, EoS, FluidProp, subdomain, *args)

Initialising the solution to a StationaryVortex centred at the center of mass of the subdmain. (The given points should all belonging to a same subdomain).

Parameters
  • PointsID (integer array-like) – the index of the points to consider

  • Mesh (MeshStructure) – the considered mesh

  • EOS (function callback) – the equation of state given by the model of the fluid that is present at the given points

  • FluidProp (FluidSpecs) – the the properties of the fluid present where the given points are

  • subdomain (shapely multipolyon) – (optional, not used here) the shapely polygon to which the given points belong

Returns

The initialised values at the considered points (NbVariables x NbGivenPoints)

Return type

Init (float numpy array)


Note

  • *args is here only for compatibility on call

  • There is usually one initialisation routine per subdomain, and the PointsID are not necessarily contigous, be careful when assigning the values back in the regular solution.

  • For running smothly the inner circle diameter of the given subdomain should be at least 2

SOD(PointsID, Mesh, EoS, FluidProp, subdomain)

Initialising the solution to a SOD centred at the center of mass, of width 0.5 of the subdmain. (The given points should all belonging to a same subdomain).

Parameters
  • PointsID (integer array-like) – the index of the points to consider

  • Mesh (MeshStructure) – the considered mesh

  • EOS (function callback) – the equation of state given by the model of the fluid that is present at the given points

  • FluidProp (FluidSpecs) – the the properties of the fluid present where the given points are

  • subdomain (shapely multipolyon) – (optional, not used here) the shapely polygon to which the given points belong

Returns

The initialised values at the considered points (NbVariables x NbGivenPoints)

Return type

Init (float numpy array)


Note

  • There is usually one initialisation routine per subdomain, and the PointsID are not necessarily contigous, be careful when assigning the values back in the regular solution.

  • For running smothly the inner circle diameter of the given subdomain should be at least 2

Bubble(PointsID, Mesh, EoS, FluidProp, subdomain, *args)

Initialising the solution to a constant state corresponding to the bubble in the Karni test, where the density is considered as Rconsidered/Rair fluid.

Parameters
  • PointsID (integer array-like) – the index of the points to consider

  • Mesh (MeshStructure) – the considered mesh

  • EOS (function callback) – the equation of state given by the model of the fluid that is present at the given points

  • FluidProp (FluidSpecs) – the properties of the fluid present where the given points are

  • subdomain (shapely multipolyon) – (optional, not used here) the shapely polygon to which the given points belong

Returns

The initialised values at the considered points (NbVariables x NbGivenPoints)

Return type

Init (float numpy array)


Note

  • *args is here only for compatibility on call

  • There is usually one initialisation routine per subdomain, and the PointsID are not necessarily contigous, be careful when assigning the values back in the regular solution.

PlanarShock(PointsID, Mesh, EoS, FluidProp, subdomain, MachNum=1.19, *args)

Initialising the solution to two constante state distributed on either side of a shock for the Planar shock test. The shock is set at 25% of the total x width of the domain, starting from the right. The (left) rested part is set to be such that (p, u, v, p) = [1., 0., 0., 1]. The shock is set to move from right to left.

Parameters
  • PointsID (integer array-like) – the index of the points to consider

  • Mesh (MeshStructure) – the considered mesh

  • EOS (function callback) – the equation of state given by the model of the fluid that is present at the given points

  • FluidProp (FluidSpecs) – the properties of the fluid present where the given points are

  • subdomain (shapely multipolyon) – the shapely polygon to which the given points belong

  • MachNum (float) – the desired Mach number (given on the still fluid)

Returns

The initialised values at the considered points (NbVariables x NbGivenPoints)

Return type

Init (float numpy array)


Warning

The computation of the state assumes air as fluid component


Note

  • *args is here only for compatibility on call

  • There is usually one initialisation routine per subdomain, and the PointsID are not necessarily contigous, be careful when assigning the values back in the regular solution.