Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Getting an error when running discretize on a PDESystem with MOLFiniteDifference #421

Description

@killah-t-cell

Hi everyone,

I am getting an ArgumentError: reducing over an empty collection is not allowed when running discretize on a PDESystem with MOLFiniteDifference. Though I spent some time combing through the code before asking, I am not sure what I am doing wrong at this point.

Here is the code for reference. I am a beginner, so there might be some silly mistake. But the model works when I discretize it with PhysicsInformedNN

@parameters x, y, z, t
@variables A1(..), A2(..), A3(..), V(..)
Dxx = Differential(x)^2
Dyy = Differential(y)^2
Dzz = Differential(z)^2
Dtt = Differential(t)^2
Dx = Differential(x)
Dy = Differential(y)
Dz = Differential(z)
Dt = Differential(t)

# Physics
μ_0 = 1.25663706212e-6
ε_0 = 8.8541878128e-12

# Helpers
divergenceA = Dx(A1(x, y, z, t)) + Dy(A2(x, y, z, t)) + Dz(A3(x, y, z, t))
laplacianV  = Dxx(V(x, y, z, t)) + Dyy(V(x, y, z, t)) + Dzz(V(x, y, z, t))
laplacianA1 = Dxx(A1(x, y, z, t)) + Dyy(A1(x, y, z, t)) + Dzz(A1(x, y, z, t))
laplacianA2 = Dxx(A2(x, y, z, t)) + Dyy(A2(x, y, z, t)) + Dzz(A2(x, y, z, t))
laplacianA3 = Dxx(A3(x, y, z, t)) + Dyy(A3(x, y, z, t)) + Dzz(A3(x, y, z, t))

S = [ρ/ε_0, μ_0*jx, μ_0*jy, μ_0*jz]
f = [V(x, y, z, t), A1(x, y, z, t), A2(x, y, z, t), A3(x, y, z, t)]
laplacians = [laplacianV, laplacianA1, laplacianA2, laplacianA3]

# Problem setup
eqs = Dtt.(f) .~ (S + laplacians)/(μ_0*ε_0)
# Boundary Conditions
bcs = [Dt(V(x, y, z, t)) ~ divergenceA / (μ_0 * ε_0), # set this as a condition
       A1(0,x, y, z) ~ sin(4*pi*z),
       A2(0,x, y, z) ~ cos(pi*x),
       A3(0,x, y, z) ~ sin(pi*x),
       V(0, x, y, z) ~ 1.0,
       A1(t,0, y, z) ~ exp(-t),
       A2(t,0, y, z) ~ exp(-t),
       A3(t,0, y, z) ~ exp(-t),
       V(t, 0, y, z) ~ exp(-t),
       A1(t,1.0, y, z) ~ exp(-t) * cos(1),
       A2(t,1.0, y, z) ~ exp(-t) * cos(1),
       A3(t,1.0, y, z) ~ exp(-t) * cos(1),
       V(t, 1.0, y, z) ~ exp(-t) * cos(1),
       A1(t,x, 0, z) ~ exp(-t),
       A2(t,x, 0, z) ~ exp(-t),
       A3(t,x, 0, z) ~ exp(-t),
       V(t, x, 0, z) ~ exp(-t),
       A1(t,x, 1.0, z) ~ exp(-t) * cos(1),
       A2(t,x, 1.0, z) ~ exp(-t) * cos(1),
       A3(t,x, 1.0, z) ~ exp(-t) * cos(1),
       V(t, x, 1.0, z) ~ exp(-t) * cos(1),
       A1(t,x, y, 0) ~ exp(-t),
       A2(t,x, y, 0) ~ exp(-t),
       A3(t,x, y, 0) ~ exp(-t),
       V(t, x, y, 0) ~ exp(-t),
       A1(t,x, y, 1.0) ~ exp(-t) * cos(1),
       A2(t,x, y, 1.0) ~ exp(-t) * cos(1),
       A3(t,x, y, 1.0) ~ exp(-t) * cos(1),
       V(t, x, y, 1.0) ~ exp(-t) * cos(1)]
# Space and time domains
domains = [t ∈ Interval(0.0,1.0),
           x ∈ Interval(0.0,1.0),
           y ∈ Interval(0.0,1.0),
           z ∈ Interval(0.0,1.0)]
pde_system = PDESystem(eqs,bcs,domains,[t, x, y, z],[V(x, y, z, t), A1(x, y, z, t), A2(x, y, z, t), A3(x, y, z, t)],[ρ=>0.5, jx=>2, jy=>1.2, jz=>4.8])
# Method of lines discretization
dx, dy, dz = 0.1, 0.1, 0.1
order = 2
discretization = MOLFiniteDifference([x=>dx, y=>dy, z=>dz],t)
prob = discretize(pde_system,discretization)
# Solve ODE problem
sol = solve(prob,Tsit5(),saveat=0.2)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions