Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with time derivatives on upper spatial boundary #222

Closed
xtalax opened this issue Dec 20, 2022 · 2 comments · Fixed by #225
Closed

Issue with time derivatives on upper spatial boundary #222

xtalax opened this issue Dec 20, 2022 · 2 comments · Fixed by #225

Comments

@xtalax
Copy link
Member

xtalax commented Dec 20, 2022

https://discourse.julialang.org/t/space-varying-parameter-in-pde-with-modelingtoolkit/91897/5

@touste
Copy link

touste commented Dec 23, 2022

Hi, I put up a simple minimal example highlighting this issue:

using OrdinaryDiffEq, ModelingToolkit, MethodOfLines, DomainSets

# Parameters, variables, and derivatives
@parameters t x
@variables u(..)
Dt = Differential(t)
Dxx = Differential(x)^2

# 1D PDE and boundary conditions
eq  = Dt(u(t, x)) ~ Dxx(u(t, x))
bcs = [u(0, x) ~ 20,
        Dt(u(t, 0)) ~ 100, # Heat source
        Dt(u(t, 1)) ~ 0] # Zero flux

# Space and time domains
domains = [t ∈ Interval(0.0, 1.0),
           x ∈ Interval(0.0, 1.0)]

# PDE system
@named pdesys = PDESystem(eq, bcs, domains, [t, x], [u(t, x)])

# Method of lines discretization
dx = 0.1
order = 2
discretization = MOLFiniteDifference([x => dx], t)

# Convert the PDE problem into an ODE problem
prob = discretize(pdesys,discretization)

# Solve ODE problem
sol = solve(prob, Rodas4(), saveat=0.2)

discrete_x = sol[x]
discrete_t = sol[t]
solu = sol[u(t, x)] # Temperature should increase with time

@xtalax
Copy link
Member Author

xtalax commented Jan 6, 2023

The coveted 1 char fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants