Skip to content

Commit

Permalink
fix the python case
Browse files Browse the repository at this point in the history
  • Loading branch information
pcarruscag committed Jul 30, 2023
1 parent fa70e1a commit f679db1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void CConjugateHeatInterface::GetDonor_Variable(CSolver *donor_solution, CGeomet
su2double conductivity_over_dist = 0.0;

const bool compressible_flow = (donor_config->GetKind_Regime() == ENUM_REGIME::COMPRESSIBLE);
const bool incompressible_flow = (donor_config->GetKind_Regime() == ENUM_REGIME::INCOMPRESSIBLE) &&
const bool incompressible_flow = (donor_config->GetKind_Regime() == ENUM_REGIME::INCOMPRESSIBLE) &&
(donor_config->GetEnergy_Equation() || (donor_config->GetKind_FluidModel() == ENUM_FLUIDMODEL::FLUID_FLAMELET));

if (compressible_flow) {
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/src/solvers/CIncNSSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void CIncNSSolver::GetStreamwise_Periodic_Properties(const CGeometry *geometry,

const su2double FaceArea = GeometryToolbox::Norm(nDim, AreaNormal);

HeatFlow_Local += FaceArea * (-1.0) * Wall_HeatFlux/config->GetHeat_Flux_Ref();;
HeatFlow_Local += FaceArea * (-1.0) * Wall_HeatFlux/config->GetHeat_Flux_Ref();
} // loop Vertices
} // loop Heatflux marker
} // loop AllMarker
Expand Down
8 changes: 4 additions & 4 deletions TestCases/py_wrapper/custom_heat_flux/run_ad.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def ApplyHeatFlux(time, driver, marker_ids):
for marker_id in marker_ids:
if marker_id < 0:
continue
hf = (-1, 0)[time > 0.2]
hf = (-1 * 2700 * 870, 0)[time > 0.2]
for i_vertex in range(driver.GetNumberMarkerNodes(marker_id)):
driver.SetMarkerCustomNormalHeatFlux(marker_id, i_vertex, hf)

Expand Down Expand Up @@ -228,17 +228,17 @@ def main():
comm = MPI.COMM_WORLD
rank = comm.Get_rank()

obj_pert_size = RunPrimal(0.10002)
obj_pert_size = RunPrimal(0.100005)
obj = RunPrimal(0.1)
sens_size_fd = (obj_pert_size - obj) / 0.00002
sens_size_fd = (obj_pert_size - obj) / 0.000005

sens_size, sens_temp = RunAdjoint(0.1)

if rank == 0:
print(" Finite Differences\tDiscrete Adjoint")
print(f"Size {sens_size_fd}\t{sens_size}")

assert abs(sens_size / sens_size_fd - 1) < 1e-3, "Error in geometric derivatives."
assert abs(sens_size / sens_size_fd - 1) < 1e-4, "Error in geometric derivatives."
# We expect the final average temperature to be directly proportional to the initial
# temperature since the applied heat flux is not a function of temperature.
assert abs(sens_temp - 1) < 1e-5, "Error in initial condition derivatives."
Expand Down

0 comments on commit f679db1

Please sign in to comment.