-
Notifications
You must be signed in to change notification settings - Fork 918
Add periodic boundary conditions to the heat-equation solver #1382
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
Conversation
|
Have a look at my last comment in #763, I think there is a better way of handling linear system periodicity instead of what we do, which may allow you to run at higher CFL (and with simpler periodic comms). But at the moment you are missing the PERIODIC_IMPLICIT comms after solving the linear system, see CompleteImplicitIteration_impl in CFVMFlowSolverBase.hpp. |
|
Thanks @pcarruscag , I had to do a few additional things together with the PERIODIC_IMPLICIT communication to make it work, but that also brought me on the right track 👍 Now it works really nicely from my point of view.
I need to have a second look at this. So non of your thoughts back then are yet incorporated in this PR |
| const su2double dt = nodes->GetDelta_Time(iPoint); | ||
| if (dt != 0.0) { | ||
| /*--- For nodes on periodic boundaries, add the respective partner volume. ---*/ | ||
| // Identical for flow and heat | ||
| const su2double Delta = geometry->nodes->GetVolume(iPoint) / nodes->GetDelta_Time(iPoint); | ||
| Jacobian.AddVal2Diag(iPoint, Delta); | ||
| const su2double Vol = geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint); | ||
| Jacobian.AddVal2Diag(iPoint, Vol / dt); |
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.
I made this bit consistent with the Scalar Solver.. which will faciliate a possible port later a bit
| /*--- Communicate and store volume and the number of neighbors for any dual CVs that lie on on periodic markers. ---*/ | ||
| for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic() / 2; iPeriodic++) { | ||
| InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_VOLUME); | ||
| CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_VOLUME); | ||
| InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_NEIGHBORS); | ||
| CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_NEIGHBORS); | ||
| } | ||
| /*--- Store if implicit scheme is used. This has implications on the Residual and Jacobian handling for periodic | ||
| * boundaries ---*/ | ||
| const bool euler_implicit = (config->GetKind_TimeIntScheme_Heat() == EULER_IMPLICIT); | ||
| SetImplicitPeriodic(euler_implicit); |
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.
The ScalarSolver is currently not doing that. I think there it is enough as the flow solver already does that. But if a ScalarSolver-child is standalone then it prob has to be incorporated. But this is more of a guess than safe info
|
@NAnand-TUD We talked about this briefly in a recent dev-meeting, so that you know :) |
|
I'll adapt one of the existing Testcases to use this feature |
pcarruscag
left a comment
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.
LGTM
|
With what CFL can you run now? |
For the solid only case I had the feeling that I could go arbitrarily high. 1e8 and 1e12 had no difference. For the cht case I kept the cfl of 1e4 from the non-periodic case. There I will try a bit more to see what's possible. |
|
@TobiKattmann Thanks for sharing! I will be testing this part of the code with our test case soon. |
Note that the warning is unjustified and probably a bug in this gcc version. See here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59124
Well that was a lie. I thought it would be a good idea to adapt the 2D cht streamwise periodic case but I forgot that the used mesh is used for a streamwise periodic primal, FD and DA case as well as HeatTransfer BC Testcase (and that is a bit of work tbh). And for the periodic BC I had to change the mesh (adding new markers). As we do not have a single standalone (always run in a CHT setup) heat-equation Testcase, I went ahead and cut out the solid zone only and made that a Testcase. I already merged the gmsh geo and .su2 over at su2code/TestCases/pull/76 . If this is not liked I can of course do sth different. Note that the new Testcase takes ~2s to complete its 750 iterations until convergence. |
|
I found solid only and CHT cases to take ~10x the iterations to reach the same convergence levels if periodic boundary conditions are used in the solid (left: using periodic BC, right: not using periodic BC). This is not really ideal tbh, Maybe I have not found a suitable setup yet (I modifed some things, Linear Solver iter, CFL, Gradient Method) or there is a reasonable explanation for this in how the bc is handeled (Therefore I would have to take a look into #763 I guess ;) ) |
This reverts commit a0d296c.
WallyMaier
left a comment
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.
LGTM







Dear friends of the Heat Solver and Periodic Boundary conditions,
I feared no exhausting work and added periodic BC to the Heat Solver.
Stock up your supplies, cancel meetings for today and dive into the diff to review this piece.
Ok for real, I don't know if that is all that has to be done? I did some early testing with mixed results, I noticed that I had to turn down CFL for the solid zone (1e4 in non-periodic case-> 1) to get a solution that seems to respect the periodicity. If the CFL is too large then I get some spurious temperature and weird residual pattern. Any comments are appreciated. This was just a first shot so Im gonna do more digging on that issue
Related Work
Periodic bc was initially implemented in #652
PR Checklist
Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.