-
Notifications
You must be signed in to change notification settings - Fork 918
Explicit Euler in CScalarSolver #1435
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
24 commits
Select commit
Hold shift + click to select a range
d7f73f7
Add CScalarSolver<>::ExplicitEuler_Iteration,
maxaehle 61392cc
remove unused variable
maxaehle 976222d
Apply suggestions from code review
maxaehle dd69a15
Merge PrepareExplicitIteration into ExplicitEuler_Iteration
maxaehle aab916f
Move residual norm calculation helper to CSolver
maxaehle b9eb7bb
Fix error introduced in aab916ff
maxaehle 35193ce
Error if selected TIME_DISCRE_FLOW not impl/expl Euler
maxaehle 022b7c0
Add rans/naca0012 testcases for explicit Euler
maxaehle c5039ef
CFL=0.1 instead of 0.5 in explicit Euler testcase
maxaehle fcccf16
Set "test_vals (stored)" to current "sim_vals (computed)"
maxaehle 27ba505
make ResidualReductions_PerThread static
maxaehle aa04688
update config_template.cfg
maxaehle 96090bc
Minor spacing fixes
pcarruscag d20b2c5
Move ResidualReductions_* to protected part
maxaehle 296e757
Make residual modifications in CSolver protected, too
maxaehle 46542d9
remove descriptions of options in turb_NACA0012_sst_expliciteuler.cfg
maxaehle b6c7620
remove/correct options in turb_NACA0012_sst_expliciteuler.cfg
maxaehle 30af929
remove descriptions of options in turb_NACA0012_sst_fixedvalues.cfg
maxaehle 5360ece
Apply suggestions from code review
maxaehle bb09595
clang-format
maxaehle 217db02
don't mark functions as both virtual and override
maxaehle 5a184a7
Merge branch 'develop' into feature_expliciteuler_scalarsolver
pcarruscag f7cfaeb
do not assume implicit for turbulence
pcarruscag 27a7687
Merge remote-tracking branch 'origin/develop' into feature_expliciteu…
maxaehle 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
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 |
|---|---|---|
|
|
@@ -79,7 +79,8 @@ CScalarSolver<VariableType>::~CScalarSolver() { | |
|
|
||
| template <class VariableType> | ||
| void CScalarSolver<VariableType>::Upwind_Residual(CGeometry* geometry, CSolver** solver_container, | ||
| CNumerics** numerics_container, CConfig* config, unsigned short iMesh) { | ||
| CNumerics** numerics_container, CConfig* config, | ||
| unsigned short iMesh) { | ||
| const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); | ||
| const bool muscl = config->GetMUSCL_Turb(); | ||
| const bool limiter = (config->GetKind_SlopeLimit_Turb() != NO_LIMITER); | ||
|
|
@@ -256,7 +257,7 @@ void CScalarSolver<VariableType>::SumEdgeFluxes(CGeometry* geometry) { | |
|
|
||
| template <class VariableType> | ||
| void CScalarSolver<VariableType>::BC_Periodic(CGeometry* geometry, CSolver** solver_container, CNumerics* numerics, | ||
| CConfig* config) { | ||
| 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 | ||
|
|
@@ -271,7 +272,7 @@ void CScalarSolver<VariableType>::BC_Periodic(CGeometry* geometry, CSolver** sol | |
|
|
||
| template <class VariableType> | ||
| void CScalarSolver<VariableType>::PrepareImplicitIteration(CGeometry* geometry, CSolver** solver_container, | ||
| CConfig* config) { | ||
| CConfig* config) { | ||
| const auto flowNodes = solver_container[FLOW_SOL]->GetNodes(); | ||
|
|
||
| /*--- Set shared residual variables to 0 and declare | ||
|
|
@@ -280,7 +281,6 @@ void CScalarSolver<VariableType>::PrepareImplicitIteration(CGeometry* geometry, | |
| SetResToZero(); | ||
|
|
||
| su2double resMax[MAXNVAR] = {0.0}, resRMS[MAXNVAR] = {0.0}; | ||
| const su2double* coordMax[MAXNVAR] = {nullptr}; | ||
| unsigned long idxMax[MAXNVAR] = {0}; | ||
|
|
||
| /*--- Build implicit system ---*/ | ||
|
|
@@ -308,31 +308,19 @@ void CScalarSolver<VariableType>::PrepareImplicitIteration(CGeometry* geometry, | |
| LinSysRes[total_index] = -LinSysRes[total_index]; | ||
| LinSysSol[total_index] = 0.0; | ||
|
|
||
| su2double Res = fabs(LinSysRes[total_index]); | ||
| resRMS[iVar] += Res * Res; | ||
| if (Res > resMax[iVar]) { | ||
| resMax[iVar] = Res; | ||
| idxMax[iVar] = iPoint; | ||
| coordMax[iVar] = geometry->nodes->GetCoord(iPoint); | ||
| } | ||
| /*--- "Add" residual at (iPoint,iVar) to local residual variables. ---*/ | ||
| ResidualReductions_PerThread(iPoint, iVar, LinSysRes[total_index], resRMS, resMax, idxMax); | ||
| } | ||
| } | ||
| END_SU2_OMP_FOR | ||
| SU2_OMP_CRITICAL | ||
| for (unsigned short iVar = 0; iVar < nVar; iVar++) { | ||
| Residual_RMS[iVar] += resRMS[iVar]; | ||
| AddRes_Max(iVar, resMax[iVar], geometry->nodes->GetGlobalIndex(idxMax[iVar]), coordMax[iVar]); | ||
| } | ||
| END_SU2_OMP_CRITICAL | ||
| SU2_OMP_BARRIER | ||
|
|
||
| /*--- Compute the root mean square residual ---*/ | ||
| SetResidual_RMS(geometry, config); | ||
| /*--- "Add" residuals from all threads to global residual variables. ---*/ | ||
| ResidualReductions_FromAllThreads(geometry, config, resRMS, resMax, idxMax); | ||
| } | ||
|
|
||
| template <class VariableType> | ||
| void CScalarSolver<VariableType>::CompleteImplicitIteration(CGeometry* geometry, CSolver** solver_container, | ||
| CConfig* config) { | ||
| CConfig* config) { | ||
| const bool compressible = (config->GetKind_Regime() == ENUM_REGIME::COMPRESSIBLE); | ||
|
|
||
| const auto flowNodes = solver_container[FLOW_SOL]->GetNodes(); | ||
|
|
@@ -380,7 +368,7 @@ void CScalarSolver<VariableType>::CompleteImplicitIteration(CGeometry* geometry, | |
|
|
||
| template <class VariableType> | ||
| void CScalarSolver<VariableType>::ImplicitEuler_Iteration(CGeometry* geometry, CSolver** solver_container, | ||
| CConfig* config) { | ||
| CConfig* config) { | ||
| PrepareImplicitIteration(geometry, solver_container, config); | ||
|
|
||
| /*--- Solve or smooth the linear system. ---*/ | ||
|
|
@@ -404,10 +392,41 @@ void CScalarSolver<VariableType>::ImplicitEuler_Iteration(CGeometry* geometry, C | |
| CompleteImplicitIteration(geometry, solver_container, config); | ||
| } | ||
|
|
||
| template <class VariableType> | ||
| void CScalarSolver<VariableType>::ExplicitEuler_Iteration(CGeometry* geometry, CSolver** solver_container, | ||
| CConfig* config) { | ||
| const auto flowNodes = solver_container[FLOW_SOL]->GetNodes(); | ||
|
|
||
| /*--- Local residual variables for current thread ---*/ | ||
| su2double resMax[MAXNVAR] = {0.0}, resRMS[MAXNVAR] = {0.0}; | ||
| unsigned long idxMax[MAXNVAR] = {0}; | ||
|
|
||
| SU2_OMP_FOR_STAT(omp_chunk_size) | ||
| for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) { | ||
| const su2double dt = nodes->GetLocalCFL(iPoint) / flowNodes->GetLocalCFL(iPoint) * flowNodes->GetDelta_Time(iPoint); | ||
| nodes->SetDelta_Time(iPoint, dt); | ||
| const su2double Vol = geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint); | ||
|
|
||
| for (auto iVar = 0u; iVar < nVar; iVar++) { | ||
| /*--- "Add" residual at (iPoint,iVar) to local residual variables. ---*/ | ||
| ResidualReductions_PerThread(iPoint, iVar, LinSysRes(iPoint, iVar), resRMS, resMax, idxMax); | ||
| /*--- Explicit Euler step: ---*/ | ||
| LinSysSol(iPoint, iVar) = -dt / Vol * LinSysRes(iPoint, iVar); | ||
| } | ||
| } | ||
| END_SU2_OMP_FOR | ||
|
|
||
| /*--- "Add" residuals from all threads to global residual variables. ---*/ | ||
| ResidualReductions_FromAllThreads(geometry, config, resRMS, resMax, idxMax); | ||
|
|
||
| /*--- Use LinSysSol for solution update. ---*/ | ||
| CompleteImplicitIteration(geometry, solver_container, config); | ||
|
Member
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. This makes a lot of sense given the logic needed to handle SA v SST idiosyncrasies 👍 |
||
| } | ||
|
|
||
| template <class VariableType> | ||
| void CScalarSolver<VariableType>::SetResidual_DualTime(CGeometry* geometry, CSolver** solver_container, CConfig* config, | ||
| unsigned short iRKStep, unsigned short iMesh, | ||
| unsigned short RunTime_EqSystem) { | ||
| unsigned short iRKStep, unsigned short iMesh, | ||
| unsigned short RunTime_EqSystem) { | ||
| const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); | ||
| const bool first_order = (config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_1ST); | ||
| const bool second_order = (config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_2ND); | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.