-
Notifications
You must be signed in to change notification settings - Fork 33
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
Neumann BCs in problem helper #364
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #364 +/- ##
==========================================
- Coverage 73.26% 72.62% -0.65%
==========================================
Files 270 269 -1
Lines 23097 22364 -733
==========================================
- Hits 16922 16241 -681
+ Misses 6175 6123 -52
☔ View full report in Codecov by Sentry. |
pySDC/helpers/problem_helper.py
Outdated
@@ -112,7 +127,7 @@ def get_finite_difference_matrix( | |||
if steps[i] < 0: | |||
A_1d += coeff[i] * sp.eye(size, k=size + steps[i]) | |||
else: | |||
raise NotImplementedError(f'Boundary conditions {bc} not implemented.') | |||
raise NotImplementedError(f'Boundary conditions \"{bc}\" not implemented.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have to put the escape characters here, since you use '
to define the string. This is enough :
raise NotImplementedError(f'Boundary conditions "{bc}" not implemented.')
The implementation is not totally generic as of now. For high order you need to use lopsided stencils near the boundary because they must not stretch beyond the boundary. This is not particularly difficult, but requires some patience which I don't have this morning. For now, I think second order is fine and if anyone needs higher order, some basic structure is already available. What I find neat is that GMRES no longer requires a preconditioner to converge in the quench problem. Using the inverted Laplacian still seems to increase performance slightly. But I suspect the solution was insufficiently smooth before because the FD discretisation was wrong. I don't know if this would keep GMRES from converging. But that convergence works better is a good sign anyways. Additionally, I set higher threshold values for the transition to runaway heating to keep the timescales the same. This indicates less dissipation across the boundary, which also means the insulation works better. I am now at least 83% confident that this implementation is correct and suggest, if you feel confident as well, that we merge this now and worry about higher order discretisation some other time. Maybe in Darmstadt already. |
I don't know why this test has failed, I believe something is wrong with the modules. On my fork I reran the tests on the master branch with the same result as here: The macOS environment is fine but on linux, the fenics tests fail. |
I have no clue. A |
Hm.. this |
I noticed that the generation of the preconditioner was dominating the runtime, but speeding up the GMRES solves significantly. I read that inverting sparse matrices can be more efficient when they are converted to dense first and inverted using dense matrix methods if the result is expected to be dense. Indeed, I measured a 10x speedup for some configurations just by doing this. Since the branch I want to merge is called "quench_fix", I thought I squeeze it into this PR. |
Please merge from |
This is actually really helpful for me. I am playing around with higher order discretizations for the quench problem and finally have some confidence in the results. Hooray for testing. Thanks a lot @tlunet! I had a really good time implementing this with you! |
Ready to be merged, then? |
I think so |
I believe I had an error in the BCs for quench, so I tried to do it better. But I am very self conscious about this, so I would appreciate if somebody checked that this is actually correct.
So what I am doing to get Neumann BCs now?
Does this make sense? I also don't know about the Dirichlet BCs, but I am not using them now...
If somebody has a good reference, I could maybe double check myself.
There are a couple of other minor things in this PR, such as inexactness in the linear solver for the quench problem, but don't worry about this now. This is just an artefact of merging part of a development branch and makes little difference at this point.