This package contains integrator block that implements Finite Volume Methods by using flux limiters.
Release Notes:
| Name | Description |
|---|---|
PDE.FiniteVolume.FluxLimiter.FLIntegrator.FLIntegrator
The FLIntegrator takes as input the two fluctuation matrices, limited flux matrix, initial condition matrix and two boundary condition matrices.
As output the block gives the average matrix Q. It implements the average update rule
Release Notes:
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | n | worldModel1.n | |
| Integer | m | worldModel1.m | |
| Real | beta | 1 | |
| Real | delta_x | 1/n | |
| Real | delta_t | 0.1 | |
| Unknowns | |||
| Integer | vb | gcl + 1 | The left most unknown |
| Integer | ve | gcl + worldModel1.n | The right most unknown |
| Initial Condition | |||
| Integer | icb | gcl + 1 | Begin of the initial condition |
| Integer | ice | gcl + worldModel1.n | End of the initial condition |
| Boundary Conditions | |||
| Integer | bcl | 1 | Boundary condition at the left (0: no; 1: yes) |
| Integer | bcr | 1 | Boundary condition at the right (0: no; 1: yes) |
| Integer | gcl | 2 | Number of ghost cells at the left |
| Integer | gcr | 2 | Number of ghost cells at the right |
| Type | Name | Description |
|---|---|---|
| input RealInput | u[worldModel1.m, worldModel1.n + 1] | |
| input RealInput | u1[worldModel1.m, worldModel1.n + 1] | |
| input RealInput | u2[worldModel1.m, worldModel1.n + 1] | |
| input RealInput | u4[worldModel1.m, worldModel1.n] | |
| input RealInput | u5[worldModel1.m, worldModel1.gcl] | |
| input RealInput | u6[worldModel1.m, worldModel1.gcr] | |
| output RealOutput | y[worldModel1.m, worldModel1.n + worldModel1.gcl + worldModel1.gcr] |
block FLIntegrator
extends Icons.BlockIcon1;
outer PDE.World.worldModel worldModel1;
parameter Integer n = worldModel1.n;
parameter Integer m = worldModel1.m;
parameter Real beta = 1;
parameter Integer vb = gcl+1 "|Unknowns| The left most unknown";
parameter Integer ve = gcl + worldModel1.n "|Unknowns| The right most unknown";
parameter Integer icb = gcl+1
"|Initial Condition| Begin of the initial condition";
parameter Integer ice = gcl + worldModel1.n
"|Initial Condition| End of the initial condition";
parameter Integer bcl = 1
"|Boundary Conditions| Boundary condition at the left (0: no; 1: yes)";
parameter Integer bcr = 1
"|Boundary Conditions| Boundary condition at the right (0: no; 1: yes)";
parameter Integer gcl = 2
"|Boundary Conditions| Number of ghost cells at the left";
parameter Integer gcr = 2
"|Boundary Conditions| Number of ghost cells at the right";
parameter Real delta_x = 1/n;
parameter Real delta_t = 0.1;
Real q[worldModel1.m, worldModel1.n + worldModel1.gcl + worldModel1.gcr];
Modelica.Blocks.Interfaces.RealInput u[worldModel1.m,worldModel1.n + 1];
Modelica.Blocks.Interfaces.RealInput u1[worldModel1.m,worldModel1.n + 1];
Modelica.Blocks.Interfaces.RealInput u2[worldModel1.m,worldModel1.n + 1];
Modelica.Blocks.Interfaces.RealInput u4[worldModel1.m,worldModel1.n];
Modelica.Blocks.Interfaces.RealInput u5[worldModel1.m,worldModel1.gcl];
Modelica.Blocks.Interfaces.RealInput u6[worldModel1.m,worldModel1.gcr];
equation
y = q;
for i in 1:m loop
for j in 1:gcl loop
q[i, j]= u5[i, j];
end for;
end for;
for i in 1:m loop
if bcl == 1 then
q[i, gcl+1] = q[i, gcl];
end if;
end for;
for i in 1:m loop
for j in 1:gcr loop
q[i, gcl+n+j] = u6[i, j];
end for;
end for;
for i in 1:m loop
if bcr == 1 then
q[i, gcl+n] = q[i, gcl+n+1];
end if;
end for;
for j in 1:m loop
for i in vb:ve loop
der(q[j, i]) = -(1/delta_x)*(u[j, i-gcl] + u1[j, i-gcl+1]) - (1/delta_x)*(u2[j, i-gcl+1] - u2[j, i-gcl]);
end for;
end for;
initial equation
for j in 1:m loop
for i in icb:ice loop
q[j, i] = u4[j, i-gcl];
end for;
end for;
public
Modelica.Blocks.Interfaces.RealOutput y[worldModel1.m,worldModel1.n
+ worldModel1.gcl + worldModel1.gcr];
end FLIntegrator;