Repository navigation
Add the P1 radiative wall heat flux to TOTAL_HEATFLUX - #3048
pragyaangaur wants to merge 7 commits into
Conversation
With RADIATION_MODEL= P1, TOTAL_HEATFLUX and TOTAL_HEATFLUX_ON_SURFACE only held the conductive heat flux, so the energy balance of a case with radiation did not close. CRadP1Solver now integrates the Marshak wall flux Theta*(G - 4*sigma*Tw^4) over the monitored isothermal and heat flux walls, and the incompressible output adds it to both fields. The p1rad reference values change only in the heat flux, and a regression test for the P1 radiation tutorial is added to tutorials.py.
The conditional operator mixed an AD expression with a double, which does not compile in the forward and reverse mode builds.
|
The I also updated the parallel |
| if (config->GetMarker_All_Monitoring(iMarker) != YES) continue; | ||
|
|
||
| const auto KindBC = config->GetMarker_All_KindBC(iMarker); | ||
| if (KindBC != BC_TYPE::ISOTHERMAL && KindBC != BC_TYPE::HEAT_FLUX) continue; |
There was a problem hiding this comment.
Conjugate heat transfer interfaces are skipped here, but BC_ConjugateHeat_Interface also applies BC_Marshak, and the flow solver counts the conductive flux on CHT_WALL_INTERFACE markers. With P1 radiation and a monitored CHT interface, TOTAL_HEATFLUX_ON_SURFACE stays conductive-only there.
Fix: accept BC_TYPE::CHT_WALL_INTERFACE as well, and take Twall from the flow temperature at the node, as BC_Marshak does for that boundary.
There was a problem hiding this comment.
Done. The radiative flux is now added for ISOTHERMAL, HEAT_FLUX and CHT_WALL_INTERFACE walls, the three wall types where the P1 solver applies the Marshak condition. For heat flux and CHT walls the wall temperature is the flow temperature at the node, as in BC_Marshak, and for isothermal walls it is the one BC_Isothermal_Wall uses. The built-in CHT coupling computes its own interface flux and does not read HeatFlux, so the coupled physics does not change.
| const su2double Theta = Wall_Emissivity / (2.0*(2.0 - Wall_Emissivity)); | ||
| const bool isothermal = (KindBC == BC_TYPE::ISOTHERMAL); | ||
| su2double Twall_iso = 0.0; | ||
| if (isothermal) Twall_iso = config->GetIsothermal_Temperature(Marker_Tag)/config->GetTemperature_Ref(); |
There was a problem hiding this comment.
The radiative flux ends up in different units from the conductive flux it is added to in SetHeatCoefficients. The flow solver's HeatFlux is made dimensional with RefHeatFlux, but here T is divided by Temperature_Ref while STEFAN_BOLTZMANN is dimensional, and the result is never rescaled. For INC_NONDIM = INITIAL_VALUES or REFERENCE_VALUES, Temperature_Ref = T_freestream and the radiative term is off by Temperature_Ref^4 (and other reference factors), so TOTAL_HEATFLUX is a meaningless sum.
Fix: make the radiative term dimensional (consistent with RefHeatFlux) before it is added to the conductive flux, or reject non-dimensional runs that use radiation in CConfig.
There was a problem hiding this comment.
I went with rejecting it. With INC_NONDIM other than DIMENSIONAL, the P1 source term itself already uses the non-dimensional solver temperature with the dimensional Stefan-Boltzmann constant, so the radiation model is inconsistent there and not only its output. CConfig now stops with "RADIATION_MODEL requires INC_NONDIM= DIMENSIONAL." The two P1 test cases and the tutorial are dimensional. In dimensional runs RefHeatFlux is 1, so both parts are in W/m^2.
| if (!isothermal) Twall = solver_container[FLOW_SOL]->GetNodes()->GetTemperature(iPoint); | ||
| const su2double Ib_w = 4.0*STEFAN_BOLTZMANN*pow(Twall, 4.0); | ||
|
|
||
| HF_Local += Theta*(nodes->GetSolution(iPoint, 0) - Ib_w)*Area; |
There was a problem hiding this comment.
For axisymmetric runs the flow solver multiplies each vertex contribution by AxiFactor = 2*pi*y, but the radiative integral uses the plain area. The sum then mixes a revolved conductive flux with a per-radian radiative flux.
Fix: apply the same factor, e.g.
su2double AxiFactor = 1.0;
if (config->GetAxisymmetric()) AxiFactor = 2.0*PI_NUMBER*geometry->nodes->GetCoord(iPoint, 1);
HF_Local += Theta*(nodes->GetSolution(iPoint, 0) - Ib_w)*Area*AxiFactor;There was a problem hiding this comment.
I checked this, and the flow solver applies AxiFactor only to the forces. The heat integral is HF_Visc_Local += HeatFlux[iMarker][iVertex] * Area without it. The radiative flux is now added to HeatFlux[iMarker][iVertex] itself before that line (see the next reply), so the two parts are integrated the same way in axisymmetric runs. Whether the heat integral should get the factor for both is a separate question that I left alone here.
| su2double Total_HF_Rad = 0.0; | ||
| if (rad_solver != nullptr) Total_HF_Rad = rad_solver->GetTotal_HeatFlux_Rad(); | ||
|
|
||
| SetHistoryOutputValue("TOTAL_HEATFLUX", flow_solver->GetTotal_HeatFlux() + Total_HF_Rad); |
There was a problem hiding this comment.
With this change TOTAL_HEATFLUX means different things in the history output and in the objective function: Evaluate_ObjFunc still uses Surface_HF_Visc only, and the per-vertex surface HeatFlux field also leaves radiation out. A discrete adjoint or optimization with OBJECTIVE_FUNCTION = TOTAL_HEATFLUX and radiation on would differentiate a conductive-only value that differs from the history file (about -56 vs -3178 in p1rad).
Fix: include the radiative flux in the objective function and surface fields as well, or give the radiative sum its own output name (e.g. TOTAL_HEATFLUX_RAD) and leave TOTAL_HEATFLUX unchanged.
There was a problem hiding this comment.
Done, by including it everywhere. The radiative flux is now added per vertex to HeatFlux in Friction_Forces, from the current incident radiation, so TOTAL_HEATFLUX, TOTAL_HEATFLUX_ON_SURFACE, the surface HEAT_FLUX field and Evaluate_ObjFunc all see the same value. The changes to the output classes are reverted. I checked the adjoint on p1adjoint with OBJECTIVE_FUNCTION= TOTAL_HEATFLUX and the first FFD variable: the discrete adjoint gives 4619.3 and a finite difference with step 1e-5 gives 4600, within the precision of the printed heat flux. discadj_rht (objective DRAG) still matches its reference gradients.
| if (rad_solver != nullptr) Total_HF_Rad = rad_solver->GetTotal_HeatFlux_Rad(); | ||
|
|
||
| SetHistoryOutputValue("TOTAL_HEATFLUX", flow_solver->GetTotal_HeatFlux() + Total_HF_Rad); | ||
| SetHistoryOutputValue("MAXIMUM_HEATFLUX", flow_solver->GetTotal_MaxHeatFlux()); |
There was a problem hiding this comment.
MAXIMUM_HEATFLUX (and MAXIMUM_HEATFLUX_ON_SURFACE below) stay conductive-only while TOTAL_HEATFLUX next to them now includes radiation. In p1rad most of the heat crosses the wall by radiation, so the maximum describes only a small part of the wall load, and nothing in the output says the two fields cover different physics.
Fix: add the radiative flux to the maximum norm too, or state the difference in the field descriptions.
There was a problem hiding this comment.
This now follows from the change above. MAXIMUM_HEATFLUX and MAXIMUM_HEATFLUX_ON_SURFACE are built from the same HeatFlux, so they include radiation as well. I also added to both field descriptions that they include radiation when a RADIATION_MODEL is used.
| * \brief Integrate the radiative heat flux into the monitored walls. | ||
| * \note The flux follows from the Marshak condition, Theta*(G - 4*sigma*T_w^4), and is positive | ||
| * when the wall absorbs heat, as for the conductive heat flux of the flow solver. |
There was a problem hiding this comment.
This description could be shorter:
| * \brief Integrate the radiative heat flux into the monitored walls. | |
| * \note The flux follows from the Marshak condition, Theta*(G - 4*sigma*T_w^4), and is positive | |
| * when the wall absorbs heat, as for the conductive heat flux of the flow solver. | |
| * \brief Integrate the Marshak radiative heat flux, Theta*(G - 4*sigma*T_w^4), into the monitored walls. | |
| * \note Positive when the wall absorbs heat. |
There was a problem hiding this comment.
Thanks, the function this was on is gone in the rework, but the new GetWallHeatFlux_Rad uses this short description.
The radiative wall flux is now added to HeatFlux in Friction_Forces, so TOTAL_HEATFLUX, MAXIMUM_HEATFLUX, the per-surface values, the surface HEAT_FLUX field and the heat flux objective function all include it, with the same treatment as the conductive flux. It is computed from the current incident radiation on isothermal, heat flux and CHT walls, with the wall temperature that the P1 boundary conditions use. Radiation now requires INC_NONDIM= DIMENSIONAL, since the P1 model uses the dimensional Stefan-Boltzmann constant with the solver temperature.
Proposed Changes
With
RADIATION_MODEL= P1, the wall heat flux of the flow solver only held the conductive part, so the energy balance of a case with radiation could not be checked from the output. This was raised in the review of su2code/Tutorials#90.CRadP1Solver::GetWallHeatFlux_Radreturns the Marshak wall fluxTheta*(G - 4*sigma*Tw^4)at a point, positive when the wall absorbs heat.CSolverhas a virtual that returns zero.Friction_Forcesadds it toHeatFlux[iMarker][iVertex]onISOTHERMAL,HEAT_FLUXandCHT_WALL_INTERFACEwalls, using the current incident radiation and the wall temperature that the P1 boundary conditions use.TOTAL_HEATFLUX,MAXIMUM_HEATFLUX, the per-surface values, the surfaceHEAT_FLUXfield and the heat flux objective function therefore all include radiation, with the same treatment as the conductive flux.CommonPreprocessing.CConfigstops when a radiation model is used withoutINC_NONDIM= DIMENSIONAL, since the P1 model uses the dimensional Stefan-Boltzmann constant with the solver temperature.Verification
OBJECTIVE_FUNCTION= TOTAL_HEATFLUXand the first FFD variable, the discrete adjoint gives 4619.3 and a finite difference with step 1e-5 gives 4600.discadj_rht(objective DRAG) matches its reference gradients.Regression tests
p1rad: the residuals are unchanged and only the heat flux changes, to -3190.6 in the serial test. The walls in this case are black and held at 461 K and 115 K, so most of the heat crosses by radiation.tutorials.py: addsp1_radiation_python, which runsmultiphysics/P1_radiation_pythonfrom the Tutorials repository and checks the RMS residuals, includingRMS_RAD_ENERGY, and the heat flux at iteration 20.PR Checklist
pre-commit run --allto format old commits.