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.

Allow order choice in central difference handling of MOLFiniteDifference #352

@ChrisRackauckas

Description

@ChrisRackauckas

After #349 it's hardcoded. One needs to generalize the lines:

        central_neighbor_idxs(i,j) = [i+CartesianIndex([ifelse(l==j,-1,0) for l in 1:length(nottime)]...),i,i+CartesianIndex([ifelse(l==j,1,0) for l in 1:length(nottime)]...)]
        central_weights(i,j) = DiffEqOperators.calculate_weights(2, 0.0, [space[j][i[j]-1],space[j][i[j]],space[j][i[j]+1]])
        central_deriv_rules = [(Differential(nottime[j])^2)(pdesys.depvars[k]) => dot(central_weights(i,j),depvars[k][central_neighbor_idxs(i,j)]) for j in 1:length(nottime), k in 1:length(pdesys.depvars)]

Note from the Fornberg that the order is determined by the number of stencil points:

https://github.com/SciML/DiffEqOperators.jl/blob/v4.22.0/src/derivative_operators/fornberg.jl#L2-L16

In the CenteredDifference operator you can see how it's done:

https://github.com/SciML/DiffEqOperators.jl/blob/v4.22.0/src/derivative_operators/derivative_operator.jl#L128

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions