Skip to content

Commit 5f67a0f

Browse files
committed
testcase and handle non dimensional mode
1 parent 881ed0c commit 5f67a0f

File tree

8 files changed

+91
-34
lines changed

8 files changed

+91
-34
lines changed

SU2_CFD/include/solvers/CFEASolver.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,9 @@ class CFEASolver : public CFEASolverBase {
101101
bool body_forces = false; /*!< \brief Whether any body force is active. */
102102

103103
/*!
104-
* \brief Pointer to the heat solver for coupled simulations.
105-
*
106-
* This member stores a pointer to the heat solver, which handles the solution of the heat equation in weakly coupled
107-
* simulations. It is initialized during the preprocessing step if the configuration enables the weak coupling of
108-
* heat and elasticity solvers. This solver provides temperature information to the finite element elasticity solver.
104+
* \brief Pointer to the heat solver nodes to access temperature for coupled simulations.
109105
*/
110-
CSolver* heat_solver = nullptr;
106+
const CVariable* heat_nodes = nullptr;
111107

112108
/*!
113109
* \brief The highest level in the variable hierarchy this solver can safely use,

SU2_CFD/include/solvers/CHeatSolver.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class CHeatSolver final : public CScalarSolver<CHeatVariable> {
4242
static constexpr size_t MAXNVAR = 1; /*!< \brief Max number of variables, for static arrays. */
4343

4444
const bool flow; /*!< \brief Use solver as a scalar transport equation of Temperature for the inc solver. */
45-
const bool heat_equation; /*!< \brief use solver for heat conduction in solids. */
4645

4746
su2double Global_Delta_Time = 0.0, Global_Delta_UnstTimeND = 0.0;
4847

SU2_CFD/include/solvers/CScalarSolver.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,10 +503,10 @@ void CScalarSolver<VariableType>::CompleteImplicitIteration(CGeometry* geometry,
503503
SU2_OMP_FOR_STAT(omp_chunk_size)
504504
for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) {
505505
/*--- Multiply the Solution var with density to get the conservative transported quantity, if necessary. ---*/
506-
/* Note that for consistency with residual and jacobian calaulcations, use of current density for conservative variables
506+
/* Note that for consistency with residual and jacobian calaulcations, use of current density for conservative variables
507507
* of the old solution is used. see pull request https://github.com/su2code/SU2/pull/2458*/
508508
const su2double density = flowNodes->GetDensity(iPoint);
509-
509+
510510
for (unsigned short iVar = 0; iVar < nVar; iVar++) {
511511
nodes->AddClippedSolution(iPoint, iVar, nodes->GetUnderRelaxation(iPoint) * LinSysSol(iPoint, iVar),
512512
lowerlimit[iVar], upperlimit[iVar], density, density);

SU2_CFD/src/output/CHeatOutput.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ void CHeatOutput::LoadHistoryDataImpl(CConfig *config, CGeometry *geometry, CSol
7777
CSolver* heat_solver = solver[HEAT_SOL];
7878

7979
output->SetHistoryOutputValue("TOTAL_HEATFLUX", heat_solver->GetTotal_HeatFlux());
80-
output->SetHistoryOutputValue("MAXIMUM_HEATFLUX", heat_solver->GetTotal_MaxHeatFlux());
8180
output->SetHistoryOutputValue("AVG_TEMPERATURE", heat_solver->GetTotal_AvgTemperature());
8281
output->SetHistoryOutputValue("RMS_TEMPERATURE", log10(heat_solver->GetRes_RMS(0)));
8382
output->SetHistoryOutputValue("MAX_TEMPERATURE", log10(heat_solver->GetRes_Max(0)));
@@ -109,7 +108,6 @@ void CHeatOutput::SetHistoryOutputFieldsImpl(CConfig *config, COutput* output) {
109108
output->AddHistoryOutput("BGS_TEMPERATURE", "bgs[T]", ScreenOutputFormat::FIXED, "BGS_RES", "Block-Gauss-Seidel residual of the temperature", HistoryFieldType::RESIDUAL);
110109

111110
output->AddHistoryOutput("TOTAL_HEATFLUX", "HF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Total heatflux on all surfaces defined in MARKER_MONITORING", HistoryFieldType::COEFFICIENT);
112-
output->AddHistoryOutput("MAXIMUM_HEATFLUX", "MaxHF", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Maximum heatflux on all surfaces defined in MARKER_MONITORING", HistoryFieldType::COEFFICIENT);
113111
output->AddHistoryOutput("AVG_TEMPERATURE", "AvgTemp", ScreenOutputFormat::SCIENTIFIC, "HEAT", "Average temperature on all surfaces defined in MARKER_MONITORING", HistoryFieldType::COEFFICIENT);
114112
output->AddHistoryOutput("CFL_NUMBER", "CFL number", ScreenOutputFormat::SCIENTIFIC, "CFL_NUMBER", "Current value of the CFL number");
115113
}

SU2_CFD/src/solvers/CFEASolver.cpp

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ void CFEASolver::Preprocessing(CGeometry *geometry, CSolver **solver_container,
566566

567567
/*--- Set the pointer to the heat solver so we can access temperatures. ---*/
568568
if (config->GetWeakly_Coupled_Heat()) {
569-
heat_solver = solver_container[HEAT_SOL];
569+
heat_nodes = solver_container[HEAT_SOL]->GetNodes();
570570
}
571571

572572
/*
@@ -652,6 +652,7 @@ void CFEASolver::Compute_StiffMatrix(CGeometry *geometry, CNumerics **numerics,
652652
const bool topology_mode = config->GetTopology_Optimization();
653653
const su2double simp_exponent = config->GetSIMP_Exponent();
654654
const su2double simp_minstiff = config->GetSIMP_MinStiffness();
655+
const su2double t_ref = config->GetTemperature_Ref();
655656

656657
/*--- Start OpenMP parallel region. ---*/
657658

@@ -694,8 +695,8 @@ void CFEASolver::Compute_StiffMatrix(CGeometry *geometry, CNumerics **numerics,
694695
element->SetRef_Coord(iNode, iDim, val_Coord);
695696
element->SetCurr_Coord(iNode, iDim, val_Sol);
696697
}
697-
if (heat_solver) {
698-
element->SetTemperature(iNode, heat_solver->GetNodes()->GetSolution(indexNode[iNode], 0));
698+
if (heat_nodes) {
699+
element->SetTemperature(iNode, heat_nodes->GetSolution(indexNode[iNode], 0) * t_ref);
699700
}
700701
}
701702

@@ -749,6 +750,7 @@ void CFEASolver::Compute_StiffMatrix_NodalStressRes(CGeometry *geometry, CNumeri
749750
const bool topology_mode = config->GetTopology_Optimization();
750751
const su2double simp_exponent = config->GetSIMP_Exponent();
751752
const su2double simp_minstiff = config->GetSIMP_MinStiffness();
753+
const su2double t_ref = config->GetTemperature_Ref();
752754

753755
/*--- Start OpenMP parallel region. ---*/
754756

@@ -804,8 +806,8 @@ void CFEASolver::Compute_StiffMatrix_NodalStressRes(CGeometry *geometry, CNumeri
804806
de_elem->SetRef_Coord(iNode, iDim, val_Coord);
805807
}
806808
}
807-
if (heat_solver) {
808-
fea_elem->SetTemperature(iNode, heat_solver->GetNodes()->GetSolution(indexNode[iNode], 0));
809+
if (heat_nodes) {
810+
fea_elem->SetTemperature(iNode, heat_nodes->GetSolution(indexNode[iNode], 0) * t_ref);
809811
}
810812
}
811813

@@ -890,6 +892,7 @@ void CFEASolver::Compute_MassMatrix(const CGeometry *geometry, CNumerics **numer
890892

891893
const bool topology_mode = config->GetTopology_Optimization();
892894
const su2double simp_minstiff = config->GetSIMP_MinStiffness();
895+
const su2double t_ref = config->GetTemperature_Ref();
893896

894897
/*--- Never record this method as the mass matrix is passive (but the mass residual is not). ---*/
895898
const bool wasActive = AD::BeginPassive();
@@ -930,8 +933,8 @@ void CFEASolver::Compute_MassMatrix(const CGeometry *geometry, CNumerics **numer
930933
su2double val_Coord = Get_ValCoord(geometry, indexNode[iNode], iDim);
931934
element->SetRef_Coord(iNode, iDim, val_Coord);
932935
}
933-
if (heat_solver) {
934-
element->SetTemperature(iNode, heat_solver->GetNodes()->GetSolution(indexNode[iNode], 0));
936+
if (heat_nodes) {
937+
element->SetTemperature(iNode, heat_nodes->GetSolution(indexNode[iNode], 0) * t_ref);
935938
}
936939
}
937940

@@ -980,6 +983,7 @@ void CFEASolver::Compute_MassRes(const CGeometry *geometry, CNumerics **numerics
980983

981984
const bool topology_mode = config->GetTopology_Optimization();
982985
const su2double simp_minstiff = config->GetSIMP_MinStiffness();
986+
const su2double t_ref = config->GetTemperature_Ref();
983987

984988
/*--- Clear vector before calculation. ---*/
985989
TimeRes.SetValZero();
@@ -1014,8 +1018,8 @@ void CFEASolver::Compute_MassRes(const CGeometry *geometry, CNumerics **numerics
10141018
su2double val_Coord = Get_ValCoord(geometry, indexNode[iNode], iDim);
10151019
element->SetRef_Coord(iNode, iDim, val_Coord);
10161020
}
1017-
if (heat_solver) {
1018-
element->SetTemperature(iNode, heat_solver->GetNodes()->GetSolution(indexNode[iNode], 0));
1021+
if (heat_nodes) {
1022+
element->SetTemperature(iNode, heat_nodes->GetSolution(indexNode[iNode], 0) * t_ref);
10191023
}
10201024
}
10211025

@@ -1062,6 +1066,7 @@ void CFEASolver::Compute_NodalStressRes(CGeometry *geometry, CNumerics **numeric
10621066
const bool topology_mode = config->GetTopology_Optimization();
10631067
const su2double simp_exponent = config->GetSIMP_Exponent();
10641068
const su2double simp_minstiff = config->GetSIMP_MinStiffness();
1069+
const su2double t_ref = config->GetTemperature_Ref();
10651070

10661071
/*--- Start OpenMP parallel region. ---*/
10671072

@@ -1111,8 +1116,8 @@ void CFEASolver::Compute_NodalStressRes(CGeometry *geometry, CNumerics **numeric
11111116
element->SetCurr_Coord(iNode, iDim, val_Sol);
11121117
element->SetRef_Coord(iNode, iDim, val_Coord);
11131118
}
1114-
if (heat_solver) {
1115-
element->SetTemperature(iNode, heat_solver->GetNodes()->GetSolution(indexNode[iNode], 0));
1119+
if (heat_nodes) {
1120+
element->SetTemperature(iNode, heat_nodes->GetSolution(indexNode[iNode], 0) * t_ref);
11161121
}
11171122
}
11181123

@@ -1158,6 +1163,7 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics,
11581163
const bool topology_mode = config->GetTopology_Optimization();
11591164
const su2double simp_exponent = config->GetSIMP_Exponent();
11601165
const su2double simp_minstiff = config->GetSIMP_MinStiffness();
1166+
const su2double t_ref = config->GetTemperature_Ref();
11611167

11621168
const auto stressParam = config->GetStressPenaltyParam();
11631169
const su2double stress_scale = 1.0 / stressParam[0];
@@ -1230,8 +1236,8 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics,
12301236
element->SetCurr_Coord(iNode, iDim, val_Sol);
12311237
element->SetRef_Coord(iNode, iDim, val_Coord);
12321238
}
1233-
if (heat_solver) {
1234-
element->SetTemperature(iNode, heat_solver->GetNodes()->GetSolution(indexNode[iNode], 0));
1239+
if (heat_nodes) {
1240+
element->SetTemperature(iNode, heat_nodes->GetSolution(indexNode[iNode], 0) * t_ref);
12351241
}
12361242
}
12371243

@@ -1434,6 +1440,8 @@ void CFEASolver::Compute_NodalStress(CGeometry *geometry, CNumerics **numerics,
14341440

14351441
void CFEASolver::Compute_BodyForces(CGeometry *geometry, CNumerics **numerics, const CConfig *config) {
14361442

1443+
const su2double t_ref = config->GetTemperature_Ref();
1444+
14371445
/*--- Start OpenMP parallel region. ---*/
14381446

14391447
SU2_OMP_PARALLEL
@@ -1473,8 +1481,8 @@ void CFEASolver::Compute_BodyForces(CGeometry *geometry, CNumerics **numerics, c
14731481
su2double val_Coord = Get_ValCoord(geometry, indexNode[iNode], iDim);
14741482
element->SetRef_Coord(iNode, iDim, val_Coord);
14751483
}
1476-
if (heat_solver) {
1477-
element->SetTemperature(iNode, heat_solver->GetNodes()->GetSolution(indexNode[iNode], 0));
1484+
if (heat_nodes) {
1485+
element->SetTemperature(iNode, heat_nodes->GetSolution(indexNode[iNode], 0) * t_ref);
14781486
}
14791487
}
14801488

@@ -3017,6 +3025,7 @@ void CFEASolver::Stiffness_Penalty(CGeometry *geometry, CNumerics **numerics, CC
30173025
PenaltyValue = 0.0;
30183026
return;
30193027
}
3028+
const su2double t_ref = config->GetTemperature_Ref();
30203029

30213030
su2double weightedValue = 0.0;
30223031
su2double weightedValue_reduce = 0.0;
@@ -3048,8 +3057,8 @@ void CFEASolver::Stiffness_Penalty(CGeometry *geometry, CNumerics **numerics, CC
30483057
su2double val_Coord = Get_ValCoord(geometry, indexNode[iNode], iDim);
30493058
element->SetRef_Coord(iNode, iDim, val_Coord);
30503059
}
3051-
if (heat_solver) {
3052-
element->SetTemperature(iNode, heat_solver->GetNodes()->GetSolution(indexNode[iNode], 0));
3060+
if (heat_nodes) {
3061+
element->SetTemperature(iNode, heat_nodes->GetSolution(indexNode[iNode], 0) * t_ref);
30533062
}
30543063
}
30553064

SU2_CFD/src/solvers/CHeatSolver.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ template class CScalarSolver<CHeatVariable>;
3535

3636
CHeatSolver::CHeatSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh)
3737
: CScalarSolver<CHeatVariable>(geometry, config, false),
38-
flow(config->GetFluidProblem()), heat_equation(config->GetHeatProblem()) {
38+
flow(config->GetFluidProblem()) {
3939

4040
/*--- Dimension of the problem --> temperature is the only conservative variable ---*/
4141

@@ -101,14 +101,13 @@ CHeatSolver::CHeatSolver(CGeometry *geometry, CConfig *config, unsigned short iM
101101
/*--- Set the reference values for heat fluxes. If the heat solver runs stand-alone,
102102
* thermal conductivity is read directly from config file ---*/
103103

104-
if (heat_equation) {
104+
if (!flow) {
105105
su2double rho_cp = config->GetMaterialDensity(0)*config->GetSpecific_Heat_Cp();
106106
config->SetThermalDiffusivity(config->GetThermal_Conductivity_Constant() / rho_cp);
107107

108108
/*--- Fluxes are computed via thermal diffusivity (not conductivity), so we have to divide by rho*cp ---*/
109109
config->SetHeat_Flux_Ref(rho_cp*Temperature_Ref);
110-
}
111-
else if (flow) {
110+
} else {
112111
config->SetHeat_Flux_Ref(config->GetViscosity_Ref()*config->GetSpecific_Heat_Cp());
113112
}
114113

@@ -551,8 +550,7 @@ void CHeatSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solv
551550
}
552551
}
553552
END_SU2_OMP_FOR
554-
}
555-
else if (heat_equation) {
553+
} else {
556554
SU2_OMP_FOR_STAT(OMP_MIN_SIZE)
557555
for (auto iVertex = 0ul; iVertex < geometry->nVertex[val_marker]; iVertex++) {
558556

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2+
% SU2 configuration file %
3+
% Case description: 3D beam with thermal expansion %
4+
% File Version 8.1.0 "Harrier" %
5+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6+
7+
SOLVER= ELASTICITY
8+
MATH_PROBLEM= DIRECT
9+
GEOMETRIC_CONDITIONS= SMALL_DEFORMATIONS
10+
MATERIAL_MODEL= LINEAR_ELASTIC
11+
MESH_FILENAME= meshBeam_3d.su2
12+
ELASTICITY_MODULUS=3E7
13+
POISSON_RATIO=0.3
14+
MATERIAL_THERMAL_EXPANSION_COEFF= 2e-5
15+
MATERIAL_REFERENCE_TEMPERATURE= 288.15
16+
MATERIAL_DENSITY=7854
17+
MARKER_CLAMPED= ( left, right )
18+
MARKER_PRESSURE= ( lower, 0, symleft, 0, symright, 0 )
19+
MARKER_LOAD= ( upper, 1, 1000, 0, -1, 0 )
20+
LINEAR_SOLVER= CONJUGATE_GRADIENT
21+
LINEAR_SOLVER_PREC= ILU
22+
LINEAR_SOLVER_ERROR= 1E-8
23+
LINEAR_SOLVER_ITER= 1000
24+
MESH_FORMAT= SU2
25+
TABULAR_FORMAT= CSV
26+
CONV_FILENAME= history_beam
27+
VOLUME_FILENAME= beam
28+
RESTART_FILENAME= restart_beam.dat
29+
SOLUTION_FILENAME= restart_beam.dat
30+
OUTPUT_WRT_FREQ= 1
31+
INNER_ITER=1
32+
33+
% Coupling with heat solver.
34+
WEAKLY_COUPLED_HEAT_EQUATION= YES
35+
FREESTREAM_TEMPERATURE= 300
36+
SPECIFIC_HEAT_CP= 460
37+
THERMAL_CONDUCTIVITY_CONSTANT= 45
38+
% NOTE: These markers a duplicates of "left" and "right" to allow specifying
39+
% boundary conditions for both solvers. This is work in progress.
40+
MARKER_ISOTHERMAL= ( left_heat, 400, right_heat, 300 )
41+
42+
NUM_METHOD_GRAD= GREEN_GAUSS
43+
TIME_DISCRE_HEAT= EULER_IMPLICIT
44+
CFL_NUMBER= 1e8
45+
46+
MARKER_MONITORING= ( left_heat )
47+
SCREEN_OUTPUT= INNER_ITER, RMS_RES, LINSOL, VMS, TOTAL_HEATFLUX
48+

TestCases/parallel_regression.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,6 +1233,15 @@ def main():
12331233
statbeam3d.command = TestCase.Command(exec = "parallel_computation_fsi.py", param = "-f")
12341234
test_list.append(statbeam3d)
12351235

1236+
# Static beam, 3d with coupled temperature
1237+
thermal_beam_3d = TestCase('thermal_beam_3d')
1238+
thermal_beam_3d.cfg_dir = "fea_fsi/ThermalBeam_3d"
1239+
thermal_beam_3d.cfg_file = "configBeam_3d.cfg"
1240+
thermal_beam_3d.test_iter = 0
1241+
thermal_beam_3d.test_vals = [-6.123939, -5.890462, -5.999947, -8.091358, 249, -8.27818, 81, -8.40525, 1.3562e+05, 1.4465e+02]
1242+
thermal_beam_3d.command = TestCase.Command(exec = "parallel_computation_fsi.py", param = "-f")
1243+
test_list.append(thermal_beam_3d)
1244+
12361245
# Rotating cylinder, 3d
12371246
rotating_cylinder_fea = TestCase('rotating_cylinder_fea')
12381247
rotating_cylinder_fea.cfg_dir = "fea_fsi/rotating_cylinder"

0 commit comments

Comments
 (0)