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

MOLFiniteDifference : Adding support for higher derivative orders in bcs #435

Merged
merged 7 commits into from
Aug 15, 2021

Conversation

mjsheikh
Copy link
Contributor

No description provided.

@mjsheikh
Copy link
Contributor Author

mjsheikh commented Aug 11, 2021

For use cases like #344 , #385 etc. support for N-ordered derivatives has been provided.
Since there were many flagged issues in the KS eqn, I have left that as @test_broken, though now atleast it doesn't error due to mishandling N-ordered derivatives in BCs and produces output.

Copy link
Contributor

@valentinsulzer valentinsulzer left a comment

Choose a reason for hiding this comment

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

Comment on lines 213 to +214
# TODO: Fix Neumann and Robin on higher dimension
lhs = nspace == 1 ? substitute(bc.lhs,depvarderivbcmaps[i]) : bc.lhs
# Update: Fixed for 1D systems
Copy link
Contributor

@valentinsulzer valentinsulzer Aug 11, 2021

Choose a reason for hiding this comment

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

can remove these two comments imo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you add a test with Neumann BCs to this? https://github.com/SciML/DiffEqOperators.jl/blob/master/test/MOL/MOL_2D_Diffusion.jl

Yeah, so the support is for higher ordered Neumann in 1D systems.
Perhaps a test should be added in :
https://github.com/SciML/DiffEqOperators.jl/blob/master/test/MOL/MOL_1D_HigherOrder.jl ?

Copy link
Contributor Author

@mjsheikh mjsheikh Aug 12, 2021

Choose a reason for hiding this comment

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

can remove these two comments imo

I think that is still a TODO

@mjsheikh
Copy link
Contributor Author

@tinosulzer tests added.

Copy link
Contributor

@valentinsulzer valentinsulzer left a comment

Choose a reason for hiding this comment

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

Sorry I misunderstood what you were doing. Yes, the tests should be in https://github.com/SciML/DiffEqOperators.jl/blob/master/test/MOL/MOL_1D_HigherOrder.jl (ideally just fix the tests that are test_broken )

Comment on lines 66 to 68
bcs = [u(0,x) ~ cos(x),
Dxx(u(t,0)) ~ -exp(-t),
Dxx(u(t,Float64(π))) ~ exp(-t)]
Copy link
Contributor

Choose a reason for hiding this comment

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

You can't specify a 2nd order BC on a 2nd order system. See #382 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this was just to show that desired operation gets carried out safely and in correct manner.
But yeah, I think a higher ordered eqn would be good.

bcs = [u(0,x) ~ cos(x),
v(0,x) ~ sin(x),
u(t,0) ~ exp(-t),
Dxxx(u(t,1)) ~ exp(-t) * sin(1),
Copy link
Contributor

Choose a reason for hiding this comment

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

BC order should be <= 1

@mjsheikh
Copy link
Contributor Author

Sorry I misunderstood what you were doing. Yes, the tests should be in https://github.com/SciML/DiffEqOperators.jl/blob/master/test/MOL/MOL_1D_HigherOrder.jl (ideally just fix the tests that are test_broken )

Ideally I should have fixed those broken tests but I think some other pieces are missing in handling beam eqns (like those mentioned in #382 (comment) etc.) 😅

@mjsheikh
Copy link
Contributor Author

I think the KdV wave eqn should be a good test case. The no. of BCs have been set more than required though, to produce an accurate solution.

@mjsheikh
Copy link
Contributor Author

@tinosulzer this looks good?

Copy link
Contributor

@valentinsulzer valentinsulzer left a comment

Choose a reason for hiding this comment

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

Looks good, can the other (broken) KS test now be removed? And why do the beam equation tests still not work after this fix?

u_real = [[u_analytic(x, t) for x in xs] for t in ts]
u_diff = u_real - u_predict
for i in 1:length(u_diff)
@test u_diff[i] ≈ zeros(length(u_diff[i])) atol=0.05;
Copy link
Contributor

Choose a reason for hiding this comment

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

see #384

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks good, can the other (broken) KS test now be removed? And why do the beam equation tests still not work after this fix?

Yes, we can actually remove the KS test. I tested that, it would just require more BCs to pass but that seems unnecessary since we already have the KdV test.
As for the beam eqn, thats related to #382 (comment) point 2.

@valentinsulzer valentinsulzer merged commit 0ea6b7a into SciML:master Aug 15, 2021
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