@@ -985,6 +985,10 @@ void CIncEulerSolver::CommonPreprocessing(CGeometry *geometry, CSolver **solver_
985985
986986 SetBeta_Parameter (geometry, solver_container, config, iMesh);
987987
988+ /* --- Update the pressure range in the domain for target outflow mass flow rate. ---*/
989+
990+ SetRange_Pressure (geometry, solver_container, config, iMesh);
991+
988992 /* --- Compute properties needed for mass flow BCs. ---*/
989993
990994 if (outlet) {
@@ -1972,6 +1976,45 @@ void CIncEulerSolver::SetBeta_Parameter(CGeometry *geometry, CSolver **solver_co
19721976
19731977}
19741978
1979+ void CIncEulerSolver::SetRange_Pressure (CGeometry *geometry, CSolver **solver_container,
1980+ CConfig *config, unsigned short iMesh) {
1981+ static su2double MinP,MaxP;
1982+
1983+ if (iMesh == MESH_0) {
1984+ SU2_OMP_MASTER
1985+ MinP = 0.0 ;
1986+ MaxP = 0.0 ;
1987+ END_SU2_OMP_MASTER
1988+ su2double maxP = 0.0 ;
1989+ su2double minP = 0.0 ;
1990+
1991+ SU2_OMP_FOR_STAT (omp_chunk_size)
1992+ for (auto iPoint = 0ul ; iPoint < nPoint; iPoint++) {
1993+ minP = min (minP, nodes->GetPressure (iPoint));
1994+ maxP = max (maxP, nodes->GetPressure (iPoint));
1995+ }
1996+ END_SU2_OMP_FOR
1997+
1998+ SU2_OMP_CRITICAL
1999+ MinP = min (MinP, minP);
2000+ MaxP = max (MaxP, maxP);
2001+ END_SU2_OMP_CRITICAL
2002+
2003+ BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS
2004+ {
2005+ minP = MinP;
2006+ SU2_MPI::Allreduce (&minP, &MinP, 1 , MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm ());
2007+ maxP = MaxP;
2008+ SU2_MPI::Allreduce (&maxP, &MaxP, 1 , MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm ());
2009+
2010+ config->SetRange_Pressure (MinP,MaxP);
2011+
2012+ }
2013+ END_SU2_OMP_SAFE_GLOBAL_ACCESS
2014+ }
2015+
2016+ }
2017+
19752018void CIncEulerSolver::SetPreconditioner (const CConfig *config, unsigned long iPoint,
19762019 su2double delta, su2activematrix& Preconditioner) const {
19772020
@@ -2554,8 +2597,25 @@ void CIncEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
25542597
25552598 dP = 0.5 *Density_Avg*(mDot_Old *mDot_Old - mDot_Target *mDot_Target )/((Density_Avg*Area_Outlet)*(Density_Avg*Area_Outlet));
25562599
2557- /* --- Do not relax when dP is relatively small compared to P itself. ---*/
2558- if (abs (dP) < abs (Damping * P_domain))
2600+ su2double P_domain_min = config->GetRange_Pressure (0 );
2601+ // su2double P_domain_max = config->GetRange_Pressure(1);
2602+ // su2double P_domain_range = P_domain_max - P_domain_min;
2603+
2604+ /* --- Do not relax when dP is relatively small compared to the pressure range dp = (P_max-P_min). ---*/
2605+
2606+ /*
2607+ We take the entire range of pressures and we check the relative P and the relative dp
2608+ 1. is it sufficient to subtract the min pressure?
2609+ range [0..1]
2610+ range [-1..0]
2611+ range [0..10]
2612+ range [-10..0]
2613+ range [10..11]
2614+ range [-11..10]]
2615+ */
2616+
2617+ // if (abs(dP) < abs(Damping * (P_domain-P_domain_min)/P_domain_range))
2618+ if (abs (dP) < abs (Damping * (P_domain-P_domain_min)))
25592619 Damping = 1.0 ;
25602620
25612621 P_Outlet = P_domain + Damping * dP;
0 commit comments