@@ -556,7 +556,7 @@ subroutine run_shock_problem(prob, thermo, solver, solutions, branch_codes)
556556 type (ShockSolution) :: solution
557557 real (dp) :: T0, P0, u1, mach1
558558 real (dp), allocatable :: weights(:)
559- logical :: incident, input_reflected, frozen, equilibrium, incident_frozen, reflected_frozen, reflected, use_mach
559+ logical :: input_reflected, frozen, equilibrium, incident_frozen, reflected_frozen, reflected, use_mach
560560 logical :: stop_after_branch, branch_failed
561561 integer :: i, k, idx_P, idx_T, npts, num_u1, num_P, num_T
562562 integer , parameter :: BR_INCD_EQ = 1
@@ -585,21 +585,12 @@ subroutine run_shock_problem(prob, thermo, solver, solutions, branch_codes)
585585 products = Mixture(thermo, product_names, ions= prob% problem% include_ions)
586586
587587 ! Get the problem flags
588- if (prob% problem% shk_incident) then
589- incident = .true.
590- else
591- incident = .false.
592- end if
593-
594588 if (prob% problem% shk_reflected) then
595589 input_reflected = .true.
596590 reflected = .true.
597591 else
598592 input_reflected = .false.
599593 reflected = .false.
600- if (.not. incident) then
601- incident = .true. ! Incident by default
602- end if
603594 end if
604595
605596 if (prob% problem% equilibrium) then
@@ -617,29 +608,16 @@ subroutine run_shock_problem(prob, thermo, solver, solutions, branch_codes)
617608 end if
618609 end if
619610
620- ! Match the SHCK branch sequencing. When the input explicitly requests
621- ! incident-shock output (`inc`), CEA2 reports only that incident branch,
622- ! with the reflected state attached if requested. The extra mixed
623- ! equilibrium/frozen permutations are only explored for reflected-only
624- ! request patterns.
625- if (incident) then
626- npts = 1
627- else
628- npts = 0
629- if (equilibrium) then
630- npts = npts + 1
631- if (input_reflected .and. frozen) then
632- npts = npts + 1
633- else if (input_reflected) then
634- ! Equilibrium-only reflected shock prints incident and reflected states together.
635- end if
636- end if
637- if (frozen) then
638- npts = npts + 1
639- if (input_reflected .and. equilibrium) npts = npts + 1
640- end if
641- if (npts == 0 ) npts = 1
642- end if
611+ ! Match the SHCK branch sequencing. Each requested composition model
612+ ! produces an incident branch. A reflected request applies each
613+ ! requested model to every incident branch, so requesting both
614+ ! equilibrium and frozen models produces four incident/reflected
615+ ! combinations.
616+ npts = 0
617+ if (equilibrium) npts = npts + 1
618+ if (frozen) npts = npts + 1
619+ if (npts == 0 ) npts = 1
620+ if (input_reflected) npts = npts* npts
643621
644622 ! Get the loop sizes
645623 num_u1 = 1
@@ -740,7 +718,7 @@ subroutine run_shock_problem(prob, thermo, solver, solutions, branch_codes)
740718 if (.not. solution% converged .and. input_reflected) branch_failed = .true.
741719 end do
742720
743- if (( .not. incident) .and. input_reflected .and. frozen) then
721+ if (input_reflected .and. frozen) then
744722 k = k + 1
745723 branch_codes(k) = BR_REFL_EQ_FROM_EQ
746724 incident_frozen = .false.
@@ -784,7 +762,7 @@ subroutine run_shock_problem(prob, thermo, solver, solutions, branch_codes)
784762 if (input_reflected .and. branch_failed) stop_after_branch = .true.
785763 end if
786764
787- if (frozen .and. .not. stop_after_branch .and. ( .not. incident .or. .not. equilibrium) ) then
765+ if (frozen .and. .not. stop_after_branch) then
788766 k = k + 1
789767 if (input_reflected) then
790768 branch_codes(k) = BR_INCD_FRZ_REFL_FRZ
@@ -1101,7 +1079,9 @@ subroutine shock_output(ioout, prob, solver, solutions, branch_codes)
11011079 have_reflected_state = .false.
11021080 do i = 1 , m
11031081 if (solutions(i, 1 , k)% eq_soln(2 )% T > 0.0d0 ) have_incident_state = .true.
1104- if (solutions(i, 1 , k)% eq_soln(3 )% T > 0.0d0 ) have_reflected_state = .true.
1082+ if (size (solutions(i, 1 , k)% eq_soln) >= 3 ) then
1083+ if (solutions(i, 1 , k)% eq_soln(3 )% T > 0.0d0 ) have_reflected_state = .true.
1084+ end if
11051085 end do
11061086 if (.not. have_incident_state) then
11071087 write_incd_frz = .false.
0 commit comments