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

Adding NonLinearDiffusion operator to derivate_operator.jl returning discretized function #327

Merged
merged 6 commits into from
Feb 7, 2021

Conversation

mjsheikh
Copy link
Contributor

This addition tries addressing #276.

It will return the required discretization as output given k (the diffusion coefficent) and u (the desired function) along with inner and outer differential orders.

@ChrisRackauckas
Copy link
Member

The test issue should be fixed SciML/SciMLBase.jl#15.

This needs tests.

bc = DirichletBC(exp(-t),(1.0 + exp(2*t))^(-0.5))
l = bc*u
k = l.^(-2) # Diffusion Coefficient
NonLinearDiffusion(n,m,approx_ord,k,l,h,nknots)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it be represented as an operator?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

end

discretization += (CenteredDifference(first_differential_order + second_differential_order,approx_order,dx,nknots)*q).*p[2:(nknots + 1)];
return discretization
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There only seems to be an out of place operation? It would be good to have a mul! definition and then an allocating version that uses the non-allocating one. Refer to https://www.youtube.com/watch?v=M2i7sSRcSIw or https://mitmath.github.io/18337/lecture2/optimizing on non-allocating operators.

@ChrisRackauckas
Copy link
Member

https://diffeq.sciml.ai/stable/features/diffeq_operator/ defines our operator format which is an extension of the simple examples posted above. I think this is all mathematically correct but needs a little bit of work to match the standard operator API.

@@ -26,6 +26,29 @@ struct DerivativeOperator{T<:Real,N,Wind,T2,S1,S2<:SArray,T3,F} <: AbstractDeriv
coeff_func :: F
end

struct NonLinearDiffusion! end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's a function then it shouldn't be capitalized like a struct, or need the struct at all.

@ChrisRackauckas
Copy link
Member

Just the caps issue and the lack of an out of place dispatch to fix.

@ChrisRackauckas ChrisRackauckas merged commit 2770e03 into SciML:master Feb 7, 2021
@ChrisRackauckas
Copy link
Member

Great thanks!

@ChrisRackauckas
Copy link
Member

Could you follow up with adding this to the documentation?

@mjsheikh mjsheikh deleted the non-lin branch February 8, 2021 12:51
@mjsheikh
Copy link
Contributor Author

mjsheikh commented Feb 9, 2021

Could you follow up with adding this to the documentation?

Modifications should be done in derivate_operators.md or a new file needs to be created?

@ChrisRackauckas
Copy link
Member

I think a nonlinear derivative operators page would be good

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants