digraph Algorithm_Flowchart {
rankdir=TB size="8,10"
Start [label=Start shape=ellipse]
Input [label="Input Parameters:
pi, Patm, rho_propellant, total_temp,
R, gamma, burn_rate_coeff, burn_rate_index,
CFL, iter_local_step, iter_limit, iter_limit1,
time_step, P_limit" shape=parallelogram]
Initialize [label="Initialize Variables:
time = 0, iteration = 0, count = 1,
iteration_complete = 0, exit_loop = false" shape=box]
MainLoop [label="Main Loop
(while exit_loop is False)" shape=diamond]
"CalcCpC*" [label="Calculate Cp and C*
Cp = f1(gamma, R)
C* = f2(R, total_temp, gamma)" shape=box]
UpdateTimeProfiles [label="Update Time and Profiles:
time = time + time_step
bx_read, by_read" shape=box]
CalcDiaPort [label="Calculate X, dia, port area:
X = f5(bx_read), dia = f6(by_read)
port_area = f7(pi, dia)" shape=box]
CountIncrement [label="Increment Count
count = count + 1" shape=box]
ExitCheck [label="Check if count >= iter_limit1" shape=diamond]
ExitLoop [label="exit_loop = True" shape=box]
IterLoop [label="Iteration Loop
(for i = 1:iter_limit)" shape=diamond]
UpdateCFL [label="Update CFL Based on i" shape=box]
Predictor [label="Predictor Step:
Compute mass_flux and velocity" shape=box]
Corrector [label="Corrector Step:
Update variables" shape=box]
Convergence [label="Check Convergence
(abs(mass_flow_error) < 5e-4)" shape=diamond]
BreakLoop [label="Exit Iteration Loop" shape=box]
Output [label="Output Results:
Final time, Iterations completed" shape=parallelogram]
End [label=End shape=ellipse]
Start -> Input
Input -> Initialize
Initialize -> MainLoop
MainLoop -> "CalcCpC*"
"CalcCpC*" -> UpdateTimeProfiles
UpdateTimeProfiles -> CalcDiaPort
CalcDiaPort -> CountIncrement
CountIncrement -> ExitCheck
ExitCheck -> ExitLoop [label=Yes]
ExitCheck -> MainLoop [label=No]
ExitLoop -> IterLoop
IterLoop -> UpdateCFL
UpdateCFL -> Predictor
Predictor -> Corrector
Corrector -> Convergence
Convergence -> BreakLoop [label=Yes]
Convergence -> IterLoop [label=No]
BreakLoop -> Output
Output -> End
}