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

'update_varmap!' not being used #293

Closed
oc18456 opened this issue Jul 26, 2023 · 3 comments · Fixed by #300
Closed

'update_varmap!' not being used #293

oc18456 opened this issue Jul 26, 2023 · 3 comments · Fixed by #300

Comments

@oc18456
Copy link

oc18456 commented Jul 26, 2023

In line 207 in pde_system_transformation.jl, the function update_varmap! is used but has not been imported from PDEBase and so an error is caused.

@xtalax
Copy link
Member

xtalax commented Jul 26, 2023

Can you post the error and code to reproduce? Also please check you are using latest versions.

@oc18456
Copy link
Author

oc18456 commented Jul 27, 2023

I used the code:

using Plots, MethodOfLines, DomainSets, ModelingToolkit

@variables u(..) f(..)

@parameters t θ λ P

dθ = Differential(θ)
dθθ = Differential(θ)^2
dθθθθ = Differential(θ)^4
dt = Differential(t)
dtt = Differential(t)^2

function δ(θ)
return 1/1000sqrt(2π) * exp(-θ^2/(21000^2))
end

Iθ = Integral(θ in DomainSets.ClosedInterval(-1.0,1.0))

eq = [
dtt(u(t,θ)) ~ -dθθθθ(u(t,θ)) + λ^2 * dθ(f(t,θ) - u(t,θ) +0.5dθ(u(t,θ))^2dθ(u(t,θ)))+λ^2 * (f(t,θ) - u(t,θ) +0.5dθ(u(t,θ))^2)+Pδ(θ), 0 ~ Iθ(f(t,θ))
]

bcs = [
u(t,-1.0) ~ 0.0, u(t,1.0) ~ 0.0,
dθ(dθ(u(t,-1.0))) ~ 0.0, dθ(dθ(u(t,1.0))) ~ 0.0,
dθ(f(t,-1.0)) - dθ(u(t,-1.0)) ~ 0.0, dθ(f(t,1.0)) - dθ(u(t,1.0)) ~ 0.0,
u(0.0,θ) ~ 0.0, dt(u(0.0,θ)) ~ 0.0
]

domains = [t ∈ (0.0,50.0),
θ ∈ (-1.0,1.0)]

@nAmed pde_sys = PDESystem(eq, bcs, domains, [t,θ], [u(t,θ),f(t,θ)])

discretisation = MOLFiniteDifference([θ => 100],t)

prob = MethodOfLines.discretize(pde_sys, discretisation)

and got the error message:

ERROR: UndefVarError: update_varmap! not defined

I manually changed the export line in pde_system_transformation.jl, and also had to manually copy over the function get_ops but this resolved the issue on my machine.

@giav1n
Copy link

giav1n commented Jul 27, 2023

I have the exact same problem with a stationary 1D pde:

using MethodOfLines,DomainSets,NonlinearSolve,ModelingToolkit
@parameters x
@variables u(..)
Dxx = Differential(x)^2
Dx = Differential(x)

D=0.1
L=5

eq= -Dx((x-x^3)u(x)) +DDxx(u(x)) ~ 0
bcs = [u(-L) ~ 0,u(-L)~ 0]

domains = [x ∈ Interval(-L, L)]

@nAmed pdesys = PDESystem(eq, bcs, domains, [x], [u(x)])
dx = 0.1
discretization = MOLFiniteDifference(x => dx, approx_order=2)
prob = discretize(pdesys, discretization)

it works fine in 2D spatial dimension

xtalax added a commit that referenced this issue Aug 8, 2023
xtalax added a commit that referenced this issue Sep 20, 2023
* add precompilation stage

* merge precompiliation discretizations

* fix

* fix #293

* Update Project.toml

* CompatHelper: add new compat entry for PrecompileTools at version 1, (keep existing compat)

* Try new scheme for mixed derivs

* remove show

* mark broken

* init mixed deriv rules

* Update Project.toml

---------

Co-authored-by: CompatHelper Julia <compathelper_noreply@julialang.org>
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.

3 participants