-
Notifications
You must be signed in to change notification settings - Fork 983
Fix WALL_TIME for unsteady + some variable index cleanup #1544
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
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
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 |
|---|---|---|
|
|
@@ -1226,11 +1226,11 @@ void CIncEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_cont | |
| checked. Pressure is the dynamic pressure (can be negative). ---*/ | ||
|
|
||
| if (config->GetEnergy_Equation()) { | ||
| bool neg_temperature_i = (Primitive_i[nDim+1] < 0.0); | ||
| bool neg_temperature_j = (Primitive_j[nDim+1] < 0.0); | ||
| bool neg_temperature_i = (Primitive_i[prim_idx.Temperature()] < 0.0); | ||
| bool neg_temperature_j = (Primitive_j[prim_idx.Temperature()] < 0.0); | ||
|
|
||
| bool neg_density_i = (Primitive_i[nDim+2] < 0.0); | ||
| bool neg_density_j = (Primitive_j[nDim+2] < 0.0); | ||
| bool neg_density_i = (Primitive_i[prim_idx.Density()] < 0.0); | ||
| bool neg_density_j = (Primitive_j[prim_idx.Density()] < 0.0); | ||
|
|
||
| nodes->SetNon_Physical(iPoint, neg_density_i || neg_temperature_i); | ||
| nodes->SetNon_Physical(jPoint, neg_density_j || neg_temperature_j); | ||
|
|
@@ -2035,27 +2035,27 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain | |
| /*--- Recompute and store the velocity in the primitive variable vector. ---*/ | ||
|
|
||
| for (iDim = 0; iDim < nDim; iDim++) | ||
| V_infty[iDim+1] = GetVelocity_Inf(iDim); | ||
| V_infty[iDim+prim_idx.Velocity()] = GetVelocity_Inf(iDim); | ||
|
|
||
| /*--- Far-field pressure set to static pressure (0.0). ---*/ | ||
|
|
||
| V_infty[0] = GetPressure_Inf(); | ||
| V_infty[prim_idx.Pressure()] = GetPressure_Inf(); | ||
|
|
||
| /*--- Dirichlet condition for temperature at far-field (if energy is active). ---*/ | ||
|
|
||
| V_infty[nDim+1] = GetTemperature_Inf(); | ||
| V_infty[prim_idx.Temperature()] = GetTemperature_Inf(); | ||
|
|
||
| /*--- Store the density. ---*/ | ||
|
|
||
| V_infty[nDim+2] = GetDensity_Inf(); | ||
| V_infty[prim_idx.Density()] = GetDensity_Inf(); | ||
|
|
||
| /*--- Beta coefficient stored at the node ---*/ | ||
|
|
||
| V_infty[nDim+3] = nodes->GetBetaInc2(iPoint); | ||
| V_infty[prim_idx.Beta()] = nodes->GetBetaInc2(iPoint); | ||
|
|
||
| /*--- Cp is needed for Temperature equation. ---*/ | ||
|
|
||
| V_infty[nDim+7] = nodes->GetSpecificHeatCp(iPoint); | ||
| V_infty[prim_idx.CpTotal()] = nodes->GetSpecificHeatCp(iPoint); | ||
|
|
||
| /*--- Set various quantities in the numerics class ---*/ | ||
|
|
||
|
|
@@ -2084,9 +2084,9 @@ void CIncEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contain | |
|
|
||
| /*--- Set transport properties at infinity. ---*/ | ||
|
|
||
| V_infty[nDim+4] = nodes->GetLaminarViscosity(iPoint); | ||
| V_infty[nDim+5] = nodes->GetEddyViscosity(iPoint); | ||
| V_infty[nDim+6] = nodes->GetThermalConductivity(iPoint); | ||
| V_infty[prim_idx.LaminarViscosity()] = nodes->GetLaminarViscosity(iPoint); | ||
| V_infty[prim_idx.EddyViscosity()] = nodes->GetEddyViscosity(iPoint); | ||
| V_infty[prim_idx.ThermalConductivity()] = nodes->GetThermalConductivity(iPoint); | ||
|
|
||
| /*--- Set the normal vector and the coordinates ---*/ | ||
|
|
||
|
|
@@ -2185,7 +2185,7 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, | |
|
|
||
| /*--- Neumann condition for dynamic pressure ---*/ | ||
|
|
||
| V_inlet[0] = nodes->GetPressure(iPoint); | ||
| V_inlet[prim_idx.Pressure()] = nodes->GetPressure(iPoint); | ||
|
|
||
| /*--- The velocity is either prescribed or computed from total pressure. ---*/ | ||
|
|
||
|
|
@@ -2202,11 +2202,11 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, | |
| /*--- Store the velocity in the primitive variable vector. ---*/ | ||
|
|
||
| for (iDim = 0; iDim < nDim; iDim++) | ||
| V_inlet[iDim+1] = Vel_Mag*UnitFlowDir[iDim]; | ||
| V_inlet[iDim+prim_idx.Velocity()] = Vel_Mag*UnitFlowDir[iDim]; | ||
|
|
||
| /*--- Dirichlet condition for temperature (if energy is active) ---*/ | ||
|
|
||
| V_inlet[nDim+1] = Inlet_Ttotal[val_marker][iVertex]/config->GetTemperature_Ref(); | ||
| V_inlet[prim_idx.Temperature()] = Inlet_Ttotal[val_marker][iVertex]/config->GetTemperature_Ref(); | ||
|
|
||
| break; | ||
|
|
||
|
|
@@ -2224,10 +2224,7 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, | |
|
|
||
| /*--- Check for back flow through the inlet. ---*/ | ||
|
|
||
| Vn = 0.0; | ||
| for (iDim = 0; iDim < nDim; iDim++) { | ||
| Vn += V_domain[iDim+1]*(-1.0*Normal[iDim]/Area); | ||
| } | ||
| Vn = -GeometryToolbox::DotProduct(nDim, &V_domain[prim_idx.Velocity()], Normal) / Area; | ||
|
|
||
| /*--- If the local static pressure is larger than the specified | ||
| total pressure or the velocity is directed upstream, we have a | ||
|
|
@@ -2239,16 +2236,16 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, | |
|
|
||
| /*--- Back flow: use the prescribed P_total as static pressure. ---*/ | ||
|
|
||
| V_inlet[0] = Inlet_Ptotal[val_marker][iVertex]/config->GetPressure_Ref(); | ||
| V_inlet[prim_idx.Pressure()] = Inlet_Ptotal[val_marker][iVertex]/config->GetPressure_Ref(); | ||
|
|
||
| /*--- Neumann condition for velocity. ---*/ | ||
|
|
||
| for (iDim = 0; iDim < nDim; iDim++) | ||
| V_inlet[iDim+1] = V_domain[iDim+1]; | ||
| V_inlet[iDim+prim_idx.Velocity()] = V_domain[iDim+prim_idx.Velocity()]; | ||
|
|
||
| /*--- Neumann condition for the temperature. ---*/ | ||
|
|
||
| V_inlet[nDim+1] = nodes->GetTemperature(iPoint); | ||
| V_inlet[prim_idx.Temperature()] = nodes->GetTemperature(iPoint); | ||
|
|
||
| } else { | ||
|
|
||
|
|
@@ -2267,17 +2264,17 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, | |
| /*--- Compute the delta change in velocity in each direction. ---*/ | ||
|
|
||
| for (iDim = 0; iDim < nDim; iDim++) | ||
| dV[iDim] = Vel_Mag*UnitFlowDir[iDim] - V_domain[iDim+1]; | ||
| dV[iDim] = Vel_Mag*UnitFlowDir[iDim] - V_domain[iDim+prim_idx.Velocity()]; | ||
|
|
||
| /*--- Update the velocity in the primitive variable vector. | ||
| Note we use damping here to improve stability/convergence. ---*/ | ||
|
|
||
| for (iDim = 0; iDim < nDim; iDim++) | ||
| V_inlet[iDim+1] = V_domain[iDim+1] + Damping*dV[iDim]; | ||
| V_inlet[iDim+prim_idx.Velocity()] = V_domain[iDim+prim_idx.Velocity()] + Damping*dV[iDim]; | ||
|
|
||
| /*--- Dirichlet condition for temperature (if energy is active) ---*/ | ||
|
|
||
| V_inlet[nDim+1] = Inlet_Ttotal[val_marker][iVertex]/config->GetTemperature_Ref(); | ||
| V_inlet[prim_idx.Temperature()] = Inlet_Ttotal[val_marker][iVertex]/config->GetTemperature_Ref(); | ||
|
|
||
| } | ||
|
|
||
|
|
@@ -2292,15 +2289,15 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, | |
| construction, or will be set fixed implicitly by the temperature | ||
| and equation of state. ---*/ | ||
|
|
||
| V_inlet[nDim+2] = nodes->GetDensity(iPoint); | ||
| V_inlet[prim_idx.Density()] = nodes->GetDensity(iPoint); | ||
|
|
||
| /*--- Beta coefficient from the config file ---*/ | ||
|
|
||
| V_inlet[nDim+3] = nodes->GetBetaInc2(iPoint); | ||
| V_inlet[prim_idx.Beta()] = nodes->GetBetaInc2(iPoint); | ||
|
|
||
| /*--- Cp is needed for Temperature equation. ---*/ | ||
|
|
||
| V_inlet[nDim+7] = nodes->GetSpecificHeatCp(iPoint); | ||
| V_inlet[prim_idx.CpTotal()] = nodes->GetSpecificHeatCp(iPoint); | ||
|
|
||
| /*--- Set various quantities in the solver class ---*/ | ||
|
|
||
|
|
@@ -2329,9 +2326,9 @@ void CIncEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, | |
|
|
||
| /*--- Set transport properties at the inlet ---*/ | ||
|
|
||
| V_inlet[nDim+4] = nodes->GetLaminarViscosity(iPoint); | ||
| V_inlet[nDim+5] = nodes->GetEddyViscosity(iPoint); | ||
| V_inlet[nDim+6] = nodes->GetThermalConductivity(iPoint); | ||
| V_inlet[prim_idx.LaminarViscosity()] = nodes->GetLaminarViscosity(iPoint); | ||
| V_inlet[prim_idx.EddyViscosity()] = nodes->GetEddyViscosity(iPoint); | ||
| V_inlet[prim_idx.ThermalConductivity()] = nodes->GetThermalConductivity(iPoint); | ||
|
|
||
| /*--- Set the normal vector and the coordinates ---*/ | ||
|
|
||
|
|
@@ -2430,12 +2427,12 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, | |
|
|
||
| /*--- The pressure is prescribed at the outlet. ---*/ | ||
|
|
||
| V_outlet[0] = P_Outlet; | ||
| V_outlet[prim_idx.Pressure()] = P_Outlet; | ||
|
|
||
| /*--- Neumann condition for the velocity. ---*/ | ||
|
|
||
| for (iDim = 0; iDim < nDim; iDim++) { | ||
| V_outlet[iDim+1] = nodes->GetVelocity(iPoint,iDim); | ||
| V_outlet[iDim+prim_idx.Velocity()] = nodes->GetVelocity(iPoint,iDim); | ||
| } | ||
|
|
||
| break; | ||
|
|
@@ -2469,12 +2466,12 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, | |
|
|
||
| /*--- The pressure is prescribed at the outlet. ---*/ | ||
|
|
||
| V_outlet[0] = P_Outlet; | ||
| V_outlet[prim_idx.Pressure()] = P_Outlet; | ||
|
|
||
| /*--- Neumann condition for the velocity ---*/ | ||
|
|
||
| for (iDim = 0; iDim < nDim; iDim++) { | ||
| V_outlet[iDim+1] = nodes->GetVelocity(iPoint,iDim); | ||
| V_outlet[iDim+prim_idx.Velocity()] = nodes->GetVelocity(iPoint,iDim); | ||
| } | ||
|
|
||
| break; | ||
|
|
@@ -2483,21 +2480,21 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, | |
|
|
||
| /*--- Neumann condition for the temperature. ---*/ | ||
|
|
||
| V_outlet[nDim+1] = nodes->GetTemperature(iPoint); | ||
| V_outlet[prim_idx.Temperature()] = nodes->GetTemperature(iPoint); | ||
|
|
||
| /*--- Access density at the interior node. This is either constant by | ||
| construction, or will be set fixed implicitly by the temperature | ||
| and equation of state. ---*/ | ||
|
|
||
| V_outlet[nDim+2] = nodes->GetDensity(iPoint); | ||
| V_outlet[prim_idx.Density()] = nodes->GetDensity(iPoint); | ||
|
|
||
| /*--- Beta coefficient from the config file ---*/ | ||
|
|
||
| V_outlet[nDim+3] = nodes->GetBetaInc2(iPoint); | ||
| V_outlet[prim_idx.Beta()] = nodes->GetBetaInc2(iPoint); | ||
|
|
||
| /*--- Cp is needed for Temperature equation. ---*/ | ||
|
|
||
| V_outlet[nDim+7] = nodes->GetSpecificHeatCp(iPoint); | ||
| V_outlet[prim_idx.CpTotal()] = nodes->GetSpecificHeatCp(iPoint); | ||
|
|
||
| /*--- Set various quantities in the solver class ---*/ | ||
|
|
||
|
|
@@ -2527,9 +2524,9 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container, | |
|
|
||
| /*--- Set transport properties at the outlet. ---*/ | ||
|
|
||
| V_outlet[nDim+4] = nodes->GetLaminarViscosity(iPoint); | ||
| V_outlet[nDim+5] = nodes->GetEddyViscosity(iPoint); | ||
| V_outlet[nDim+6] = nodes->GetThermalConductivity(iPoint); | ||
| V_outlet[prim_idx.LaminarViscosity()] = nodes->GetLaminarViscosity(iPoint); | ||
| V_outlet[prim_idx.EddyViscosity()] = nodes->GetEddyViscosity(iPoint); | ||
| V_outlet[prim_idx.ThermalConductivity()] = nodes->GetThermalConductivity(iPoint); | ||
|
|
||
| /*--- Set the normal vector and the coordinates ---*/ | ||
|
|
||
|
|
@@ -2878,7 +2875,7 @@ void CIncEulerSolver::GetOutlet_Properties(CGeometry *geometry, CConfig *config, | |
| AxiFactor = 1.0; | ||
| } | ||
|
|
||
| Density = V_outlet[nDim+2]; | ||
| Density = V_outlet[prim_idx.Density()]; | ||
|
Contributor
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. Great to see the replacement of the magical numbers nDim + i with human readable indices |
||
|
|
||
| Velocity2 = 0.0; Area = 0.0; MassFlow = 0.0; | ||
|
|
||
|
|
||
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.
Looks like this is the actual fix and the rest is code cleanup? LGTM