Skip to content

Commit 2a2948b

Browse files
committed
Merge remote-tracking branch 'origin/develop' into feature_heatcoeff_BC
2 parents 6aea1c9 + adf8fbd commit 2a2948b

4 files changed

Lines changed: 17 additions & 76 deletions

File tree

SU2_CFD/include/variables/CNEMOEulerVariable.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
#include "CVariable.hpp"
3131
#include "../fluid/CNEMOGas.hpp"
32+
#include "../../Common/include/toolboxes/geometry_toolbox.hpp"
3233

3334
/*!
3435
* \class CNEMOEulerVariable

SU2_CFD/src/solvers/CNEMOEulerSolver.cpp

Lines changed: 5 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ CNEMOEulerSolver::CNEMOEulerSolver(CGeometry *geometry, CConfig *config,
4646
description = "Euler";
4747
}
4848

49-
unsigned long iPoint, counter_local, counter_global = 0;
50-
unsigned short iDim, iMarker, iSpecies, nLineLets;
49+
unsigned short iMarker, nLineLets;
5150
unsigned short nZone = geometry->GetnZone();
52-
su2double *Mvec_Inf, Alpha, Beta, Soundspeed_Inf, sqvel;
51+
su2double *Mvec_Inf, Alpha, Beta;
5352
bool restart = (config->GetRestart() || config->GetRestart_Flow());
5453
unsigned short direct_diff = config->GetDirectDiff();
5554
int Unst_RestartIter = 0;
@@ -59,8 +58,6 @@ CNEMOEulerSolver::CNEMOEulerSolver(CGeometry *geometry, CConfig *config,
5958
bool adjoint = config->GetDiscrete_Adjoint();
6059
string filename_ = "flow";
6160

62-
bool nonPhys;
63-
6461
/*--- Store the multigrid level. ---*/
6562
MGLevel = iMesh;
6663

