This package contains Euler equations example solved with the Finite Volume Methods by using flux limiters.
Release Notes:
| Name | Description |
|---|---|
| Euler | |
Implements the Euler system of equations
with Roe´s flux. The initial conditions are
The boundary conditions are
This system has eigenvalues
and eigenvector matrix
that are computed at each time step at each interface by the corresponding blocks.
Release Notes:
model Euler
Alpha.Alpha alpha;
Modelica.Blocks.Math.Add3 add3_1[worldModel1.m,worldModel1.n + 1];
Modelica.Blocks.Math.Add3 add3_2[worldModel1.m,worldModel1.n + 1];
Modelica.Blocks.Math.Add3 add3_3[worldModel1.m,worldModel1.n + 1];
DeltaQ.deltaQ deltaQ;
FLIntegrator.FLIntegrator EulerSystem(bcl=0, bcr=0);
FluxLimiterSolver.FluxLimiterSolver fluxLimiterSolver;
FluxLimiterSolver.FluxLimiterSolver fluxLimiterSolver1(p=2);
FluxLimiterSolver.FluxLimiterSolver fluxLimiterSolver2(p=3);
PDE.FiniteVolume.FluxLimiter.Examples.Acoustic.ICacoustics iCacoustics;
PDE.FiniteVolume.FluxLimiter.Examples.Acoustic.BCLacoustics bCLacoustics;
PDE.FiniteVolume.FluxLimiter.Examples.Acoustic.BCRacoustics bCRacoustics;
Modelica.Blocks.Math.Product product[worldModel1.n + worldModel1.gcl
+ worldModel1.gcr];
Modelica.Blocks.Math.Division division[worldModel1.n + worldModel1.
gcl + worldModel1.gcr];
Modelica.Blocks.Sources.RealExpression gamma[worldModel1.n +
worldModel1.gcl + worldModel1.gcr](y=1.4);
Modelica.Blocks.Math.Sqrt c[worldModel1.n + worldModel1.gcl +
worldModel1.gcr];
Modelica.Blocks.Math.Product product1[worldModel1.n + worldModel1.gcl
+ worldModel1.gcr];
Modelica.Blocks.Sources.RealExpression konst[worldModel1.n +
worldModel1.gcl + worldModel1.gcr](y=3.5);
Modelica.Blocks.Math.Division division1[worldModel1.n + worldModel1.
gcl + worldModel1.gcr];
Modelica.Blocks.Math.Product product2[worldModel1.n + worldModel1.gcl
+ worldModel1.gcr];
Modelica.Blocks.Math.Product product3[worldModel1.n + worldModel1.gcl
+ worldModel1.gcr];
Modelica.Blocks.Sources.RealExpression onehalf[worldModel1.n +
worldModel1.gcl + worldModel1.gcr](y=0.5);
Modelica.Blocks.Math.Add h[worldModel1.n + worldModel1.gcl +
worldModel1.gcr];
R r;
L l(n=worldModel1.n, m=3);
WaveP1 waveP1_1;
WaveP1 waveP1_2(p=2);
WaveP1 waveP1_3(p=3);
Fluctuation1 fluctuation1_1;
Fluctuation1 fluctuation1_2;
Fluctuation1 fluctuation1_3;
teta1 teta1_1(p=2);
teta1 teta1_2;
teta1 teta1_3(p=3);
LimitedWave1 limitedWave1_1;
LimitedWave1 limitedWave1_2;
LimitedWave1 limitedWave1_3;
FluxLimited1 fluxLimited1_1;
FluxLimited1 fluxLimited1_2(p=2);
FluxLimited1 fluxLimited1_3(p=3);
inner World.worldModel worldModel1(m=3,
deltat=0.0004,
fls=5,
n=10);
Filter1 filter1_1;
Riemann1 riemann1_1;
equation
connect(EulerSystem.y, deltaQ.u);
connect(add3_1.y, EulerSystem.u);
connect(add3_2.y, EulerSystem.u1);
connect(add3_3.y, EulerSystem.u2);
connect(bCRacoustics.y, EulerSystem.u6);
connect(bCLacoustics.y, EulerSystem.u5);
connect(iCacoustics.y, EulerSystem.u4);
connect(EulerSystem.y[3, :], product.u2);
connect(gamma.y, product.u1);
connect(product.y, division.u1);
connect(EulerSystem.y[1, :], division.u2);
connect(division.y, c.u);
connect(konst.y, product1.u1);
connect(EulerSystem.y[3, :], product1.u2);
connect(product1.y, division1.u1);
connect(EulerSystem.y[1, :], division1.u2);
connect(EulerSystem.y[2, :], product2.u1);
connect(EulerSystem.y[2, :], product2.u2);
connect(product2.y, product3.u1);
connect(onehalf.y, product3.u2);
connect(product3.y, h.u2);
connect(division1.y, h.u1);
connect(c.y, l.u1);
connect(c.y, r.u1);
connect(h.y, r.u2);
connect(EulerSystem.y[2, :], r.u);
connect(EulerSystem.y[2, :], l.u);
connect(alpha.y, waveP1_1.u);
connect(alpha.y, waveP1_2.u);
connect(alpha.y, waveP1_3.u);
connect(waveP1_1.y, fluctuation1_1.u1);
connect(waveP1_2.y, fluctuation1_2.u1);
connect(fluctuation1_1.y, add3_1.u1);
connect(fluctuation1_2.y, add3_1.u2);
connect(waveP1_3.y, fluctuation1_3.u1);
connect(fluctuation1_3.y, add3_1.u3);
connect(fluctuation1_1.y1, add3_2.u1);
connect(fluctuation1_2.y1, add3_2.u2);
connect(fluctuation1_3.y1, add3_2.u3);
connect(l.y, fluctuation1_1.u);
connect(l.y1, fluctuation1_2.u);
connect(l.y2, fluctuation1_3.u);
connect(teta1_1.y, fluxLimiterSolver1.u);
connect(l.y1, teta1_1.u1);
connect(l.y, teta1_2.u1);
connect(l.y2, teta1_3.u1);
connect(teta1_3.y, fluxLimiterSolver2.u);
connect(teta1_2.y, fluxLimiterSolver.u);
connect(fluxLimiterSolver.y, limitedWave1_1.u);
connect(waveP1_1.y, limitedWave1_1.u1);
connect(fluxLimiterSolver1.y, limitedWave1_2.u);
connect(fluxLimiterSolver2.y, limitedWave1_3.u);
connect(waveP1_2.y, limitedWave1_2.u1);
connect(waveP1_3.y, limitedWave1_3.u1);
connect(limitedWave1_1.y, fluxLimited1_1.u1);
connect(limitedWave1_2.y, fluxLimited1_2.u1);
connect(limitedWave1_3.y, fluxLimited1_3.u1);
connect(l.y, fluxLimited1_1.u);
connect(l.y1, fluxLimited1_2.u);
connect(l.y2, fluxLimited1_3.u);
connect(fluxLimited1_1.y, add3_3.u1);
connect(fluxLimited1_2.y, add3_3.u2);
connect(fluxLimited1_3.y, add3_3.u3);
connect(r.y, filter1_1.u);
connect(filter1_1.y, waveP1_1.u1);
connect(filter1_1.y, waveP1_2.u1);
connect(filter1_1.y, waveP1_3.u1);
connect(deltaQ.y, riemann1_1.u);
connect(r.y, riemann1_1.u1);
connect(riemann1_1.y, alpha.u);
connect(riemann1_1.y, teta1_2.u);
connect(riemann1_1.y, teta1_1.u);
connect(riemann1_1.y, teta1_3.u);
end Euler;
PDE.FiniteVolume.FluxLimiter.Examples.EulerSystem.R
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | n | worldModel1.n | |
| Integer | m | worldModel1.m | |
| Integer | gcl | worldModel1.gcl | |
| Integer | gcr | worldModel1.gcr |
| Type | Name | Description |
|---|---|---|
| input RealInput | u[worldModel1.n + worldModel1.gcl + worldModel1.gcr] | |
| input RealInput | u1[worldModel1.n + worldModel1.gcl + worldModel1.gcr] | |
| input RealInput | u2[worldModel1.n + worldModel1.gcl + worldModel1.gcr] | |
| output RealOutput | y[worldModel1.m, worldModel1.m, worldModel1.n + worldModel1.gcl + worldModel1.gcr - 1] |
block R
extends Icons.BlockIcon;
outer PDE.World.worldModel worldModel1;
parameter Integer n = worldModel1.n;
parameter Integer m = worldModel1.m;
parameter Integer gcl = worldModel1.gcl;
parameter Integer gcr = worldModel1.gcr;
Modelica.Blocks.Interfaces.RealInput u[worldModel1.n + worldModel1.
gcl + worldModel1.gcr];
Modelica.Blocks.Interfaces.RealInput u1[worldModel1.n + worldModel1.
gcl + worldModel1.gcr];
Modelica.Blocks.Interfaces.RealInput u2[worldModel1.n + worldModel1.
gcl + worldModel1.gcr];
equation
for j in 1:n+gcl+gcr-1 loop
y[1, 1, j] = 1.0;
y[2, 1, j] = u[j] - u1[j];
y[3, 1, j] = u2[j] - u[j]*u1[j];
y[1, 2, j] = 1.0;
y[2, 2, j] = u[j];
y[3, 2, j] = 0.5*((u[j])^2);
y[1, 3, j] = 1.0;
y[2, 3, j] = u[j] + u1[j];
y[3, 3, j] = u2[j] + u[j]*u1[j];
end for;
public
Modelica.Blocks.Interfaces.RealOutput y[worldModel1.m,worldModel1.m,
worldModel1.n + worldModel1.gcl + worldModel1.gcr - 1];
end R;
PDE.FiniteVolume.FluxLimiter.Examples.EulerSystem.L
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | n | 10 | Number of grid points or cells |
| Integer | qss | 1 | First-order space derivative (qss 1: second-order, 2: fourth-order, 3: sixth-order) |
| Integer | u_xx | 1 | Second-order space derivative(u_xx Method 1: second-order, 2: fourth-order) |
| Finite Volume Method | |||
| Integer | gcl | 2 | Number of left ghost cells |
| Integer | gcr | 2 | Number of right ghost cells |
| Real | deltax | 1/n | Space interval |
| Real | deltat | 0 | Time interval |
| Integer | m | 0 | Flux Limiter: Number of unknowns in the system of equations |
| Integer | fls | 1 | Flux Limiter Method 1: Upwind, 2: Lax Wendroff, 3: Beam Warming, 4: Fromm, 5: van Leer |
| Type | Name | Description |
|---|---|---|
| input RealInput | u[worldModel1.n + worldModel1.gcl + worldModel1.gcr] | |
| input RealInput | u1[worldModel1.n + worldModel1.gcl + worldModel1.gcr] | |
| output RealOutput | y[worldModel1.n + 1] | |
| output RealOutput | y1[worldModel1.n + 1] | |
| output RealOutput | y2[worldModel1.n + 1] |
block L
extends World.worldModel;
outer PDE.World.worldModel worldModel1;
parameter Integer n = worldModel1.n;
parameter Integer m = worldModel1.m;
equation
for j in 1:n+1 loop
y[j] = u[j] - u1[j];
y1[j] = u[j];
y2[j] = u[j] + u1[j];
end for;
public
Modelica.Blocks.Interfaces.RealInput u[worldModel1.n + worldModel1.gcl +
worldModel1.gcr];
Modelica.Blocks.Interfaces.RealInput u1[worldModel1.n + worldModel1.gcl +
worldModel1.gcr];
Modelica.Blocks.Interfaces.RealOutput y[worldModel1.n + 1];
Modelica.Blocks.Interfaces.RealOutput y1[worldModel1.n + 1];
Modelica.Blocks.Interfaces.RealOutput y2[worldModel1.n + 1];
end L;
PDE.FiniteVolume.FluxLimiter.Examples.EulerSystem.Riemann1
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | m | worldModel1.m | |
| Integer | n | worldModel1.n | |
| Integer | gcl | worldModel1.gcl | |
| Integer | gcr | worldModel1.gcr |
| Type | Name | Description |
|---|---|---|
| input RealInput | u[worldModel1.m, worldModel1.n + worldModel1.gcl + worldModel1.gcr - 1] | |
| input RealInput | u1[worldModel1.m, worldModel1.m, worldModel1.n + worldModel1.gcl + worldModel1.gcr - 1] | |
| output RealOutput | y[worldModel1.m, worldModel1.n + worldModel1.gcl + worldModel1.gcr - 1] |
block Riemann1
extends Icons.BlockIcon;
outer PDE.World.worldModel worldModel1;
parameter Integer m = worldModel1.m;
parameter Integer n = worldModel1.n;
parameter Integer gcl = worldModel1.gcl;
parameter Integer gcr = worldModel1.gcr;
Real alpha[worldModel1.m, worldModel1.n + worldModel1.gcl + worldModel1.gcr - 1];
equation
for j in 1:n+gcl+gcr-1 loop
for k in 1:m loop
u[k, j] = u1[1, k, j]*alpha[1, j] + u1[2, k, j]*alpha[2, j] + u1[3, k, j]*alpha[3, j];
end for;
end for;
y = alpha;
// for j in 1:n+gcl+gcr-1 loop
// u = u1[:, :, j]*alpha;
// y = alpha;
// end for;
public
Modelica.Blocks.Interfaces.RealInput u[worldModel1.m,worldModel1.n +
worldModel1.gcl + worldModel1.gcr - 1];
Modelica.Blocks.Interfaces.RealInput u1[worldModel1.m,worldModel1.m,
worldModel1.n + worldModel1.gcl + worldModel1.gcr - 1];
Modelica.Blocks.Interfaces.RealOutput y[worldModel1.m,worldModel1.n
+ worldModel1.gcl + worldModel1.gcr - 1];
end Riemann1;
PDE.FiniteVolume.FluxLimiter.Examples.EulerSystem.WaveP1
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | m | worldModel1.m | |
| Integer | n | worldModel1.n | |
| Integer | gcl | worldModel1.gcl | |
| Integer | gcr | worldModel1.gcr | |
| Integer | p | 1 |
| Type | Name | Description |
|---|---|---|
| input RealInput | u[worldModel1.m, worldModel1.n + 1] | |
| input RealInput | u1[worldModel1.m, worldModel1.m, worldModel1.n + 1] | |
| output RealOutput | y[worldModel1.m, worldModel1.n + 1] |
block WaveP1
extends Icons.BlockIcon;
outer PDE.World.worldModel worldModel1;
parameter Integer m = worldModel1.m;
parameter Integer n = worldModel1.n;
parameter Integer gcl = worldModel1.gcl;
parameter Integer gcr = worldModel1.gcr;
parameter Integer p = 1;
equation
for j in 1:n+1 loop
for i in 1:m loop
y[i, j] = u[p, j]*u1[i, p, j];
end for;
end for;
public
Modelica.Blocks.Interfaces.RealInput u[worldModel1.m,worldModel1.n +
1];
Modelica.Blocks.Interfaces.RealInput u1[worldModel1.m,worldModel1.m,
worldModel1.n + 1];
Modelica.Blocks.Interfaces.RealOutput y[worldModel1.m,worldModel1.n
+ 1];
end WaveP1;
PDE.FiniteVolume.FluxLimiter.Examples.EulerSystem.Fluctuation1
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | n | worldModel1.n | |
| Integer | m | worldModel1.m | |
| Integer | gcl | worldModel1.gcl | |
| Integer | gcr | worldModel1.gcr |
| Type | Name | Description |
|---|---|---|
| input RealInput | u[worldModel1.n + 1] | |
| input RealInput | u1[worldModel1.m, worldModel1.n + 1] | |
| output RealOutput | y[worldModel1.m, worldModel1.n + 1] | |
| output RealOutput | y1[worldModel1.m, worldModel1.n + 1] |
block Fluctuation1
extends Icons.BlockIcon;
outer PDE.World.worldModel worldModel1;
parameter Integer n = worldModel1.n;
parameter Integer m = worldModel1.m;
parameter Integer gcl = worldModel1.gcl;
parameter Integer gcr = worldModel1.gcr;
Modelica.Blocks.Interfaces.RealInput u[worldModel1.n + 1];
Modelica.Blocks.Interfaces.RealInput u1[worldModel1.m,worldModel1.n
+ 1];
Modelica.Blocks.Interfaces.RealOutput y[worldModel1.m,worldModel1.n
+ 1];
Modelica.Blocks.Interfaces.RealOutput y1[worldModel1.m,worldModel1.n
+ 1];
equation
for j in 1:n+1 loop
if u[j] > 0 then
for i in 1:m loop
y[i, j] = u[j]*u1[i, j];
y1[i, j] = 0;
end for;
elseif u[j] < 0 then
for i in 1:m loop
y1[i, j] = u[j]*u1[i, j];
y[i, j] = 0;
end for;
else
for i in 1:m loop
y[i, j] = 0;
y1[i, j] = 0;
end for;
end if;
end for;
end Fluctuation1;
PDE.FiniteVolume.FluxLimiter.Examples.EulerSystem.teta1
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | n | worldModel1.n | |
| Integer | gcl | worldModel1.gcl | |
| Integer | gcr | worldModel1.gcr | |
| Integer | p | 1 |
| Type | Name | Description |
|---|---|---|
| input RealInput | u[worldModel1.m, worldModel1.n + worldModel1.gcl + worldModel1.gcr - 1] | |
| input RealInput | u1[worldModel1.n + 1] | |
| output RealOutput | y[worldModel1.m, worldModel1.n + 1] |
block teta1
extends Icons.BlockIcon;
outer PDE.World.worldModel worldModel1;
parameter Integer n = worldModel1.n;
parameter Integer gcl = worldModel1.gcl;
parameter Integer gcr = worldModel1.gcr;
parameter Integer p = 1;
equation
for j in 1:n+1 loop
if u1[j] > 0 then
if u[p, j+1] == 0 then
y[p, j] = 0.0;
else
y[p, j] = u[p, j]/u[p, j+1];
end if;
elseif u1[j] < 0 then
if u[p, j+1] == 0 then
y[p, j] = 0.0;
else
y[p, j] = u[p, j+2]/u[p, j+1];
end if;
else
y[p, j] = 0.0;
end if;
end for;
public
Modelica.Blocks.Interfaces.RealInput u[worldModel1.m,worldModel1.n +
worldModel1.gcl + worldModel1.gcr - 1];
Modelica.Blocks.Interfaces.RealInput u1[worldModel1.n + 1];
Modelica.Blocks.Interfaces.RealOutput y[worldModel1.m,worldModel1.n
+ 1];
end teta1;
PDE.FiniteVolume.FluxLimiter.Examples.EulerSystem.LimitedWave1
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | m | worldModel1.m | |
| Integer | n | worldModel1.n | |
| Integer | gcl | worldModel1.gcl | |
| Integer | gcr | worldModel1.gcr | |
| Integer | p | 1 |
| Type | Name | Description |
|---|---|---|
| output RealOutput | y[worldModel1.m, worldModel1.n + 1] | |
| input RealInput | u[worldModel1.m, worldModel1.n + 1] | |
| input RealInput | u1[worldModel1.m, worldModel1.n + 1] |
block LimitedWave1
extends Icons.BlockIcon;
outer PDE.World.worldModel worldModel1;
parameter Integer m = worldModel1.m;
parameter Integer n = worldModel1.n;
parameter Integer gcl = worldModel1.gcl;
parameter Integer gcr = worldModel1.gcr;
parameter Integer p = 1;
equation
for j in 1:n+1 loop
for i in 1:m loop
y[i, j] = u[p, j]*u1[i, p];
end for;
end for;
public
Modelica.Blocks.Interfaces.RealOutput y[worldModel1.m,worldModel1.n
+ 1];
Modelica.Blocks.Interfaces.RealInput u[worldModel1.m,worldModel1.n +
1];
Modelica.Blocks.Interfaces.RealInput u1[worldModel1.m,worldModel1.n
+ 1];
end LimitedWave1;
PDE.FiniteVolume.FluxLimiter.Examples.EulerSystem.FluxLimited1
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | n | worldModel1.n | |
| Integer | m | worldModel1.m | |
| Integer | gcl | worldModel1.gcl | |
| Integer | gcr | worldModel1.gcr | |
| Real | deltat | worldModel1.deltat | |
| Real | deltax | 1/n | |
| Integer | p | 1 |
| Type | Name | Description |
|---|---|---|
| input RealInput | u[worldModel1.n + 1] | |
| input RealInput | u1[worldModel1.m, worldModel1.n + 1] | |
| output RealOutput | y[worldModel1.m, worldModel1.n + 1] |
block FluxLimited1
extends Icons.BlockIcon;
outer PDE.World.worldModel worldModel1;
parameter Integer n = worldModel1.n;
parameter Integer m = worldModel1.m;
parameter Integer gcl = worldModel1.gcl;
parameter Integer gcr = worldModel1.gcr;
parameter Real deltat = worldModel1.deltat;
parameter Real deltax = 1/n;
parameter Integer p = 1;
equation
for j in 1:n+1 loop
for i in 1:m loop
y[i, j] = 0.5*abs(u[j])*(1-(deltat/deltax)*abs(u[j]))*u1[i, j];
end for;
end for;
public
Modelica.Blocks.Interfaces.RealInput u[worldModel1.n + 1];
Modelica.Blocks.Interfaces.RealInput u1[worldModel1.m,worldModel1.n
+ 1];
Modelica.Blocks.Interfaces.RealOutput y[worldModel1.m,worldModel1.n
+ 1];
end FluxLimited1;
PDE.FiniteVolume.FluxLimiter.Examples.EulerSystem.Filter1
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | m | worldModel1.m | |
| Integer | n | worldModel1.n | |
| Integer | gcl | worldModel1.gcl | |
| Integer | gcr | worldModel1.gcr | |
| Integer | p | 1 |
| Type | Name | Description |
|---|---|---|
| input RealInput | u[worldModel1.m, worldModel1.m, worldModel1.n + worldModel1.gcl + worldModel1.gcr - 1] | |
| output RealOutput | y[worldModel1.m, worldModel1.m, worldModel1.n + 1] |
block Filter1
extends Icons.BlockIcon;
outer PDE.World.worldModel worldModel1;
parameter Integer m = worldModel1.m;
parameter Integer n = worldModel1.n;
parameter Integer gcl = worldModel1.gcl;
parameter Integer gcr = worldModel1.gcr;
parameter Integer p = 1;
equation
for j in 1:n+1 loop
for i in 1:m loop
for k in 1:m loop
y[i, k, j] = u[i, k, j+1];
end for;
end for;
end for;
public
Modelica.Blocks.Interfaces.RealInput u[worldModel1.m,worldModel1.m,
worldModel1.n + worldModel1.gcl + worldModel1.gcr - 1];
Modelica.Blocks.Interfaces.RealOutput y[worldModel1.m,worldModel1.m,
worldModel1.n + 1];
end Filter1;