Skip to content

Commit 581e606

Browse files
Added test model for spatial discretization.
1 parent 826494c commit 581e606

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module TestSpatialDiscretization
2+
3+
using Modia
4+
using ModiaMath.plot
5+
6+
const n=5
7+
@model SpatialDiscretization begin
8+
u = Var(start=zeros(n))
9+
c = 1
10+
@equations begin
11+
# der(u[2:n]) = ( u[2:n] - u[1:n-1] ) / c
12+
der(u) = [1; ( u[2:n] - u[1:n-1] ) / c]
13+
end
14+
end
15+
16+
result = simulate(SpatialDiscretization, 1)
17+
plot(result, "u")
18+
19+
end
20+

test/runsimulationtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ include("models/TestEquations.jl")
1414
include("models/TestElectrical.jl")
1515
include("models/TestFilter.jl")
1616
include("models/TestArrayOfComponents.jl")
17+
include("models/TestSpatialDiscretization.jl")
1718

1819
#include("models/TestCoupledInertias.jl")
1920
#include("models/TestPendulum.jl")

0 commit comments

Comments
 (0)