@@ -216,52 +213,6 @@ CNEMOEulerSolver::CNEMOEulerSolver(CGeometry *geometry, CConfig *config,
216213

217214
node_infty->SetPrimVar(0, FluidModel);
218215

219-
/*--- Check that the initial solution is physical, report any non-physical nodes ---*/
220-
221-
counter_local = 0;
222-
223-
for (iPoint = 0; iPoint < nPoint; iPoint++) {
224-
225-
nonPhys = nodes->SetPrimVar(iPoint, FluidModel);
226-
227-
/*--- Set mixture state ---*/
228-
FluidModel->SetTDStatePTTv(Pressure_Inf, MassFrac_Inf, Temperature_Inf, Temperature_ve_Inf);
229-
230-
/*--- Compute other freestream quantities ---*/
231-
Density_Inf = FluidModel->GetDensity();
232-
Soundspeed_Inf = FluidModel->GetSoundSpeed();
233-
234-
sqvel = 0.0;
235-
for (iDim = 0; iDim < nDim; iDim++){
236-
sqvel += Mvec_Inf[iDim]*Soundspeed_Inf * Mvec_Inf[iDim]*Soundspeed_Inf;
237-
}
238-
const auto& Energies_Inf = FluidModel->ComputeMixtureEnergies();
239-
240-
/*--- Initialize Solution & Solution_Old vectors ---*/
241-
for (iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
242-
Solution[iSpecies] = Density_Inf*MassFrac_Inf[iSpecies];
243-
}
244-
for (iDim = 0; iDim < nDim; iDim++) {
245-
Solution[nSpecies+iDim] = Density_Inf*Mvec_Inf[iDim]*Soundspeed_Inf;
246-
}
247-
Solution[nSpecies+nDim] = Density_Inf*(Energies_Inf[0] + 0.5*sqvel);
248-
Solution[nSpecies+nDim+1] = Density_Inf*Energies_Inf[1];
249-
nodes->SetSolution(iPoint,Solution);
250-
nodes->SetSolution_Old(iPoint,Solution);
251-
252-
if(nonPhys)
253-
counter_local++;
254-
}
255-
256-
/*--- Warning message about non-physical points ---*/
257-
if (config->GetComm_Level() == COMM_FULL) {
258-
259-
SU2_MPI::Reduce(&counter_local, &counter_global, 1, MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, SU2_MPI::GetComm());
260-
261-
if ((rank == MASTER_NODE) && (counter_global != 0))
262-
cout << "Warning. The original solution contains "<< counter_global << " points that are not physical." << endl;
263-
}
264-
265216
/*--- Initial comms. ---*/
266217

267218
CommunicateInitialState(geometry, config);
@@ -303,7 +254,9 @@ void CNEMOEulerSolver::CommonPreprocessing(CGeometry *geometry, CSolver **solver
303254
unsigned long tmp = ErrorCounter;
304255
SU2_MPI::Allreduce(&tmp, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm());
305256
config->SetNonphysical_Points(ErrorCounter);
306-
257+
258+
if ((rank == MASTER_NODE) && (ErrorCounter != 0))
259+
cout << "Warning. The initial solution contains "<< ErrorCounter << " points that are not physical." << endl;
307260
}
308261

309262
/*--- Artificial dissipation ---*/

SU2_CFD/src/solvers/CSolverFactory.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,6 @@ CSolver* CSolverFactory::CreateFlowSolver(SUB_SOLVER_TYPE kindFlowSolver, CSolve
429429
break;
430430
case SUB_SOLVER_TYPE::NEMO_EULER:
431431
flowSolver = new CNEMOEulerSolver(geometry, config, iMGLevel);
432-
flowSolver->Preprocessing(geometry, solver, config, iMGLevel, NO_RK_ITER, RUNTIME_FLOW_SYS, false);
433432
break;
434433
case SUB_SOLVER_TYPE::NEMO_NAVIER_STOKES:
435434
flowSolver = new CNEMONSSolver(geometry, config, iMGLevel);

SU2_CFD/src/variables/CNEMOEulerVariable.cpp

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ CNEMOEulerVariable::CNEMOEulerVariable(su2double val_pressure,
4545
config ),
4646
Gradient_Reconstruction(config->GetReconstructionGradientRequired() ? Gradient_Aux : Gradient_Primitive) {
4747

48-
vector<su2double> energies;
4948
unsigned short iDim, iSpecies;
50-
su2double soundspeed, sqvel, rho;
5149

5250
/*--- Setting variable amounts ---*/
5351
nDim = ndim;
@@ -143,23 +141,18 @@ CNEMOEulerVariable::CNEMOEulerVariable(su2double val_pressure,
143141
UnderRelaxation.resize(nPoint) = su2double(1.0);
144142
LocalCFL.resize(nPoint) = su2double(0.0);
145143

144+
/*--- Set mixture state ---*/
145+
fluidmodel->SetTDStatePTTv(val_pressure, val_massfrac, val_temperature, val_temperature_ve);
146+
147+
/*--- Compute necessary quantities ---*/
148+
const su2double rho = fluidmodel->GetDensity();
149+
const su2double soundspeed = fluidmodel->ComputeSoundSpeed();
150+
const su2double sqvel = GeometryToolbox::SquaredNorm(nDim, val_mach) * pow(soundspeed,2);
151+
const auto& energies = fluidmodel->ComputeMixtureEnergies();
152+
146153
/*--- Loop over all points --*/
147154
for(unsigned long iPoint = 0; iPoint < nPoint; ++iPoint){
148155

149-
/*--- Reset velocity^2 [m2/s2] to zero ---*/
150-
sqvel = 0.0;
151-
152-
/*--- Set mixture state ---*/
153-
fluidmodel->SetTDStatePTTv(val_pressure, val_massfrac, val_temperature, val_temperature_ve);
154-
155-
/*--- Compute necessary quantities ---*/
156-
rho = fluidmodel->GetDensity();
157-
soundspeed = fluidmodel->ComputeSoundSpeed();
158-
for (iDim = 0; iDim < nDim; iDim++){
159-
sqvel += val_mach[iDim]*soundspeed * val_mach[iDim]*soundspeed;
160-
}
161-
energies = fluidmodel->ComputeMixtureEnergies();
162-
163156
/*--- Initialize Solution & Solution_Old vectors ---*/
164157
for (iSpecies = 0; iSpecies < nSpecies; iSpecies++)
165158
Solution(iPoint,iSpecies) = rho*val_massfrac[iSpecies];
@@ -168,14 +161,9 @@ CNEMOEulerVariable::CNEMOEulerVariable(su2double val_pressure,
168161

169162
Solution(iPoint,nSpecies+nDim) = rho*(energies[0]+0.5*sqvel);
170163
Solution(iPoint,nSpecies+nDim+1) = rho*(energies[1]);
171-
172-
Solution_Old = Solution;
173-
174-
/*--- Assign primitive variables ---*/
175-
Primitive(iPoint,T_INDEX) = val_temperature;
176-
Primitive(iPoint,TVE_INDEX) = val_temperature_ve;
177-
Primitive(iPoint,P_INDEX) = val_pressure;
178164
}
165+
166+
Solution_Old = Solution;
179167
}
180168

181169
void CNEMOEulerVariable::SetVelocity2(unsigned long iPoint) {

0 commit comments

Comments
 (0)