-
Notifications
You must be signed in to change notification settings - Fork 976
Expand file tree
/
Copy pathCIncEulerSolver.cpp
More file actions
3208 lines (2297 loc) · 123 KB
/
CIncEulerSolver.cpp
File metadata and controls
3208 lines (2297 loc) · 123 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*!
* \file CIncEulerSolver.cpp
* \brief Main subroutines for solving incompressible flow (Euler, Navier-Stokes, etc.).
* \author F. Palacios, T. Economon
* \version 8.1.0 "Harrier"
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2024, SU2 Contributors (cf. AUTHORS.md)
*
* SU2 is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* SU2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with SU2. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../../include/solvers/CIncEulerSolver.hpp"
#include "../../../Common/include/toolboxes/printing_toolbox.hpp"
#include "../../include/fluid/CConstantDensity.hpp"
#include "../../include/fluid/CIncIdealGas.hpp"
#include "../../include/fluid/CIncIdealGasPolynomial.hpp"
#include "../../include/variables/CIncNSVariable.hpp"
#include "../../include/limiters/CLimiterDetails.hpp"
#include "../../../Common/include/toolboxes/geometry_toolbox.hpp"
#include "../../include/fluid/CFluidScalar.hpp"
#include "../../include/fluid/CFluidFlamelet.hpp"
#include "../../include/fluid/CFluidModel.hpp"
CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh,
const bool navier_stokes) :
CFVMFlowSolverBase<CIncEulerVariable, ENUM_REGIME::INCOMPRESSIBLE>(*geometry, *config) {
/*--- Based on the navier_stokes boolean, determine if this constructor is
* being called by itself, or by its derived class CIncNSSolver. ---*/
const string description = navier_stokes? "Navier-Stokes" : "Euler";
unsigned short iMarker;
ifstream restart_file;
unsigned short nZone = geometry->GetnZone();
bool restart = (config->GetRestart() || config->GetRestart_Flow());
int Unst_RestartIter = 0;
unsigned short iZone = config->GetiZone();
bool dual_time = ((config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_1ST) ||
(config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_2ND));
bool time_stepping = config->GetTime_Marching() == TIME_MARCHING::TIME_STEPPING;
bool adjoint = (config->GetContinuous_Adjoint()) || (config->GetDiscrete_Adjoint());
const bool centered = config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED;
/* A grid is defined as dynamic if there's rigid grid movement or grid deformation AND the problem is time domain */
dynamic_grid = config->GetDynamic_Grid();
/*--- Store the multigrid level. ---*/
MGLevel = iMesh;
/*--- Check for a restart file to evaluate if there is a change in the angle of attack
before computing all the non-dimesional quantities. ---*/
if (restart && (iMesh == MESH_0) && nZone <= 1) {
/*--- Multizone problems require the number of the zone to be appended. ---*/
auto filename_ = config->GetSolution_FileName();
if (nZone > 1) filename_ = config->GetMultizone_FileName(filename_, iZone, ".dat");
/*--- Modify file name for a dual-time unsteady restart ---*/
if (dual_time) {
if (adjoint) Unst_RestartIter = SU2_TYPE::Int(config->GetUnst_AdjointIter())-1;
else if (config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_1ST)
Unst_RestartIter = SU2_TYPE::Int(config->GetRestart_Iter())-1;
else Unst_RestartIter = SU2_TYPE::Int(config->GetRestart_Iter())-2;
filename_ = config->GetUnsteady_FileName(filename_, Unst_RestartIter, ".dat");
}
/*--- Modify file name for a time stepping unsteady restart ---*/
if (time_stepping) {
if (adjoint) Unst_RestartIter = SU2_TYPE::Int(config->GetUnst_AdjointIter())-1;
else Unst_RestartIter = SU2_TYPE::Int(config->GetRestart_Iter())-1;
filename_ = config->GetUnsteady_FileName(filename_, Unst_RestartIter, ".dat");
}
/*--- Read and store the restart metadata. ---*/
filename_ = "flow";
filename_ = config->GetFilename(filename_, ".meta", Unst_RestartIter);
Read_SU2_Restart_Metadata(geometry, config, adjoint, filename_);
}
if (restart && (config->GetKind_Streamwise_Periodic() == ENUM_STREAMWISE_PERIODIC::MASSFLOW)) {
string filename_ = "flow";
filename_ = config->GetFilename(filename_, ".meta", Unst_RestartIter);
Read_SU2_Restart_Metadata(geometry, config, adjoint, filename_);
if (rank==MASTER_NODE) cout << "Setting streamwise periodic pressure drop from restart metadata file." << endl;
}
/*--- Set the gamma value ---*/
Gamma = config->GetGamma();
Gamma_Minus_One = Gamma - 1.0;
/*--- Define geometry constants in the solver structure.
* Incompressible flow, primitive variables (P, vx, vy, vz, T, rho, beta, lamMu, EddyMu, Kt_eff, Cp, Cv) ---*/
nDim = geometry->GetnDim();
/*--- Make sure to align the sizes with the constructor of CIncEulerVariable. ---*/
nVar = nDim + 2;
nPrimVar = nDim + 9;
/*--- Centered schemes only need gradients for viscous fluxes (T and v, but we need also to include P). ---*/
nPrimVarGrad = nDim + (centered ? 2 : 4);
/*--- Initialize nVarGrad for deallocation ---*/
nVarGrad = nPrimVarGrad;
nMarker = config->GetnMarker_All();
nPoint = geometry->GetnPoint();
nPointDomain = geometry->GetnPointDomain();
/*--- Store the number of vertices on each marker for deallocation later ---*/
nVertex.resize(nMarker);
for (iMarker = 0; iMarker < nMarker; iMarker++)
nVertex[iMarker] = geometry->nVertex[iMarker];
/*--- Perform the non-dimensionalization for the flow equations using the
specified reference values. ---*/
SetNondimensionalization(config, iMesh);
/*--- Check if we are executing a verification case. If so, the
VerificationSolution object will be instantiated for a particular
option from the available library of verification solutions. Note
that this is done after SetNondim(), as problem-specific initial
parameters are needed by the solution constructors. ---*/
SetVerificationSolution(nDim, nVar, config);
/*--- Allocate base class members. ---*/
Allocate(*config);
/*--- MPI + OpenMP initialization. ---*/
HybridParallelInitialization(*config, *geometry);
/*--- Jacobians and vector structures for implicit computations ---*/
if (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT) {
if (rank == MASTER_NODE)
cout << "Initialize Jacobian structure (" << description << "). MG level: " << iMesh <<"." << endl;
Jacobian.Initialize(nPoint, nPointDomain, nVar, nVar, true, geometry, config, ReducerStrategy);
}
else {
if (rank == MASTER_NODE)
cout << "Explicit scheme. No Jacobian structure (" << description << "). MG level: " << iMesh <<"." << endl;
}
/*--- Read farfield conditions ---*/
Density_Inf = config->GetDensity_FreeStreamND();
Pressure_Inf = config->GetPressure_FreeStreamND();
Velocity_Inf = config->GetVelocity_FreeStreamND();
Temperature_Inf = config->GetTemperature_FreeStreamND();
/*--- Initialize the secondary values for direct derivative approxiations ---*/
switch (config->GetDirectDiff()) {
case NO_DERIVATIVE:
/*--- Default ---*/
break;
case D_DENSITY:
SU2_TYPE::SetDerivative(Density_Inf, 1.0);
break;
case D_PRESSURE:
SU2_TYPE::SetDerivative(Pressure_Inf, 1.0);
break;
case D_TEMPERATURE:
SU2_TYPE::SetDerivative(Temperature_Inf, 1.0);
break;
case D_MACH: case D_AOA:
case D_SIDESLIP: case D_REYNOLDS:
case D_TURB2LAM: case D_DESIGN:
/*--- Already done in postprocessing of config ---*/
break;
default:
break;
}
SetReferenceValues(*config);
/*--- Initialize the solution to the far-field state everywhere. ---*/
if (navier_stokes) {
nodes = new CIncNSVariable(Density_Inf, Pressure_Inf, Velocity_Inf, Temperature_Inf, nPoint, nDim, nVar, config);
} else {
nodes = new CIncEulerVariable(Density_Inf, Pressure_Inf, Velocity_Inf, Temperature_Inf, nPoint, nDim, nVar, config);
}
SetBaseClassPointerToNodes();
if (iMesh == MESH_0) {
nodes->NonPhysicalEdgeCounter.resize(geometry->GetnEdge()) = 0;
}
/*--- Initial comms. ---*/
CommunicateInitialState(geometry, config);
/*--- Sizing edge mass flux array ---*/
if (config->GetBounded_Scalar())
EdgeMassFluxes.resize(geometry->GetnEdge()) = su2double(0.0);
/*--- Add the solver name. ---*/
SolverName = "INC.FLOW";
/*--- Finally, check that the static arrays will be large enough (keep this
* check at the bottom to make sure we consider the "final" values). ---*/
if((nDim > MAXNDIM) || (nPrimVar > MAXNVAR))
SU2_MPI::Error("Oops! The CIncEulerSolver static array sizes are not large enough.", CURRENT_FUNCTION);
}
CIncEulerSolver::~CIncEulerSolver() {
for(auto& model : FluidModel) delete model;
}
void CIncEulerSolver::SetNondimensionalization(CConfig *config, unsigned short iMesh) {
su2double Temperature_FreeStream = 0.0, ModVel_FreeStream = 0.0,Energy_FreeStream = 0.0,
ModVel_FreeStreamND = 0.0, Omega_FreeStream = 0.0, Omega_FreeStreamND = 0.0, Viscosity_FreeStream = 0.0,
Density_FreeStream = 0.0, Pressure_FreeStream = 0.0, Pressure_Thermodynamic = 0.0, Tke_FreeStream = 0.0,
Length_Ref = 0.0, Density_Ref = 0.0, Pressure_Ref = 0.0, Temperature_Ref = 0.0, Velocity_Ref = 0.0, Time_Ref = 0.0,
Gas_Constant_Ref = 0.0, Omega_Ref = 0.0, Force_Ref = 0.0, Viscosity_Ref = 0.0, Conductivity_Ref = 0.0, Heat_Flux_Ref = 0.0, Energy_Ref= 0.0, Pressure_FreeStreamND = 0.0, Pressure_ThermodynamicND = 0.0, Density_FreeStreamND = 0.0,
Temperature_FreeStreamND = 0.0, Gas_ConstantND = 0.0, Specific_Heat_CpND = 0.0, Thermal_Expansion_CoeffND = 0.0,
Velocity_FreeStreamND[3] = {0.0, 0.0, 0.0}, Viscosity_FreeStreamND = 0.0,
Tke_FreeStreamND = 0.0, Energy_FreeStreamND = 0.0,
Total_UnstTimeND = 0.0, Delta_UnstTimeND = 0.0;
unsigned short iDim, iVar;
/*--- Local variables ---*/
su2double Mach = config->GetMach();
su2double Reynolds = config->GetReynolds();
bool unsteady = (config->GetTime_Marching() != TIME_MARCHING::STEADY);
bool viscous = config->GetViscous();
bool turbulent = ((config->GetKind_Solver() == MAIN_SOLVER::INC_RANS) ||
(config->GetKind_Solver() == MAIN_SOLVER::DISC_ADJ_INC_RANS));
bool tkeNeeded = ((turbulent) && ((config->GetKind_Turb_Model() == TURB_MODEL::SST)));
bool energy = config->GetEnergy_Equation();
bool boussinesq = (config->GetKind_DensityModel() == INC_DENSITYMODEL::BOUSSINESQ);
/*--- Compute dimensional free-stream values. ---*/
Density_FreeStream = config->GetInc_Density_Init(); config->SetDensity_FreeStream(Density_FreeStream);
Temperature_FreeStream = config->GetInc_Temperature_Init(); config->SetTemperature_FreeStream(Temperature_FreeStream);
Pressure_FreeStream = 0.0; config->SetPressure_FreeStream(Pressure_FreeStream);
/*--- The dimensional viscosity is needed to determine the free-stream conditions.
To accomplish this, simply set the non-dimensional coefficients to the
dimensional ones. This will be overruled later.---*/
config->SetTemperature_Ref(1.0);
config->SetViscosity_Ref(1.0);
config->SetConductivity_Ref(1.0);
config->SetGas_Constant_Ref(1.0);
ModVel_FreeStream = 0.0;
for (iDim = 0; iDim < nDim; iDim++) {
ModVel_FreeStream += config->GetInc_Velocity_Init()[iDim]*config->GetInc_Velocity_Init()[iDim];
config->SetVelocity_FreeStream(config->GetInc_Velocity_Init()[iDim],iDim);
}
ModVel_FreeStream = sqrt(ModVel_FreeStream); config->SetModVel_FreeStream(ModVel_FreeStream);
CFluidModel* auxFluidModel = nullptr;
switch (config->GetKind_FluidModel()) {
case CONSTANT_DENSITY:
auxFluidModel = new CConstantDensity(Density_FreeStream, config->GetSpecific_Heat_Cp());
auxFluidModel->SetTDState_T(Temperature_FreeStream);
break;
case INC_IDEAL_GAS:
config->SetGas_Constant(UNIVERSAL_GAS_CONSTANT/(config->GetMolecular_Weight()/1000.0));
Pressure_Thermodynamic = Density_FreeStream*Temperature_FreeStream*config->GetGas_Constant();
auxFluidModel = new CIncIdealGas(config->GetSpecific_Heat_Cp(), config->GetGas_Constant(), Pressure_Thermodynamic);
auxFluidModel->SetTDState_T(Temperature_FreeStream);
Pressure_Thermodynamic = auxFluidModel->GetPressure();
config->SetPressure_Thermodynamic(Pressure_Thermodynamic);
break;
case INC_IDEAL_GAS_POLY:
config->SetGas_Constant(UNIVERSAL_GAS_CONSTANT/(config->GetMolecular_Weight()/1000.0));
Pressure_Thermodynamic = Density_FreeStream*Temperature_FreeStream*config->GetGas_Constant();
auxFluidModel = new CIncIdealGasPolynomial<N_POLY_COEFFS>(config->GetGas_Constant(), Pressure_Thermodynamic);
if (viscous) {
/*--- Variable Cp model via polynomial. ---*/
for (iVar = 0; iVar < config->GetnPolyCoeffs(); iVar++)
config->SetCp_PolyCoeffND(config->GetCp_PolyCoeff(iVar), iVar);
auxFluidModel->SetCpModel(config);
}
auxFluidModel->SetTDState_T(Temperature_FreeStream);
Pressure_Thermodynamic = auxFluidModel->GetPressure();
config->SetPressure_Thermodynamic(Pressure_Thermodynamic);
break;
case FLUID_MIXTURE:
config->SetGas_Constant(UNIVERSAL_GAS_CONSTANT / (config->GetMolecular_Weight() / 1000.0));
Pressure_Thermodynamic = config->GetPressure_Thermodynamic();
auxFluidModel = new CFluidScalar(Pressure_Thermodynamic, config);
auxFluidModel->SetTDState_T(Temperature_FreeStream, config->GetSpecies_Init());
break;
case FLUID_FLAMELET:
config->SetGas_Constant(UNIVERSAL_GAS_CONSTANT / (config->GetMolecular_Weight() / 1000.0));
Pressure_Thermodynamic = config->GetPressure_Thermodynamic();
auxFluidModel = new CFluidFlamelet(config, Pressure_Thermodynamic);
config->SetPressure_Thermodynamic(Pressure_Thermodynamic);
auxFluidModel->SetTDState_T(Temperature_FreeStream, config->GetSpecies_Init());
break;
default:
SU2_MPI::Error("Fluid model not implemented for incompressible solver.", CURRENT_FUNCTION);
break;
}
if (viscous) {
for (iVar = 0; iVar < config->GetnPolyCoeffs(); iVar++)
config->SetMu_PolyCoeffND(config->GetMu_PolyCoeff(iVar), iVar);
/*--- Use the fluid model to compute the dimensional viscosity/conductivity. ---*/
auxFluidModel->SetLaminarViscosityModel(config);
Viscosity_FreeStream = auxFluidModel->GetLaminarViscosity();
config->SetViscosity_FreeStream(Viscosity_FreeStream);
Reynolds = Density_FreeStream*ModVel_FreeStream/Viscosity_FreeStream; config->SetReynolds(Reynolds);
/*--- Turbulence kinetic energy ---*/
Tke_FreeStream = 3.0/2.0*(ModVel_FreeStream*ModVel_FreeStream*config->GetTurbulenceIntensity_FreeStream()*config->GetTurbulenceIntensity_FreeStream());
}
/*--- The non-dim. scheme for incompressible flows uses the following ref. values:
Reference length = 1 m (fixed by default, grid in meters)
Reference density = liquid density or freestream (input)
Reference velocity = liquid velocity or freestream (input)
Reference temperature = liquid temperature or freestream (input)
Reference pressure = Reference density * Reference velocity * Reference velocity
Reference viscosity = Reference Density * Reference velocity * Reference length
This is the same non-dim. scheme as in the compressible solver.
Note that the Re and Re Length are not used as part of initialization. ---*/
if (config->GetRef_Inc_NonDim() == DIMENSIONAL) {
Density_Ref = 1.0;
Velocity_Ref = 1.0;
Temperature_Ref = 1.0;
Pressure_Ref = 1.0;
}
else if (config->GetRef_Inc_NonDim() == INITIAL_VALUES) {
Density_Ref = Density_FreeStream;
Velocity_Ref = ModVel_FreeStream;
Temperature_Ref = Temperature_FreeStream;
Pressure_Ref = Density_Ref*Velocity_Ref*Velocity_Ref;
}
else if (config->GetRef_Inc_NonDim() == REFERENCE_VALUES) {
Density_Ref = config->GetInc_Density_Ref();
Velocity_Ref = config->GetInc_Velocity_Ref();
Temperature_Ref = config->GetInc_Temperature_Ref();
Pressure_Ref = Density_Ref*Velocity_Ref*Velocity_Ref;
}
config->SetDensity_Ref(Density_Ref);
config->SetVelocity_Ref(Velocity_Ref);
config->SetTemperature_Ref(Temperature_Ref);
config->SetPressure_Ref(Pressure_Ref);
/*--- More derived reference values ---*/
Length_Ref = 1.0; config->SetLength_Ref(Length_Ref);
Time_Ref = Length_Ref/Velocity_Ref; config->SetTime_Ref(Time_Ref);
Omega_Ref = Velocity_Ref/Length_Ref; config->SetOmega_Ref(Omega_Ref);
Force_Ref = Velocity_Ref*Velocity_Ref/Length_Ref; config->SetForce_Ref(Force_Ref);
Heat_Flux_Ref = Density_Ref*Velocity_Ref*Velocity_Ref*Velocity_Ref; config->SetHeat_Flux_Ref(Heat_Flux_Ref);
Gas_Constant_Ref = Velocity_Ref*Velocity_Ref/Temperature_Ref; config->SetGas_Constant_Ref(Gas_Constant_Ref);
Viscosity_Ref = Density_Ref*Velocity_Ref*Length_Ref; config->SetViscosity_Ref(Viscosity_Ref);
Conductivity_Ref = Viscosity_Ref*Gas_Constant_Ref; config->SetConductivity_Ref(Conductivity_Ref);
/*--- Get the freestream energy. Only useful if energy equation is active. ---*/
Energy_FreeStream = auxFluidModel->GetStaticEnergy() + 0.5*ModVel_FreeStream*ModVel_FreeStream;
if (tkeNeeded) { Energy_FreeStream += Tke_FreeStream; };
config->SetEnergy_FreeStream(Energy_FreeStream);
/*--- Auxilary (dimensional) FluidModel no longer needed. ---*/
delete auxFluidModel;
/*--- Compute Mach number ---*/
if (config->GetKind_FluidModel() == CONSTANT_DENSITY) {
Mach = ModVel_FreeStream / sqrt(config->GetBulk_Modulus()/Density_FreeStream);
} else {
Mach = 0.0;
}
config->SetMach(Mach);
/*--- Divide by reference values, to compute the non-dimensional free-stream values ---*/
Pressure_FreeStreamND = Pressure_FreeStream/config->GetPressure_Ref(); config->SetPressure_FreeStreamND(Pressure_FreeStreamND);
Pressure_ThermodynamicND = Pressure_Thermodynamic/config->GetPressure_Ref(); config->SetPressure_ThermodynamicND(Pressure_ThermodynamicND);
Density_FreeStreamND = Density_FreeStream/config->GetDensity_Ref(); config->SetDensity_FreeStreamND(Density_FreeStreamND);
for (iDim = 0; iDim < nDim; iDim++) {
Velocity_FreeStreamND[iDim] = config->GetVelocity_FreeStream()[iDim]/Velocity_Ref; config->SetVelocity_FreeStreamND(Velocity_FreeStreamND[iDim], iDim);
}
Temperature_FreeStreamND = Temperature_FreeStream/config->GetTemperature_Ref(); config->SetTemperature_FreeStreamND(Temperature_FreeStreamND);
Gas_ConstantND = config->GetGas_Constant()/Gas_Constant_Ref; config->SetGas_ConstantND(Gas_ConstantND);
Specific_Heat_CpND = config->GetSpecific_Heat_CpND();
Thermal_Expansion_CoeffND = config->GetThermal_Expansion_Coeff()*config->GetTemperature_Ref(); config->SetThermal_Expansion_CoeffND(Thermal_Expansion_CoeffND);
ModVel_FreeStreamND = 0.0;
for (iDim = 0; iDim < nDim; iDim++) ModVel_FreeStreamND += Velocity_FreeStreamND[iDim]*Velocity_FreeStreamND[iDim];
ModVel_FreeStreamND = sqrt(ModVel_FreeStreamND); config->SetModVel_FreeStreamND(ModVel_FreeStreamND);
Viscosity_FreeStreamND = Viscosity_FreeStream / Viscosity_Ref; config->SetViscosity_FreeStreamND(Viscosity_FreeStreamND);
Tke_FreeStream = 3.0/2.0*(ModVel_FreeStream*ModVel_FreeStream*config->GetTurbulenceIntensity_FreeStream()*config->GetTurbulenceIntensity_FreeStream());
config->SetTke_FreeStream(Tke_FreeStream);
Tke_FreeStreamND = 3.0/2.0*(ModVel_FreeStreamND*ModVel_FreeStreamND*config->GetTurbulenceIntensity_FreeStream()*config->GetTurbulenceIntensity_FreeStream());
config->SetTke_FreeStreamND(Tke_FreeStreamND);
Omega_FreeStream = Density_FreeStream*Tke_FreeStream/(Viscosity_FreeStream*config->GetTurb2LamViscRatio_FreeStream());
config->SetOmega_FreeStream(Omega_FreeStream);
Omega_FreeStreamND = Density_FreeStreamND*Tke_FreeStreamND/(Viscosity_FreeStreamND*config->GetTurb2LamViscRatio_FreeStream());
config->SetOmega_FreeStreamND(Omega_FreeStreamND);
const su2double MassDiffusivityND = config->GetDiffusivity_Constant() / (Velocity_Ref * Length_Ref);
config->SetDiffusivity_ConstantND(MassDiffusivityND);
/*--- Create one final fluid model object per OpenMP thread to be able to use them in parallel.
* GetFluidModel() should be used to automatically access the "right" object of each thread. ---*/
assert(FluidModel.empty() && "Potential memory leak!");
FluidModel.resize(omp_get_max_threads());
for (auto& fluidModel : FluidModel) {
switch (config->GetKind_FluidModel()) {
case CONSTANT_DENSITY:
fluidModel = new CConstantDensity(Density_FreeStreamND, Specific_Heat_CpND);
break;
case INC_IDEAL_GAS:
fluidModel = new CIncIdealGas(Specific_Heat_CpND, Gas_ConstantND, Pressure_ThermodynamicND);
fluidModel->SetTDState_T(Temperature_FreeStreamND);
break;
case FLUID_MIXTURE:
fluidModel = new CFluidScalar(Pressure_ThermodynamicND, config);
fluidModel->SetTDState_T(Temperature_FreeStreamND, config->GetSpecies_Init());
break;
case FLUID_FLAMELET:
fluidModel = new CFluidFlamelet(config, Pressure_Thermodynamic);
fluidModel->SetTDState_T(Temperature_FreeStreamND, config->GetSpecies_Init());
break;
case INC_IDEAL_GAS_POLY:
fluidModel = new CIncIdealGasPolynomial<N_POLY_COEFFS>(Gas_ConstantND, Pressure_ThermodynamicND);
if (viscous) {
/*--- Variable Cp model via polynomial. ---*/
config->SetCp_PolyCoeffND(config->GetCp_PolyCoeff(0)/Gas_Constant_Ref, 0);
for (iVar = 1; iVar < config->GetnPolyCoeffs(); iVar++)
config->SetCp_PolyCoeffND(config->GetCp_PolyCoeff(iVar)*pow(Temperature_Ref,iVar)/Gas_Constant_Ref, iVar);
fluidModel->SetCpModel(config);
}
fluidModel->SetTDState_T(Temperature_FreeStreamND);
break;
}
if (viscous) {
/*--- Viscosity model via polynomial. ---*/
config->SetMu_PolyCoeffND(config->GetMu_PolyCoeff(0)/Viscosity_Ref, 0);
for (iVar = 1; iVar < config->GetnPolyCoeffs(); iVar++)
config->SetMu_PolyCoeffND(config->GetMu_PolyCoeff(iVar)*pow(Temperature_Ref,iVar)/Viscosity_Ref, iVar);
/*--- Conductivity model via polynomial. ---*/
config->SetKt_PolyCoeffND(config->GetKt_PolyCoeff(0)/Conductivity_Ref, 0);
for (iVar = 1; iVar < config->GetnPolyCoeffs(); iVar++)
config->SetKt_PolyCoeffND(config->GetKt_PolyCoeff(iVar)*pow(Temperature_Ref,iVar)/Conductivity_Ref, iVar);
/*--- Set up the transport property models. ---*/
fluidModel->SetLaminarViscosityModel(config);
fluidModel->SetThermalConductivityModel(config);
fluidModel->SetMassDiffusivityModel(config);
}
}
Energy_FreeStreamND = GetFluidModel()->GetStaticEnergy() + 0.5*ModVel_FreeStreamND*ModVel_FreeStreamND;
if (tkeNeeded) { Energy_FreeStreamND += Tke_FreeStreamND; }; config->SetEnergy_FreeStreamND(Energy_FreeStreamND);
Energy_Ref = Energy_FreeStream/Energy_FreeStreamND; config->SetEnergy_Ref(Energy_Ref);
Total_UnstTimeND = config->GetTotal_UnstTime() / Time_Ref; config->SetTotal_UnstTimeND(Total_UnstTimeND);
Delta_UnstTimeND = config->GetDelta_UnstTime() / Time_Ref; config->SetDelta_UnstTimeND(Delta_UnstTimeND);
/*--- Write output to the console if this is the master node and first domain ---*/
if ((rank == MASTER_NODE) && (iMesh == MESH_0)) {
cout.precision(6);
if (config->GetRef_Inc_NonDim() == DIMENSIONAL) {
cout << "Incompressible flow: rho_ref, vel_ref, temp_ref, p_ref" << endl;
cout << "are set to 1.0 in order to perform a dimensional calculation." << endl;
if (dynamic_grid) cout << "Force coefficients computed using MACH_MOTION." << endl;
else cout << "Force coefficients computed using initial values." << endl;
}
else if (config->GetRef_Inc_NonDim() == INITIAL_VALUES) {
cout << "Incompressible flow: rho_ref, vel_ref, and temp_ref" << endl;
cout << "are based on the initial values, p_ref = rho_ref*vel_ref^2." << endl;
if (dynamic_grid) cout << "Force coefficients computed using MACH_MOTION." << endl;
else cout << "Force coefficients computed using initial values." << endl;
}
else if (config->GetRef_Inc_NonDim() == REFERENCE_VALUES) {
cout << "Incompressible flow: rho_ref, vel_ref, and temp_ref" << endl;
cout << "are user-provided reference values, p_ref = rho_ref*vel_ref^2." << endl;
if (dynamic_grid) cout << "Force coefficients computed using MACH_MOTION." << endl;
else cout << "Force coefficients computed using reference values." << endl;
}
cout << "The reference area for force coeffs. is " << config->GetRefArea() << " m^2." << endl;
cout << "The reference length for force coeffs. is " << config->GetRefLength() << " m." << endl;
cout << "The pressure is decomposed into thermodynamic and dynamic components." << endl;
cout << "The initial value of the dynamic pressure is 0." << endl;
cout << "Mach number: "<< config->GetMach();
if (config->GetKind_FluidModel() == CONSTANT_DENSITY) {
cout << ", computed using the Bulk modulus." << endl;
} else {
cout << ", computed using fluid speed of sound." << endl;
}
cout << "For external flows, the initial state is imposed at the far-field." << endl;
cout << "Angle of attack (deg): "<< config->GetAoA() << ", computed using the initial velocity." << endl;
cout << "Side slip angle (deg): "<< config->GetAoS() << ", computed using the initial velocity." << endl;
if (viscous) {
cout << "Reynolds number per meter: " << config->GetReynolds() << ", computed using initial values."<< endl;
cout << "Reynolds number is a byproduct of inputs only (not used internally)." << endl;
}
cout << "SI units only. The grid should be dimensional (meters)." << endl;
switch (config->GetKind_DensityModel()) {
case INC_DENSITYMODEL::CONSTANT:
if (energy) cout << "Energy equation is active and decoupled." << endl;
else cout << "No energy equation." << endl;
break;
case INC_DENSITYMODEL::BOUSSINESQ:
if (energy) cout << "Energy equation is active and coupled through Boussinesq approx." << endl;
break;
case INC_DENSITYMODEL::VARIABLE:
if (energy) cout << "Energy equation is active and coupled for variable density." << endl;
break;
case INC_DENSITYMODEL::FLAMELET:
cout << "Energy equation is disabled and density is obtained through flamelet manifold." << endl;
break;
}
stringstream NonDimTableOut, ModelTableOut;
stringstream Unit;
cout << endl;
PrintingToolbox::CTablePrinter ModelTable(&ModelTableOut);
ModelTableOut <<"-- Models:"<< endl;
ModelTable.AddColumn("Viscosity Model", 25);
ModelTable.AddColumn("Conductivity Model", 26);
ModelTable.AddColumn("Fluid Model", 25);
ModelTable.SetAlign(PrintingToolbox::CTablePrinter::RIGHT);
ModelTable.PrintHeader();
PrintingToolbox::CTablePrinter NonDimTable(&NonDimTableOut);
NonDimTable.AddColumn("Name", 22);
NonDimTable.AddColumn("Dim. value", 14);
NonDimTable.AddColumn("Ref. value", 14);
NonDimTable.AddColumn("Unit", 10);
NonDimTable.AddColumn("Non-dim. value", 14);
NonDimTable.SetAlign(PrintingToolbox::CTablePrinter::RIGHT);
NonDimTableOut <<"-- Fluid properties:"<< endl;
NonDimTable.PrintHeader();
if (viscous){
switch(config->GetKind_ViscosityModel()){
case VISCOSITYMODEL::CONSTANT:
ModelTable << "CONSTANT_VISCOSITY";
if (config->GetSystemMeasurements() == SI) Unit << "N.s/m^2";
else if (config->GetSystemMeasurements() == US) Unit << "lbf.s/ft^2";
NonDimTable << "Viscosity" << config->GetMu_Constant() << config->GetMu_Constant()/config->GetMu_ConstantND() << Unit.str() << config->GetMu_ConstantND();
Unit.str("");
NonDimTable.PrintFooter();
break;
case VISCOSITYMODEL::FLAMELET:
ModelTable << "FLAMELET";
if (config->GetSystemMeasurements() == SI) Unit << "N.s/m^2";
else if (config->GetSystemMeasurements() == US) Unit << "lbf.s/ft^2";
NonDimTable << "Viscosity" << "--" << "--" << Unit.str() << config->GetMu_ConstantND();
Unit.str("");
NonDimTable.PrintFooter();
break;
case VISCOSITYMODEL::COOLPROP:
ModelTable << "COOLPROP_VISCOSITY";
if (config->GetSystemMeasurements() == SI) Unit << "N.s/m^2";
else if (config->GetSystemMeasurements() == US) Unit << "lbf.s/ft^2";
NonDimTable << "Viscosity" << "--" << "--" << Unit.str() << config->GetMu_ConstantND();
Unit.str("");
NonDimTable.PrintFooter();
break;
case VISCOSITYMODEL::SUTHERLAND:
ModelTable << "SUTHERLAND";
if (config->GetSystemMeasurements() == SI) Unit << "N.s/m^2";
else if (config->GetSystemMeasurements() == US) Unit << "lbf.s/ft^2";
NonDimTable << "Ref. Viscosity" << config->GetMu_Ref() << config->GetViscosity_Ref() << Unit.str() << config->GetMu_RefND();
Unit.str("");
if (config->GetSystemMeasurements() == SI) Unit << "K";
else if (config->GetSystemMeasurements() == US) Unit << "R";
NonDimTable << "Sutherland Temp." << config->GetMu_Temperature_Ref() << config->GetTemperature_Ref() << Unit.str() << config->GetMu_Temperature_RefND();
Unit.str("");
if (config->GetSystemMeasurements() == SI) Unit << "K";
else if (config->GetSystemMeasurements() == US) Unit << "R";
NonDimTable << "Sutherland Const." << config->GetMu_S() << config->GetTemperature_Ref() << Unit.str() << config->GetMu_SND();
Unit.str("");
NonDimTable.PrintFooter();
break;
case VISCOSITYMODEL::POLYNOMIAL:
ModelTable << "POLYNOMIAL_VISCOSITY";
for (iVar = 0; iVar < config->GetnPolyCoeffs(); iVar++) {
stringstream ss;
ss << iVar;
if (config->GetMu_PolyCoeff(iVar) != 0.0)
NonDimTable << "Mu(T) Poly. Coeff. " + ss.str() << config->GetMu_PolyCoeff(iVar) << config->GetMu_PolyCoeff(iVar)/config->GetMu_PolyCoeffND(iVar) << "-" << config->GetMu_PolyCoeffND(iVar);
}
Unit.str("");
NonDimTable.PrintFooter();
break;
}
switch(config->GetKind_ConductivityModel()){
case CONDUCTIVITYMODEL::CONSTANT_PRANDTL:
ModelTable << "CONSTANT_PRANDTL";
NonDimTable << "Prandtl (Lam.)" << "-" << "-" << "-" << config->GetPrandtl_Lam();
Unit.str("");
NonDimTable << "Prandtl (Turb.)" << "-" << "-" << "-" << config->GetPrandtl_Turb();
Unit.str("");
NonDimTable.PrintFooter();
break;
case CONDUCTIVITYMODEL::CONSTANT:
ModelTable << "CONSTANT";
Unit << "W/m^2.K";
NonDimTable << "Molecular Cond." << config->GetThermal_Conductivity_Constant() << config->GetThermal_Conductivity_Constant()/config->GetThermal_Conductivity_ConstantND() << Unit.str() << config->GetThermal_Conductivity_ConstantND();
Unit.str("");
NonDimTable.PrintFooter();
break;
case CONDUCTIVITYMODEL::FLAMELET:
ModelTable << "FLAMELET";
Unit << "W/m^2.K";
NonDimTable << "Molecular Cond." << "--" << "--" << Unit.str() << config->GetThermal_Conductivity_ConstantND();
Unit.str("");
break;
case CONDUCTIVITYMODEL::COOLPROP:
ModelTable << "COOLPROP";
Unit << "W/m^2.K";
NonDimTable << "Molecular Cond." << "--" << "--" << Unit.str() << config->GetThermal_Conductivity_ConstantND();
Unit.str("");
NonDimTable.PrintFooter();
break;
case CONDUCTIVITYMODEL::POLYNOMIAL:
ModelTable << "POLYNOMIAL";
for (iVar = 0; iVar < config->GetnPolyCoeffs(); iVar++) {
stringstream ss;
ss << iVar;
if (config->GetKt_PolyCoeff(iVar) != 0.0)
NonDimTable << "Kt(T) Poly. Coeff. " + ss.str() << config->GetKt_PolyCoeff(iVar) << config->GetKt_PolyCoeff(iVar)/config->GetKt_PolyCoeffND(iVar) << "-" << config->GetKt_PolyCoeffND(iVar);
}
Unit.str("");
NonDimTable.PrintFooter();
break;
}
} else {
ModelTable << "-" << "-";
}
switch (config->GetKind_FluidModel()){
case CONSTANT_DENSITY:
ModelTable << "CONSTANT_DENSITY";
if (energy){
Unit << "N.m/kg.K";
NonDimTable << "Spec. Heat (Cp)" << config->GetSpecific_Heat_Cp() << config->GetSpecific_Heat_Cp()/config->GetSpecific_Heat_CpND() << Unit.str() << config->GetSpecific_Heat_CpND();
Unit.str("");
}
if (boussinesq){
Unit << "K^-1";
NonDimTable << "Thermal Exp." << config->GetThermal_Expansion_Coeff() << config->GetThermal_Expansion_Coeff()/config->GetThermal_Expansion_CoeffND() << Unit.str() << config->GetThermal_Expansion_CoeffND();
Unit.str("");
}
Unit << "Pa";
NonDimTable << "Bulk Modulus" << config->GetBulk_Modulus() << 1.0 << Unit.str() << config->GetBulk_Modulus();
Unit.str("");
NonDimTable.PrintFooter();
break;
case INC_IDEAL_GAS:
ModelTable << "INC_IDEAL_GAS";
Unit << "N.m/kg.K";
NonDimTable << "Spec. Heat (Cp)" << config->GetSpecific_Heat_Cp() << config->GetSpecific_Heat_Cp()/config->GetSpecific_Heat_CpND() << Unit.str() << config->GetSpecific_Heat_CpND();
Unit.str("");
Unit << "g/mol";
NonDimTable << "Molecular weight" << config->GetMolecular_Weight()<< 1.0 << Unit.str() << config->GetMolecular_Weight();
Unit.str("");
Unit << "N.m/kg.K";
NonDimTable << "Gas Constant" << config->GetGas_Constant() << config->GetGas_Constant_Ref() << Unit.str() << config->GetGas_ConstantND();
Unit.str("");
Unit << "Pa";
NonDimTable << "Therm. Pressure" << config->GetPressure_Thermodynamic() << config->GetPressure_Ref() << Unit.str() << config->GetPressure_ThermodynamicND();
Unit.str("");
NonDimTable.PrintFooter();
break;
case FLUID_MIXTURE:
ModelTable << "FLUID_MIXTURE";
Unit << "N.m/kg.K";
NonDimTable << "Spec. Heat (Cp)" << config->GetSpecific_Heat_Cp() << config->GetSpecific_Heat_Cp() / config->GetSpecific_Heat_CpND() << Unit.str() << config->GetSpecific_Heat_CpND();
Unit.str("");
Unit << "g/mol";
NonDimTable << "Molecular weight" << config->GetMolecular_Weight() << 1.0 << Unit.str() << config->GetMolecular_Weight();
Unit.str("");
Unit << "N.m/kg.K";
NonDimTable << "Gas Constant" << config->GetGas_Constant() << config->GetGas_Constant_Ref() << Unit.str() << config->GetGas_ConstantND();
Unit.str("");
Unit << "Pa";
NonDimTable << "Therm. Pressure" << config->GetPressure_Thermodynamic() << config->GetPressure_Ref() << Unit.str() << config->GetPressure_ThermodynamicND();
Unit.str("");
NonDimTable.PrintFooter();
break;
case FLUID_FLAMELET:
ModelTable << "FLAMELET";
Unit << "N.m/kg.K";
NonDimTable << "Spec. Heat (Cp)" << "--" << "--" << Unit.str() << config->GetSpecific_Heat_CpND();
Unit.str("");
Unit << "g/mol";
NonDimTable << "Molecular weight" << "--" << "--" << Unit.str() << config->GetMolecular_Weight();
Unit.str("");
Unit << "N.m/kg.K";
NonDimTable << "Gas Constant" << "--" << config->GetGas_Constant_Ref() << Unit.str() << config->GetGas_ConstantND();
Unit.str("");
Unit << "Pa";
NonDimTable << "Therm. Pressure" << config->GetPressure_Thermodynamic() << config->GetPressure_Ref() << Unit.str() << config->GetPressure_ThermodynamicND();
Unit.str("");
NonDimTable.PrintFooter();
break;
case INC_IDEAL_GAS_POLY:
ModelTable << "INC_IDEAL_GAS_POLY";
Unit.str("");
Unit << "g/mol";
NonDimTable << "Molecular weight" << config->GetMolecular_Weight()<< 1.0 << Unit.str() << config->GetMolecular_Weight();
Unit.str("");
Unit << "N.m/kg.K";
NonDimTable << "Gas Constant" << config->GetGas_Constant() << config->GetGas_Constant_Ref() << Unit.str() << config->GetGas_ConstantND();
Unit.str("");
Unit << "Pa";
NonDimTable << "Therm. Pressure" << config->GetPressure_Thermodynamic() << config->GetPressure_Ref() << Unit.str() << config->GetPressure_ThermodynamicND();
Unit.str("");
for (iVar = 0; iVar < config->GetnPolyCoeffs(); iVar++) {
stringstream ss;
ss << iVar;
if (config->GetCp_PolyCoeff(iVar) != 0.0)
NonDimTable << "Cp(T) Poly. Coeff. " + ss.str() << config->GetCp_PolyCoeff(iVar) << config->GetCp_PolyCoeff(iVar)/config->GetCp_PolyCoeffND(iVar) << "-" << config->GetCp_PolyCoeffND(iVar);
}
Unit.str("");
NonDimTable.PrintFooter();
break;
}
NonDimTableOut <<"-- Initial and free-stream conditions:"<< endl;
NonDimTable.PrintHeader();
if (config->GetSystemMeasurements() == SI) Unit << "Pa";
else if (config->GetSystemMeasurements() == US) Unit << "psf";
NonDimTable << "Dynamic Pressure" << config->GetPressure_FreeStream() << config->GetPressure_Ref() << Unit.str() << config->GetPressure_FreeStreamND();
Unit.str("");
if (config->GetSystemMeasurements() == SI) Unit << "Pa";
else if (config->GetSystemMeasurements() == US) Unit << "psf";
NonDimTable << "Total Pressure" << config->GetPressure_FreeStream() + 0.5*config->GetDensity_FreeStream()*config->GetModVel_FreeStream()*config->GetModVel_FreeStream()
<< config->GetPressure_Ref() << Unit.str() << config->GetPressure_FreeStreamND() + 0.5*config->GetDensity_FreeStreamND()*config->GetModVel_FreeStreamND()*config->GetModVel_FreeStreamND();
Unit.str("");
if (config->GetSystemMeasurements() == SI) Unit << "kg/m^3";
else if (config->GetSystemMeasurements() == US) Unit << "slug/ft^3";
NonDimTable << "Density" << config->GetDensity_FreeStream() << config->GetDensity_Ref() << Unit.str() << config->GetDensity_FreeStreamND();
Unit.str("");
if (energy){
if (config->GetSystemMeasurements() == SI) Unit << "K";
else if (config->GetSystemMeasurements() == US) Unit << "R";
NonDimTable << "Temperature" << config->GetTemperature_FreeStream() << config->GetTemperature_Ref() << Unit.str() << config->GetTemperature_FreeStreamND();
Unit.str("");
}
if (config->GetSystemMeasurements() == SI) Unit << "m/s";
else if (config->GetSystemMeasurements() == US) Unit << "ft/s";
NonDimTable << "Velocity-X" << config->GetVelocity_FreeStream()[0] << config->GetVelocity_Ref() << Unit.str() << config->GetVelocity_FreeStreamND()[0];
NonDimTable << "Velocity-Y" << config->GetVelocity_FreeStream()[1] << config->GetVelocity_Ref() << Unit.str() << config->GetVelocity_FreeStreamND()[1];
if (nDim == 3){
NonDimTable << "Velocity-Z" << config->GetVelocity_FreeStream()[2] << config->GetVelocity_Ref() << Unit.str() << config->GetVelocity_FreeStreamND()[2];
}
NonDimTable << "Velocity Magnitude" << config->GetModVel_FreeStream() << config->GetVelocity_Ref() << Unit.str() << config->GetModVel_FreeStreamND();
Unit.str("");
if (viscous){
NonDimTable.PrintFooter();
if (config->GetSystemMeasurements() == SI) Unit << "N.s/m^2";
else if (config->GetSystemMeasurements() == US) Unit << "lbf.s/ft^2";
NonDimTable << "Viscosity" << config->GetViscosity_FreeStream() << config->GetViscosity_Ref() << Unit.str() << config->GetViscosity_FreeStreamND();
Unit.str("");
if (config->GetSystemMeasurements() == SI) Unit << "W/m^2.K";
else if (config->GetSystemMeasurements() == US) Unit << "lbf/ft.s.R";
NonDimTable << "Conductivity" << "-" << config->GetThermal_Conductivity_Ref() << Unit.str() << "-";
Unit.str("");
if (turbulent){
if (config->GetSystemMeasurements() == SI) Unit << "m^2/s^2";
else if (config->GetSystemMeasurements() == US) Unit << "ft^2/s^2";
NonDimTable << "Turb. Kin. Energy" << config->GetTke_FreeStream() << config->GetTke_FreeStream()/config->GetTke_FreeStreamND() << Unit.str() << config->GetTke_FreeStreamND();
Unit.str("");
if (config->GetSystemMeasurements() == SI) Unit << "1/s";
else if (config->GetSystemMeasurements() == US) Unit << "1/s";
NonDimTable << "Spec. Dissipation" << config->GetOmega_FreeStream() << config->GetOmega_FreeStream()/config->GetOmega_FreeStreamND() << Unit.str() << config->GetOmega_FreeStreamND();
Unit.str("");
}
if (config->GetKind_Species_Model() != SPECIES_MODEL::NONE) {
if (config->GetSystemMeasurements() == SI) Unit << "m^2/s";
else if (config->GetSystemMeasurements() == US) Unit << "ft^2/s";
NonDimTable << "Mass Diffusivity" << config->GetDiffusivity_Constant() << config->GetDiffusivity_Constant()/config->GetDiffusivity_ConstantND() << Unit.str() << config->GetDiffusivity_ConstantND();
Unit.str("");
}
}
NonDimTable.PrintFooter();
NonDimTable << "Mach Number" << "-" << "-" << "-" << config->GetMach();
if (viscous){
NonDimTable << "Reynolds Number" << "-" << "-" << "-" << config->GetReynolds();
}
NonDimTable.PrintFooter();
ModelTable.PrintFooter();
if (unsteady){
NonDimTableOut << "-- Unsteady conditions" << endl;
NonDimTable.PrintHeader();
NonDimTable << "Total Time" << config->GetMax_Time() << config->GetTime_Ref() << "s" << config->GetMax_Time()/config->GetTime_Ref();
Unit.str("");
NonDimTable << "Time Step" << config->GetTime_Step() << config->GetTime_Ref() << "s" << config->GetDelta_UnstTimeND();
Unit.str("");
NonDimTable.PrintFooter();
}
cout << ModelTableOut.str();
cout << NonDimTableOut.str();
}
}
void CIncEulerSolver::SetReferenceValues(const CConfig& config) {
/*--- Evaluate reference values for non-dimensionalization. For dimensional or non-dim
based on initial values, use the far-field state (inf). For a custom non-dim based
on user-provided reference values, use the ref values to compute the forces. ---*/
su2double RefDensity, RefVel2;
if ((config.GetRef_Inc_NonDim() == DIMENSIONAL) ||
(config.GetRef_Inc_NonDim() == INITIAL_VALUES)) {
RefDensity = Density_Inf;
RefVel2 = GeometryToolbox::SquaredNorm(nDim, Velocity_Inf);
}
else {
RefDensity = config.GetInc_Density_Ref();
RefVel2 = pow(config.GetInc_Velocity_Ref(), 2);
}
DynamicPressureRef = 0.5 * RefDensity * RefVel2;
AeroCoeffForceRef = DynamicPressureRef * config.GetRefArea();
}
void CIncEulerSolver::CommonPreprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh,
unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) {
const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);
const bool center = (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED);
const bool center_jst = (config->GetKind_Centered_Flow() == CENTERED::JST) && (iMesh == MESH_0);
const bool outlet = (config->GetnMarker_Outlet() != 0);
/*--- Set the primitive variables ---*/
ompMasterAssignBarrier(ErrorCounter, 0);
SU2_OMP_ATOMIC
ErrorCounter += SetPrimitive_Variables(solver_container, config);
if ((iMesh == MESH_0) && (config->GetComm_Level() == COMM_FULL)) {
BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS
{
unsigned long tmp = ErrorCounter;
SU2_MPI::Allreduce(&tmp, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm());
config->SetNonphysical_Points(ErrorCounter);
}
END_SU2_OMP_SAFE_GLOBAL_ACCESS
}
/*--- Artificial dissipation ---*/
if (center && !Output) {
SetMax_Eigenvalue(geometry, config);
if (center_jst) {
SetCentered_Dissipation_Sensor(geometry, config);
SetUndivided_Laplacian(geometry, config);
}
}
/*--- Update the beta value based on the maximum velocity. ---*/
SetBeta_Parameter(geometry, solver_container, config, iMesh);
/*--- Compute properties needed for mass flow BCs. ---*/
if (outlet) {
SU2_OMP_SAFE_GLOBAL_ACCESS(GetOutlet_Properties(geometry, config, iMesh, Output);)
}
/*--- Initialize the Jacobian matrix and residual, not needed for the reducer strategy
* as we set blocks (including diagonal ones) and completely overwrite. ---*/
if(!ReducerStrategy && !Output) {
LinSysRes.SetValZero();
if (implicit) Jacobian.SetValZero();
else {SU2_OMP_BARRIER} // because of "nowait" in LinSysRes