Open kkakosim opened 3 years ago
There is no example of one right now. The closest is to use PDESystem to describe such a BVP. It's a future feature.
I used the PDE System in MTk but I get this strange error with the Robin BC. I checked the tests, but still trying to figure out what should be the correct format.
using ModelingToolkit,DiffEqOperators,DiffEqBase,LinearAlgebra,Test,OrdinaryDiffEq
using ModelingToolkit: Differential
using Plots
gr()
@inline function if_else(condition::Bool, @nospecialize(trueval), @nospecialize(falseval))
return ifelse(condition, trueval, falseval)
end
ModelingToolkit.@register if_else(x, trueval, falseval)
# This is needed to bring if_else into MTK's scope.
@eval ModelingToolkit using ..Main: if_else
@parameters t x
@variables T(..)
Dt = Differential(t)
Dx = Differential(x)
kc = 25.
ks = 385.
Tf = 350.
Rc = 0.005
Rs = 1.5 * Rc
h = 100.
Sc = 1.E8
Tinit = 298.
# 1D PDE and boundary conditions
eq = Dt(T(t,x)) ~ kc * (1/x^2) * Dx( (1/x^2) * Dx( T(t, x) ) ) + Sc * (1 - x/Rs)
bcs=[T(0, x) ~ Tinit,
Dx(T(t, 0)) ~ 0.,
Dx(T(t, Rs)) ~ h/kc * (T(t, Rs) - Tf)]
# Space and time domains
domains = [t ∈ IntervalDomain(0.0, 1.),
x ∈ IntervalDomain(0.0 , Rs)]
# PDE system
pdesys = PDESystem(eq, bcs, domains, [t,x], [T])
# Method of lines discretization
dx =Rc/10
order = 2
discretization = MOLFiniteDifference(dx,order)
# Convert the PDE problem into an ODE problem
prob = discretize(pdesys, discretization)
# Solve ODE problem
sol = solve(prob, Tsit5(), saveat=0.1)
The error is
lhs = T(0, x) lhs = Differential(x)(T(t, 0)) lhs = Differential(x)(T(t, 0.0075)) ERROR: LoadError: UndefVarError: T not defined
when I set the T(t, Rs)
to a fixed it works. I tried changing the format of this BC with no success.
MOLFiniteDifference
won't support BVPs right now.
@ChrisRackauckas Would you have a new status about BVProblem
with MTK ? I'm trying to apply this to a simple 1D model but it fails at the moment.
I talked with someone at JuliaCon about it, I think @AayushSabharwal ? So after he's done with vacation he has a long list but it's scheduled.
Hello all, is there any example or test implementing a "BVPsystem"? I tried to implement like ODE but with no luck