Comments (6)
How are you using those versions? MOL v0.2 requires ModelingToolkit v8. It won't let you install that set.
from methodoflines.jl.
Sorry, I mistranscribed. I am running ModelingToolkit v8.5.5 (I double checked and the other version numbers I wrote are correct).
from methodoflines.jl.
Complex equations are not currently supported but I will be working on this, can you reformulate as a system of equations in terms of the real and imaginary parts of
A
?
from methodoflines.jl.
Thanks, I gave it a try but it doesn't seem to be working.
The PDE is the nonlinear Schrödinger equation:
im Dx(A)+Dzz(A)=-|A|^2A,
where Dx=d/dx, and Dzz=d^2/dz^2. Defining A(x,z)=a(x,z)+im b(x,z) for real functions a(x,z) and b(x,z), this becomes
-Dx(b)+Dzz(a)=-(a^2+b^2)a
Dx(a)+Dzz(b) = -(a^2+b^2)b
Following the tutorial for the Brusselator, I coded this up as below (discretising over z):
using ModelingToolkit, MethodOfLines, OrdinaryDiffEq, DomainSets
@parameters x z
@variables a(..) b(..)
Dx = Differential(x)
Dz = Differential(z)
Dzz = Differential(z)^2
xmin = 0.
xmax = 1e-1
zmax = 10.
zmin = -zmax
c0 = 1.
A0(x,z) = c0*sech(c0*z/sqrt(2))*exp(im*c0^2*x/2) #Initial condition for complex PDE
A0r(x,z) = c0*sech(c0*z/sqrt(2))*cos(c0^2*x/2) #Real part of initial condition
A0i(x,z) = c0*sech(c0*z/sqrt(2))*sin(c0^2*x/2) #Imaginary part of initial condition
domains = [x ∈ Interval(xmin,xmax), z ∈ Interval(zmin,zmax)]
eq = [-Dx(b(x,z))+Dzz(a(x,z)) ~ -(a(x,z)^2+b(x,z)^2)*a(x,z),
Dx(a(x,z))+Dzz(b(x,z)) ~ -(a(x,z)^2+b(x,z)^2)*b(x,z)]
bcs = [a(xmin,z) ~ A0r(xmin,z),
b(xmin,z) ~ A0i(xmin,z),
a(x,zmin) ~ 0, b(x,zmin) ~ 0,
a(x,zmax) ~ 0, b(x,zmax) ~ 0]
@named pdesys = PDESystem(eq,bcs,domains,[x,z],[a(x,z),b(x,z)])
N = 10 #Also tried running for N=100, got same result
dz = 1/N
order = 2
discretization = MOLFiniteDifference([z=>dz], x, approx_order=order)
@time prob = discretize(pdesys,discretization)
This gave me a very long error, they key parts of are below. I can't seem to find the problem in my code though.
Discretization failed, please post an issue on https://github.com/SciML/MethodOfLines.jl with the failing code and system at low point count.
ERROR: ExtraVariablesSystemException: The system is unbalanced. There are 402 highest order derivative variables and 398 equations.
More variables than equations, here are the potential extra variable(s):
Stacktrace:
[1] error_reporting(state::TearingState{ODESystem}, bad_idxs::Vector{Int64}, n_highest_vars::Int64, iseqs::Bool)
@ ModelingToolkit.StructuralTransformations C:\Users\ruvil\.julia\packages\ModelingToolkit\a7NhS\src\structural_transformation\utils.jl:35
[2] check_consistency(state::TearingState{ODESystem})
@ ModelingToolkit.StructuralTransformations C:\Users\ruvil\.julia\packages\ModelingToolkit\a7NhS\src\structural_transformation\utils.jl:66
[3] structural_simplify(sys::ODESystem; simplify::Bool)
@ ModelingToolkit C:\Users\ruvil\.julia\packages\ModelingToolkit\a7NhS\src\systems\abstractsystem.jl:923
[4] structural_simplify(sys::ODESystem)
@ ModelingToolkit C:\Users\ruvil\.julia\packages\ModelingToolkit\a7NhS\src\systems\abstractsystem.jl:920
[5] discretize(pdesys::PDESystem, discretization::MOLFiniteDifference{MethodOfLines.CenterAlignedGrid})
@ MethodOfLines C:\Users\ruvil\.julia\packages\MethodOfLines\9MLPx\src\discretization\MOL_discretization.jl:151
[6] top-level scope
@ .\timing.jl:220
from methodoflines.jl.
This seems to be above board, this is a bug. I'll take a closer look at this soon.
from methodoflines.jl.
Thanks! Let me know if you want me to try anything else.
from methodoflines.jl.
Related Issues (20)
- Discretization of semi-coupled wave and diffusion equations fails for step size of pi/(25n) HOT 1
- Unable to Index into a steadystate solution using symbols HOT 3
- Bound error on Discretization when specifying a uniform grid as a vector HOT 5
- Mismatch in Symbolic names, when using symbolic arrays as state variables HOT 1
- How to check the full(DerivativeOperators) in MethodOfLines
- BoundsError in Discretizing Interface Domains with Different Point Counts
- type PDESystem has no field analytic HOT 1
- Docs for solving the heat equation: extract solution HOT 5
- ArgumentError: Differential w.r.t. multiple variables Any[t, ...] are not allowed. HOT 2
- Interpolate grid values for staggered grid discretization
- Symbolic tracing in staggered grid can return Nans
- UndefVarError: `issymbollike` not defined HOT 3
- Move to using SymbolicUtils chains
- Package installation error HOT 1
- `discretize` errrors when a subset of equations have no time derivatives HOT 5
- Equation + State mismatch dependent on grid spacing
- Generating solution output for PDE takes longer than generating solution HOT 2
- MethodOfLines down-versions ModelingToolkit HOT 1
- Error with test/pde_systems/MOL_1D_Interface_Nonlinear.jl
- MOL & BoundaryConditions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from methodoflines.jl.