Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Fourier and periodic rational derivative operators for BBMBBMEquations1D and SvaerdKalischEquations1D #154

Merged
merged 6 commits into from
Sep 24, 2024

Conversation

JoshuaLampert
Copy link
Owner

I added support for PeriodicRationalDerivativeOperators as second derivative operator and FourierDerivativeOperators for the BBM-BBM and Svärd-Kalisch equations. I also improved the error thrown for an unknown operator.
Closes #132.

@JoshuaLampert JoshuaLampert added the enhancement New feature or request label Sep 23, 2024
Copy link

codecov bot commented Sep 23, 2024

Codecov Report

Attention: Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.

Project coverage is 97.97%. Comparing base (2f11fb1) to head (950828f).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/equations/bbm_bbm_1d.jl 0.00% 5 Missing ⚠️
src/equations/svaerd_kalisch_1d.jl 0.00% 2 Missing ⚠️
src/equations/bbm_1d.jl 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #154   +/-   ##
=======================================
  Coverage   97.97%   97.97%           
=======================================
  Files          19       19           
  Lines        1776     1776           
=======================================
  Hits         1740     1740           
  Misses         36       36           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@ranocha ranocha left a comment

Choose a reason for hiding this comment

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

Thanks!

Comment on lines +45 to +49
# test PeriodicRationalDerivativeOperator
D1 = periodic_derivative_operator(1, accuracy_order, xmin(mesh), xmax(mesh),
nnodes(mesh))
D2 = D1^2
solver = Solver(D1, D2)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we go as far as this, it could make sense to add downstream tests to SummationByPartsOperators.jl. I am not sure whether I have documented that D1^ will necessarily return a PeriodicRationalDerivativeOperator. It should be pretty stable, but we use some parts that are less clearly described as public API.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Ok, I didn't know that PeriodicRationalDerivativeOperator is not quite public. Adding tests to SummationByPartsOperators.jl sounds good. But this can be merged anyway, right?

Copy link
Owner Author

Choose a reason for hiding this comment

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

The same also holds for FourierPolynomialDerivativeOperator, doesn't it? As far as I can tell, it's also not clearly documented that D1^ will return a FourierPolynomialDerivativeOperator if D1 is a FourierDerivativeOperator.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Well, I have not added any documentation to it, so it is indeed not really public but more like an implementation detail to make ^ etc. work - which is documented

All of these periodic derivative operators support multiplication and addition such that polynomials and rational functions of them can be represented efficiently

already in the README.md (see https://github.com/ranocha/SummationByPartsOperators.jl?tab=readme-ov-file#periodic-domains).

But we can go ahead and merge this PR here. We don't need to add downstream tests right now, but it may be nice to keep this in mind for the future.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The simpler option would be to add some explicit tests that ^ returns the appropriate types with some comments that DispersiveShallowWater.jl uses this interface.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The same also holds for FourierPolynomialDerivativeOperator, doesn't it? As far as I can tell, it's also not clearly documented that D1^ will return a FourierPolynomialDerivativeOperator if D1 is a FourierDerivativeOperator.

Yes

test/test_svaerd_kalisch_1d.jl Show resolved Hide resolved
@JoshuaLampert JoshuaLampert merged commit a80b640 into main Sep 24, 2024
16 of 17 checks passed
@JoshuaLampert JoshuaLampert deleted the fourier-operator branch September 24, 2024 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow FourierDerivativeOperators for BBM-BBM equations and Svärd-Kalisch equations
2 participants