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.

NaN when using space grid with x_0 = 0 #268

@hurricane007

Description

@hurricane007

Hello, I am not sure if it's an issue. But when I using a space grid with x0 = 0, the first two elements of UpwindDifference(1,2, Δx, length(x), -usg)bcu0 are NaN, and the first elements of CenteredDifference(1,2,Δx, length(x))bcu0 is NaN. Is it an error? or the spac discretization must start from x0 > 0?

Test code:

using DiffEqOperators
Δx = 0.1
x0 = 0.0
x = x0 :Δx:1.
u0 = exp.(1 .-x) .-1 
Deg = 1E-4 # m^2/s
usg = 0.5
bc = RobinBC([1., -Deg/usg, 1. ], [0. , 1 , 0], x,1.)
UpwindDifference(1,2, Δx, length(x), -usg)*bc*u0
11-element Array{Float64,1}:
 NaN
 NaN
   1.1087695767283758
   1.0032562010037278
   0.9077837505447812
   0.8213967049779365
   0.7432304737154816
   0.6725027428423593
   0.608505645455582
   0.5505986770943327
   0.4982022853560525

and
CenteredDifference(1,2,Δx, length(x))*bc*u0

11-element Array{Float64,1}:
 NaN
  -2.463704499832886
  -2.2292520184323656
  -2.0171106405097943
  -1.8251571838517426
  -1.651470513746193
  -1.494312315620625
  -1.3521096974055025
  -1.2234394475017774
  -1.1070137908008493
  -0.5258545903782386

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