Hi everyone,
I’m wondering if the method of lines can be used for a simple 2D convection:
Where Ra is the Rayleigh number and \eta is the viscosity (constants).
I’m trying to go in a straightforward manner to solve this:
@parameters t,x,z
@variables u(..), w(..), P(..), T(..), sig_11(..), sig_33(..), sig_13(..);
Dt = Differential(t)
Dx = Differential(x)
Dz = Differential(z)
Dxx = Differential(x)^2
Dzz = Differential(z)^2
domain = [x ∈ Interval(0.0, 1.0),
z ∈ Interval(0.0, 1.0),
t ∈ Interval(0.0, 1.0)]
Ra = 1e2
η = 1.0
ic_bc = [u(t,0.0,z) ~ 0,
u(t,1.0,z) ~ 0,
w(t,x,0.0) ~ 0,
w(t,x,1.0) ~ 0,
sig_33(0,x,z) ~ 0,
sig_11(0,x,z) ~ 0,
sig_13(0,x,z) ~ 0,
T(t,x,0.0) ~ 1,
T(t,x,1.0) ~ 0,
Dx(T(t,0.0,z)) ~ 0,
Dx(T(t,1.0,z)) ~ 0,
u(0,x,z) ~ 0,
w(0,x,z) ~ 0,
P(0,x,z) ~ 0,
T(0,x,z) ~ (1.0-z) - 0.01*cos(π*x/1.0)*sin(π*z)
]
eqs = [Dx(u(t,x,z)) + Dz(w(t,x,z)) ~ 0,
sig_11(t,x,z) ~ 2*η*Dx(u(t,x,z)),
sig_33(t,x,z) ~ 2*η*Dz(w(t,x,z)),
sig_13(t,x,z) ~ η*( Dz(u(t,x,z)) + Dx(w(t,x,z)) ),
Dx(P(t,x,z)) ~ Dx(sig_11(t,x,z)) + Dz(sig_13(t,x,z)),
Dz(P(t,x,z)) ~ Dx(sig_13(t,x,z)) + Dz(sig_33(t,x,z)) + Ra*(1-T(t,x,z)),
Dt(T(t,x,z)) + u(t,x,z)*Dx(T(t,x,z)) + w(t,x,z)*Dz(T(t,x,z)) ~ Dxx(T(t,x,z)) + Dzz(T(t,x,z)),
]
@named sys = PDESystem(eqs, ic_bc, domain, [t,x,z], [u(t,x,z), w(t,x,z), P(t,x,z), T(t,x,z), sig_11(t,x,z), sig_33(t,x,z), sig_13(t,x,z)])
dx = 0.1
dz = 0.1
discretization = MOLFiniteDifference([x => dx, z => dz], t, approx_order = 2)
prob = discretize(sys, discretization)
@time sol = solve(prob, Rodas5(), progress = true, saveat = 0.05)
However, I’m getting the following error (for all variables):
Warning: Solution has length 1 in dimension t. Interpolation will not be possible for variable T(t, x, z). Solution return code is InitialFailure.
I’m not sure how to debug this, one of my guesses was that the solver doesn’t iterate in time, so I changed the initial conditions but I keep getting the same error with every initial condition I’m trying.
Any insights? I’m quite frustrated