Skip to content

Commit 784a0f7

Browse files
committed
revert removal of conserved
1 parent 0e198fc commit 784a0f7

1 file changed

Lines changed: 28 additions & 42 deletions

File tree

SU2_CFD/src/solvers/CNEMOEulerSolver.cpp

Lines changed: 28 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,27 +1428,11 @@ void CNEMOEulerSolver::BC_Sym_Plane(CGeometry *geometry, CSolver **solver_contai
14281428
unsigned short iDim, jDim, iSpecies, iVar, jVar;
14291429
unsigned long iPoint, iVertex;
14301430

1431-
su2double *Normal = nullptr, Area, UnitNormal[3], *NormalArea,
1432-
**Jacobian_b, **DubDu,
1433-
rho, cs, P, rhoE, rhoEve, conc, *u, *dPdU;
1431+
/*--- Allocate the necessary vector structures ---*/
1432+
su2double Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0};
14341433

14351434
bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);
14361435

1437-
/*--- Allocate arrays ---*/
1438-
Normal = new su2double[nDim];
1439-
NormalArea = new su2double[nDim];
1440-
Jacobian_b = new su2double*[nVar];
1441-
DubDu = new su2double*[nVar];
1442-
u = new su2double[nDim];
1443-
1444-
for (iVar = 0; iVar < nVar; iVar++) {
1445-
Jacobian_b[iVar] = new su2double[nVar];
1446-
DubDu[iVar] = new su2double[nVar];
1447-
}
1448-
1449-
/*--- Get species molar mass ---*/
1450-
auto& Ms = FluidModel->GetSpeciesMolarMass();
1451-
14521436
/*--- Loop over all the vertices on this boundary (val_marker) ---*/
14531437
for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
14541438
iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
@@ -1460,15 +1444,14 @@ void CNEMOEulerSolver::BC_Sym_Plane(CGeometry *geometry, CSolver **solver_contai
14601444
geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
14611445

14621446
/*--- Calculate parameters from the geometry ---*/
1463-
Area = GeometryToolbox::Norm(nDim, Normal);
1447+
su2double Area = GeometryToolbox::Norm(nDim, Normal);
14641448

14651449
for (iDim = 0; iDim < nDim; iDim++){
1466-
NormalArea[iDim] = -Normal[iDim];
14671450
UnitNormal[iDim] = -Normal[iDim]/Area;
14681451
}
14691452

14701453
/*--- Retrieve the pressure on the vertex ---*/
1471-
P = nodes->GetPressure(iPoint);
1454+
su2double P = nodes->GetPressure(iPoint);
14721455

14731456
/*--- Apply the flow-tangency b.c. to the convective flux ---*/
14741457
for (iSpecies = 0; iSpecies < nSpecies; iSpecies++)
@@ -1485,25 +1468,30 @@ void CNEMOEulerSolver::BC_Sym_Plane(CGeometry *geometry, CSolver **solver_contai
14851468
/*--- If using implicit time-stepping, calculate b.c. contribution to Jacobian ---*/
14861469
if (implicit) {
14871470

1471+
/*--- Allocate arrays needed for implicit solver ---*/
1472+
su2double Velocity[MAXNDIM] = {0.0};
1473+
1474+
/*--- Get species molar mass ---*/
1475+
auto& Ms = FluidModel->GetSpeciesMolarMass();
1476+
14881477
/*--- Initialize Jacobian ---*/
14891478
for (iVar = 0; iVar < nVar; iVar++)
14901479
for (jVar = 0; jVar < nVar; jVar++)
14911480
Jacobian_i[iVar][jVar] = 0.0;
14921481

14931482
/*--- Calculate state i ---*/
1494-
rho = nodes->GetDensity(iPoint);
1495-
rhoE = nodes->GetSolution(iPoint,nSpecies+nDim);
1496-
rhoEve = nodes->GetSolution(iPoint,nSpecies+nDim+1);
1497-
dPdU = nodes->GetdPdU(iPoint);
1483+
su2double rho = nodes->GetDensity(iPoint);
1484+
su2double rhoE = nodes->GetSolution(iPoint,nSpecies+nDim);
1485+
su2double rhoEve = nodes->GetSolution(iPoint,nSpecies+nDim+1);
1486+
auto dPdU = nodes->GetdPdU(iPoint);
14981487
for (iDim = 0; iDim < nDim; iDim++)
1499-
u[iDim] = nodes->GetVelocity(iPoint,iDim);
1488+
Velocity[iDim] = nodes->GetVelocity(iPoint,iDim);
15001489

1501-
conc = 0.0;
1490+
su2double conc = 0.0;
15021491
for (iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
1503-
cs = nodes->GetMassFraction(iPoint,iSpecies);
1492+
su2double cs = nodes->GetMassFraction(iPoint,iSpecies);
15041493
conc += cs * rho/Ms[iSpecies];
15051494

1506-
/////// NEW //////
15071495
for (iDim = 0; iDim < nDim; iDim++) {
15081496
Jacobian_i[nSpecies+iDim][iSpecies] = dPdU[iSpecies] * UnitNormal[iDim];
15091497
Jacobian_i[iSpecies][nSpecies+iDim] = cs * UnitNormal[iDim];
@@ -1512,7 +1500,7 @@ void CNEMOEulerSolver::BC_Sym_Plane(CGeometry *geometry, CSolver **solver_contai
15121500

15131501
for (iDim = 0; iDim < nDim; iDim++) {
15141502
for (jDim = 0; jDim < nDim; jDim++) {
1515-
Jacobian_i[nSpecies+iDim][nSpecies+jDim] = u[iDim]*UnitNormal[jDim]
1503+
Jacobian_i[nSpecies+iDim][nSpecies+jDim] = Velocity[iDim]*UnitNormal[jDim]
15161504
+ dPdU[nSpecies+jDim]*UnitNormal[iDim];
15171505
}
15181506
Jacobian_i[nSpecies+iDim][nSpecies+nDim] = dPdU[nSpecies+nDim] *UnitNormal[iDim];
@@ -1533,17 +1521,6 @@ void CNEMOEulerSolver::BC_Sym_Plane(CGeometry *geometry, CSolver **solver_contai
15331521
}
15341522
}
15351523
}
1536-
delete [] Normal;
1537-
delete [] NormalArea;
1538-
delete [] u;
1539-
1540-
for (iVar = 0; iVar < nVar; iVar++) {
1541-
delete [] Jacobian_b[iVar];
1542-
delete [] DubDu[iVar];
1543-
}
1544-
1545-
delete [] Jacobian_b;
1546-
delete [] DubDu;
15471524
}
15481525

15491526
void CNEMOEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container,
@@ -1553,7 +1530,7 @@ void CNEMOEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contai
15531530
unsigned short iDim;
15541531
unsigned long iVertex, iPoint, Point_Normal;
15551532

1556-
su2double *V_infty, *V_domain;
1533+
su2double *V_infty, *V_domain, *U_infty, *U_domain;
15571534

15581535
/*--- Set booleans from configuration parameters ---*/
15591536
bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);
@@ -1578,10 +1555,13 @@ void CNEMOEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contai
15781555
conv_numerics->SetNormal(Normal);
15791556

15801557
/*--- Retrieve solution at the boundary node & free-stream ---*/
1558+
U_domain = nodes->GetSolution(iPoint);
15811559
V_domain = nodes->GetPrimitive(iPoint);
1560+
U_infty = node_infty->GetSolution(0);
15821561
V_infty = node_infty->GetPrimitive(0);
15831562

15841563
/*--- Pass conserved & primitive variables to CNumerics ---*/
1564+
conv_numerics->SetConservative(U_domain, U_infty);
15851565
conv_numerics->SetPrimitive(V_domain, V_infty);
15861566

15871567
/*--- Pass supplementary information to CNumerics ---*/
@@ -1611,6 +1591,8 @@ void CNEMOEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_contai
16111591
visc_numerics->SetNormal(Normal);
16121592

16131593
/*--- Primitive variables, and gradient ---*/
1594+
visc_numerics->SetConservative(nodes->GetSolution(iPoint),
1595+
node_infty->GetSolution(0) );
16141596
visc_numerics->SetPrimitive(nodes->GetPrimitive(iPoint),
16151597
node_infty->GetPrimitive(0) );
16161598
visc_numerics->SetPrimVarGradient(nodes->GetGradient_Primitive(iPoint),
@@ -2398,6 +2380,7 @@ void CNEMOEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solve
23982380
unsigned short iDim;
23992381
unsigned long iVertex, iPoint;
24002382
su2double *V_outlet, *V_domain;
2383+
su2double *U_outlet, *U_domain;
24012384

24022385
bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);
24032386
bool dynamic_grid = config->GetGrid_Movement();
@@ -2418,9 +2401,11 @@ void CNEMOEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solve
24182401

24192402
/*--- Current solution at this boundary node ---*/
24202403
V_domain = nodes->GetPrimitive(iPoint);
2404+
U_domain = nodes->GetSolution(iPoint);
24212405

24222406
/*--- Allocate the value at the outlet ---*/
24232407
V_outlet = V_domain;
2408+
U_outlet = U_domain;
24242409

24252410
/*--- Normal vector for this vertex (negate for outward convention) ---*/
24262411
geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
@@ -2429,6 +2414,7 @@ void CNEMOEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solve
24292414
/*--- Set various quantities in the solver class ---*/
24302415
conv_numerics->SetNormal(Normal);
24312416
conv_numerics->SetPrimitive(V_domain, V_outlet);
2417+
conv_numerics->SetConservative(U_domain, U_outlet);
24322418

24332419
/*--- Pass supplementary information to CNumerics ---*/
24342420
conv_numerics->SetdPdU (nodes->GetdPdU(iPoint), nodes->GetdPdU(iPoint));

0 commit comments

Comments
 (0)