-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a77ab48
Add BC_Periodic to HeatSolver.
TobiKattmann 2645197
Add necessary additional communication to make HeatSolver periodicBC …
TobiKattmann f24b126
Merge remote-tracking branch 'origin/develop' into feature_heat_bcper…
TobiKattmann a0d296c
Fix warning on gnu-5.3.0. Change one auto to unsigned short.
TobiKattmann f0d4fb9
Add new solid heat conduction Testcase with periodic BC's.
TobiKattmann e0e7e35
Revert "Fix warning on gnu-5.3.0. Change one auto to unsigned short."
TobiKattmann 3d52392
Little typo.
TobiKattmann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -159,6 +159,19 @@ CHeatSolver::CHeatSolver(CGeometry *geometry, CConfig *config, unsigned short iM | |
|
|
||
| SetBaseClassPointerToNodes(); | ||
|
|
||
| /*--- 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); | ||
|
|
||
|
|
||
| /*--- MPI solution ---*/ | ||
|
|
||
| InitiateComms(geometry, config, SOLUTION); | ||
|
|
@@ -893,6 +906,20 @@ void CHeatSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solv | |
| } | ||
| } | ||
|
|
||
| void CHeatSolver::BC_Periodic(CGeometry* geometry, CSolver** solver_container, CNumerics* numerics, | ||
| CConfig* config) { | ||
| /*--- Complete residuals for periodic boundary conditions. We loop over | ||
| the periodic BCs in matching pairs so that, in the event that there are | ||
| adjacent periodic markers, the repeated points will have their residuals | ||
| accumulated corectly during the communications. For implicit calculations | ||
| the Jacobians and linear system are also correctly adjusted here. ---*/ | ||
|
|
||
| for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic() / 2; iPeriodic++) { | ||
| InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_RESIDUAL); | ||
| CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_RESIDUAL); | ||
| } | ||
| } | ||
|
|
||
| void CHeatSolver::Heat_Fluxes(CGeometry *geometry, CSolver **solver_container, CConfig *config) { | ||
|
|
||
| unsigned long iPointNormal; | ||
|
|
@@ -1274,11 +1301,12 @@ void CHeatSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_ | |
|
|
||
| /*--- Modify matrix diagonal to assure diagonal dominance ---*/ | ||
|
|
||
| if (nodes->GetDelta_Time(iPoint) != 0.0) { | ||
|
|
||
| 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); | ||
|
Comment on lines
+1304
to
+1309
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
| } else { | ||
| Jacobian.SetVal2Diag(iPoint, 1.0); | ||
|
|
@@ -1326,6 +1354,12 @@ void CHeatSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_ | |
| } | ||
| } | ||
|
|
||
| /*--- Synchronize the solution between master and passive periodic nodes after the linear solve. ---*/ | ||
| for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic() / 2; iPeriodic++) { | ||
| InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_IMPLICIT); | ||
| CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_IMPLICIT); | ||
| } | ||
|
|
||
| /*--- MPI solution ---*/ | ||
|
|
||
| InitiateComms(geometry, config, SOLUTION); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Periodic Pins | ||
|
|
||
| This a solid heat conduction testcase in which the `HEAT_EQUATION` solver runs standalone (i.e. not as CHT). | ||
| The simulation domain is the solid domain of the `incomp_navierstokes/streamwise_periodic/chtPinArray_2d`-Testcase. | ||
| Therefore the provided gmsh `.geo` file contains the full CHT mesh but only writes out the solid zone when called. | ||
|
|
||
| Note that using periodic boundary conditions for the solid zone made the solution take ~10x more iterations to converge , compared to the same setup using adiabatic walls. | ||
| This was found for solid only as well as CHT cases. | ||
|
|
||
| Expected results are perfectly matched Temperatures at the periodic interface. Compare e.g. using Paraview's `Transform`-Filter with domain length 0.0111544m. |
82 changes: 82 additions & 0 deletions
82
TestCases/solid_heat_conduction/periodic_pins/configSolid.cfg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
| % % | ||
| % SU2 configuration file % | ||
| % Case description: Solid-only Heated Pins, periodically connected % | ||
| % Author: T. Kattmann % | ||
| % Institution: Bosch Thermotechniek B.V. % | ||
| % Date: 2021.09.27 % | ||
| % File Version 7.2.0 "Blackbird" % | ||
| % % | ||
| %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
| % | ||
| % ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% | ||
| % | ||
| SOLVER= HEAT_EQUATION | ||
| % | ||
| OBJECTIVE_FUNCTION= AVG_TEMPERATURE | ||
| OBJECTIVE_WEIGHT= 1.0 | ||
| % | ||
| OPT_OBJECTIVE= AVG_TOTALTEMP | ||
| % | ||
| % ---------------- (SOLIDS) CONDUCTION CONDITION DEFINITION -------------------% | ||
| % | ||
| INC_NONDIM= DIMENSIONAL | ||
| FREESTREAM_TEMPERATURE= 345.0 | ||
| MATERIAL_DENSITY= 2719 | ||
| SPECIFIC_HEAT_CP = 871.0 | ||
| THERMAL_CONDUCTIVITY_CONSTANT= 200 | ||
| % | ||
| % -------------------- BOUNDARY CONDITION DEFINITION --------------------------% | ||
| % | ||
| MARKER_HEATFLUX= (solid_pin1_inner, 5e5, \ | ||
| solid_pin2_inner, 5e5, \ | ||
| solid_pin3_inner, 0.0, \ | ||
| solid_pin1_walls, 0.0, \ | ||
| solid_pin2_walls, 0.0, \ | ||
| solid_pin3_walls, 0.0) | ||
| % | ||
| MARKER_PERIODIC= ( solid_pin1_periodic, solid_pin3_periodic, 0.0,0.0,0.0, 0.0,0.0,0.0, 0.0111544,0.0,0.0 ) | ||
| % | ||
| MARKER_ISOTHERMAL= ( solid_pin1_interface, 300, solid_pin2_interface, 300, solid_pin3_interface, 300 ) | ||
| % | ||
| % ------------------------ SURFACES IDENTIFICATION ----------------------------% | ||
| % | ||
| MARKER_MONITORING = ( solid_pin1_inner, solid_pin3_inner ) | ||
| % | ||
| % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% | ||
| % | ||
| %NUM_METHOD_GRAD= GREEN_GAUSS | ||
| NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES | ||
| CFL_NUMBER= 1e8 | ||
| % | ||
| % ------------------------ LINEAR SOLVER DEFINITION ---------------------------% | ||
| % | ||
| LINEAR_SOLVER= FGMRES | ||
| LINEAR_SOLVER_PREC= ILU | ||
| LINEAR_SOLVER_ERROR= 1E-15 | ||
| LINEAR_SOLVER_ITER= 5 | ||
| % | ||
| % --------------------------- CONVERGENCE PARAMETERS --------------------------% | ||
| % | ||
| ITER= 1000 | ||
| % | ||
| CONV_FIELD= RMS_TEMPERATURE | ||
| CONV_RESIDUAL_MINVAL= -16 | ||
| CONV_STARTITER= 10 | ||
| % | ||
| % -------------------- HEAT NUMERICAL METHOD DEFINITION -----------------------% | ||
| % | ||
| TIME_DISCRE_HEAT= EULER_IMPLICIT | ||
| % | ||
| % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% | ||
| % | ||
| MESH_FILENAME= solid.su2 | ||
| % | ||
| SCREEN_OUTPUT= INNER_ITER, RMS_TEMPERATURE, MAX_TEMPERATURE, AVG_TEMPERATURE, TOTAL_HEATFLUX, MAXIMUM_HEATFLUX, LINSOL_ITER, LINSOL_RESIDUAL | ||
| SCREEN_WRT_FREQ_INNER= 50 | ||
| % | ||
| HISTORY_OUTPUT= (ITER, RMS_RES, HEAT, LINSOL) | ||
| % | ||
| OUTPUT_FILES= RESTART, PARAVIEW_MULTIBLOCK | ||
| VOLUME_OUTPUT= RESIDUAL | ||
| OUTPUT_WRT_FREQ= 1000 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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