@@ -783,7 +783,7 @@ subroutine RocketSolver_solve_iac(self, soln, reactant_weights, pc, pi_p, subar,
783783 type (RocketSolution), intent (inout ) :: soln
784784 real (dp), intent (in ) :: reactant_weights(:)
785785 real (dp), intent (in ) :: pc ! Chamber pressure [Pa]
786- real (dp), intent (in ) :: pi_p(:) ! Ratio of chamber pressure to exit pressure [unitless]
786+ real (dp), intent (in ), optional :: pi_p(:) ! Ratio of chamber pressure to exit pressure [unitless]
787787 real (dp), intent (in ), optional :: subar(:) ! Subsonic area ratio [unitless]
788788 real (dp), intent (in ), optional :: supar(:) ! Supersonic area ratio [unitless]
789789 integer , intent (in ), optional :: n_frz ! Station where the composition should be frozen
@@ -806,7 +806,8 @@ subroutine RocketSolver_solve_iac(self, soln, reactant_weights, pc, pi_p, subar,
806806 call log_debug(" Starting rocket IAC solve" )
807807
808808 ! Set the total number of evaluation points
809- num_pts = 2 + size (pi_p)
809+ num_pts = 2 ! infinity + throat
810+ if (present (pi_p)) num_pts = num_pts + size (pi_p)
810811 if (present (subar)) num_pts = num_pts + size (subar)
811812 if (present (supar)) num_pts = num_pts + size (supar)
812813
@@ -893,14 +894,19 @@ subroutine RocketSolver_solve_iac(self, soln, reactant_weights, pc, pi_p, subar,
893894 ! -----------------------------------------------
894895 ! Exit conditions: pressure ratio
895896 ! -----------------------------------------------
896- idx = 3
897+ if (present (pi_p)) then
898+ idx = 3
897899
898- if (frozen .and. idx > n_frz_) then
899- call self% solve_pi_p_frozen(soln, idx, n_frz, pc, pi_p, h_inf, 1 )
900+ if (frozen .and. idx > n_frz_) then
901+ call self% solve_pi_p_frozen(soln, idx, n_frz, pc, pi_p, h_inf, 1 )
902+ else
903+ call self% solve_pi_p(soln, idx, pc, pi_p, h_inf, state1, reactant_weights)
904+ end if
905+ if (.not. soln% converged) return
900906 else
901- call self% solve_pi_p(soln, idx, pc, pi_p, h_inf, state1, reactant_weights)
907+ ! If pi_p not present, idx stays at 3 for subsequent sections
908+ idx = 3
902909 end if
903- if (.not. soln% converged) return
904910
905911 ! -----------------------------------------------
906912 ! Exit conditions: subsonic area ratio
@@ -947,7 +953,7 @@ subroutine RocketSolver_solve_fac(self, soln, reactant_weights, pc, pi_p, subar,
947953 type (RocketSolution), intent (inout ) :: soln
948954 real (dp), intent (in ) :: reactant_weights(:)
949955 real (dp), intent (in ) :: pc ! Injector pressure [Pa]
950- real (dp), intent (in ) :: pi_p(:) ! Ratio of chamber pressure to exit pressure [unitless]
956+ real (dp), intent (in ), optional :: pi_p(:) ! Ratio of chamber pressure to exit pressure [unitless]
951957 real (dp), intent (in ), optional :: subar(:) ! Subsonic area ratio [unitless]
952958 real (dp), intent (in ), optional :: supar(:) ! Supersonic area ratio [unitless]
953959 real (dp), intent (in ), optional :: ac_at ! Contraction ratio: ratio of finite chamber area to throat area, Ac/At (FAC only) [unitless]
@@ -994,7 +1000,8 @@ subroutine RocketSolver_solve_fac(self, soln, reactant_weights, pc, pi_p, subar,
9941000 call log_debug(" Starting rocket FAC solve" )
9951001
9961002 ! Set the total number of evaluation points
997- num_pts = 4 + size (pi_p)
1003+ num_pts = 4 ! injector + infinity + combustor + throat
1004+ if (present (pi_p)) num_pts = num_pts + size (pi_p)
9981005 if (present (subar)) num_pts = num_pts + size (subar)
9991006 if (present (supar)) num_pts = num_pts + size (supar)
10001007
@@ -1206,14 +1213,19 @@ subroutine RocketSolver_solve_fac(self, soln, reactant_weights, pc, pi_p, subar,
12061213 ! -----------------------------------------------
12071214 ! Exit conditions: pressure ratio
12081215 ! -----------------------------------------------
1209- idx = 5
1216+ if (present (pi_p)) then
1217+ idx = 5
12101218
1211- if (frozen .and. idx > n_frz_) then
1212- call self% solve_pi_p_frozen(soln, idx, n_frz_, pc, pi_p, h_inj, 2 )
1219+ if (frozen .and. idx > n_frz_) then
1220+ call self% solve_pi_p_frozen(soln, idx, n_frz_, pc, pi_p, h_inj, 2 )
1221+ else
1222+ call self% solve_pi_p(soln, idx, pc, pi_p, h_inj, S_ref, reactant_weights)
1223+ end if
1224+ if (.not. soln% converged) return
12131225 else
1214- call self% solve_pi_p(soln, idx, pc, pi_p, h_inj, S_ref, reactant_weights)
1226+ ! If pi_p not present, idx stays at 5 for subsequent sections
1227+ idx = 5
12151228 end if
1216- if (.not. soln% converged) return
12171229
12181230 ! -----------------------------------------------
12191231 ! Exit conditions: subsonic area ratio
@@ -1264,7 +1276,7 @@ function RocketSolver_solve(self, reactant_weights, pc, pi_p, fac, subar, supar,
12641276 class(RocketSolver), intent (in ) :: self
12651277 real (dp), intent (in ) :: reactant_weights(:) !
12661278 real (dp), intent (in ) :: pc ! Chamber pressure [bar]
1267- real (dp), intent (in ) :: pi_p(:) ! Ratio of chamber pressure to exit pressure [unitless]
1279+ real (dp), intent (in ), optional :: pi_p(:) ! Ratio of chamber pressure to exit pressure [unitless]
12681280 logical , intent (in ), optional :: fac ! Finite-area combustor flag
12691281 real (dp), intent (in ), optional :: subar(:) ! Subsonic area ratio [unitless]
12701282 real (dp), intent (in ), optional :: supar(:) ! Supersonic area ratio [unitless]
@@ -1289,10 +1301,11 @@ function RocketSolver_solve(self, reactant_weights, pc, pi_p, fac, subar, supar,
12891301
12901302 ! Call either the FAC or IAC solver
12911303 if (fac_) then
1292- call self% solve_fac(soln, reactant_weights, pc, pi_p, subar, supar, ac_at, mdot, n_frz, tc_est, hc, tc)
1304+ call self% solve_fac(soln, reactant_weights, pc, pi_p= pi_p, subar= subar, supar= supar, &
1305+ ac_at= ac_at, mdot= mdot, n_frz= n_frz, tc_est= tc_est, hc= hc, tc= tc)
12931306 else ! IAC
1294- call self% solve_iac(soln, reactant_weights, pc, pi_p, subar= subar, supar= supar, n_frz = n_frz , &
1295- tc_est= tc_est, hc= hc, tc= tc)
1307+ call self% solve_iac(soln, reactant_weights, pc, pi_p= pi_p , subar= subar, supar= supar, &
1308+ n_frz = n_frz, tc_est= tc_est, hc= hc, tc= tc)
12961309 end if
12971310
12981311 end function
0 commit comments