Git Product home page Git Product logo

Comments (10)

KirillZubov avatar KirillZubov commented on August 23, 2024 1

@seadra @ChrisRackauckas I'm sorry,
Actually, matrix PDE is already supported.
Here's an example that runs:

@parameters x y θ
@variables u[1:2,1:2](..)
@derivatives Dxx''~x
@derivatives Dyy''~y

# matrix PDE
eqs  = @. [(Dxx(u_(x,y,θ)) + Dyy(u_(x,y,θ))) for u_ in u] ~ -sin(pi*x)*sin(pi*y)*[0 1; 0 1]

# Initial and boundary conditions
bcs = [[u[1](x,0,θ) ~ x u[2](x,0,θ) ~ 2;
        u[3](x,0,θ) ~ 3 u[4](x,0,θ) ~ 4]]
# or
# bcs = [@. [u_(x,0,θ) for u_ in u]  ~ [x 1; 3 4]]

# Space and time domains
domains = [x ∈ IntervalDomain(0.0,1.0), y ∈ IntervalDomain(0.0,1.0)]

# Discretization
dx = 0.1
discretization = NeuralPDE.PhysicsInformedNN(dx)

# Neural network and optimizer
opt = Flux.ADAM(0.1)
chain = FastChain(FastDense(2,8,Flux.σ),FastDense(8,4))

pde_system = PDESystem(eqs,bcs,domains,[x,y],u)
prob = NeuralPDE.discretize(pde_system,discretization)
alg = NeuralPDE.NNDE(chain,opt,autodiff=false)
phi,res = solve(prob,alg,verbose=true, maxiters=50)

I'll double-check this task again when I move to generalize the parser.

from neuralpde.jl.

ChrisRackauckas avatar ChrisRackauckas commented on August 23, 2024

What do you want that equation to say? I don't understand the equation.

from neuralpde.jl.

seadra avatar seadra commented on August 23, 2024

Sorry about the lack of details in the example. u is supposed to be a 4x4 matrix in the equation, although I couldn't find a way to specify it.

In practice, though, the kind of PDE I'm after is a complex vector equation (like Schrodinger equation with spin) where the Hamiltonian is a position-dependent matrix.

from neuralpde.jl.

ChrisRackauckas avatar ChrisRackauckas commented on August 23, 2024

@variables u[1:4,1:4] and

A = sin(pi*x)*sin(pi*y)*[0 1; 0 1]
eq  = @. Dxx(u(x,y,θ)) + Dyy(u(x,y,θ)) ~ -A

?

from neuralpde.jl.

seadra avatar seadra commented on August 23, 2024

Thanks for the response!
I just tried it, but it's giving an error:

MethodError: objects of type Array{Operation,2} are not callable
Use square brackets [] for indexing an Array.

Stacktrace:
 [1] _broadcast_getindex_evalf at ./broadcast.jl:648 [inlined]
 [2] _broadcast_getindex at ./broadcast.jl:621 [inlined]
 [3] _getindex at ./broadcast.jl:645 [inlined]
 [4] _broadcast_getindex at ./broadcast.jl:620 [inlined]
 [5] _getindex at ./broadcast.jl:644 [inlined]
 [6] _broadcast_getindex at ./broadcast.jl:620 [inlined]
 [7] _getindex at ./broadcast.jl:644 [inlined]
 [8] _broadcast_getindex at ./broadcast.jl:620 [inlined]
 [9] getindex at ./broadcast.jl:575 [inlined]
 [10] copy at ./broadcast.jl:876 [inlined]
 [11] materialize(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{2},Nothing,typeof(~),Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0},Nothing,typeof(+),Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0},Nothing,Base.var"#62#63"{Differential,Differential},Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0},Nothing,Array{Operation,2},Tuple{Operation,Operation,Operation}}}},Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0},Nothing,Base.var"#62#63"{Differential,Differential},Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0},Nothing,Array{Operation,2},Tuple{Operation,Operation,Operation}}}}}},Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{2},Nothing,typeof(-),Tuple{Array{Operation,2}}}}}) at ./broadcast.jl:837
 [12] top-level scope at In[9]:9

from neuralpde.jl.

ChrisRackauckas avatar ChrisRackauckas commented on August 23, 2024

I don't think support for systems has been tagged yet, but @KirillZubov you might want to test on this one.

from neuralpde.jl.

KirillZubov avatar KirillZubov commented on August 23, 2024

Hi @seadra, the matrix PDEs form isn't supported for PINNs yet. But it will be implemented.

from neuralpde.jl.

ChrisRackauckas avatar ChrisRackauckas commented on August 23, 2024

A matrix is just a system when you vec it, so once systems of PDEs are done this should be done.

from neuralpde.jl.

asdasdqwdqwfsdf avatar asdasdqwdqwfsdf commented on August 23, 2024

@ChrisRackauckas can we test/run the "NeuralPDE.jl" examples in Binder Julia?

from neuralpde.jl.

ChrisRackauckas avatar ChrisRackauckas commented on August 23, 2024

That should be possible.

from neuralpde.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.