This package contains advection equation solved with the Method of Lines.
Release Notes:
| Name | Description |
|---|---|
| AdvectionEquation | |
Implements the linear advection equation
where c is a constant value. The initial condition is
and boundary condition at the left is
The analytical solution of this problem is implemented in AdvectionAnalytic block
Release Notes:
model AdvectionEquation
inner World.worldModel worldModel1(qss=2, n=10);
PDE.MOL.Integrator.UniversalIntegrator Advection(
ve=worldModel1.n,
ice=worldModel1.n,
bcr=0,
vb=2,
icb=2,
bcl=1);
Modelica.Blocks.Math.Product product[worldModel1.n];
Modelica.Blocks.Sources.RealExpression BCL(y=cos(-0.1*time));
AdvectionAnalytic advectionAnalytic;
Modelica.Blocks.Sources.RealExpression Speed[worldModel1.n](y=-0.1);
PDE.MOL.SpaceDerivative.Derivatives.u_x derivator;
Diffusion.DiffusionIC diffusionIC;
equation
connect(BCL.y, Advection.u2);
connect(diffusionIC.y, Advection.u1);
connect(product.y, Advection.u);
connect(Speed.y, product.u2);
connect(derivator.y, product.u1);
connect(Advection.y, derivator.u);
end AdvectionEquation;
PDE.MOL.Examples.Advection.AdvectionAnalytic
Implements the analytical solution of the advection equation
Release Notes:
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | n | worldModel1.n | |
| Real | speed | 0.1 |
| Type | Name | Description |
|---|---|---|
| output RealOutput | y[worldModel1.n] |
block AdvectionAnalytic
extends Icons.BlockIcon4;
outer PDE.World.worldModel worldModel1;
parameter Integer n = worldModel1.n;
parameter Real speed = 0.1;
equation
for i in 1:n loop
//y[i+1] = 1 - abs((i)/n);
y[i] = cos(((i-1)/(n-1)) - speed*time);
end for;
public
Modelica.Blocks.Interfaces.RealOutput y[worldModel1.n];
end AdvectionAnalytic;