Ideal Rocket Performance and TCL demo example calculator, numerical analysis

Ideal Rocket Performance and TCL demo example calculator, numerical analysis

This page is under development. Comments are welcome, but please load any comments in the comments section at the bottom of the page. Please include your wiki MONIKER and date in your comment with the same courtesy that I will give you. Aside from your courtesy, your wiki MONIKER and date as a signature and minimal good faith of any internet post are the rules of this TCL-WIKI. Its very hard to reply reasonably without some background of the correspondent on his WIKI bio page. Thanks,gold 12DEC2018


gold Here are some calculations on Ideal Rocket Performance in TCL. The Ideal Rocket Velocity formula treats no atmospheric drag, uses simple assumptions and formulas. As another accuracy issue, the assumption is that rocket cross section equals nozzle throat area and drag calculation area. Reported different velocity estimates in the program involve different assumptions and formulas. Major velocity loss terms from the ideal rocket performance are 1) drag loss, 2) gravity loss, 3) nozzle efficiency and 4) loss to inefficient trajectory path (subset of drag). In the code, subsequent formulas are changed and different assumptions are changed from the original formulas. The mass ratio (MR)in the program here is launch mass over final burnout mass like m0/mf in ideal velocity formula. Other papers invert or define mass ratio as mf/m0.


Alternate Gist


Alternate Gist. The Ideal Rocket Velocity formula assumes no atmospheric drag and makes simple assumptions and calculations. The formula's accuracy is affected by the assumption that the rocket's cross-sectional area is equal to the nozzle throat area. Different velocity estimates in the program result from different assumptions and formulas. The major velocity loss terms from ideal rocket performance include drag loss, gravity loss, nozzle efficiency, and loss due to inefficient trajectory paths. The mass ratio (MR) in this program is the launch mass divided by the final burnout mass, like m0/mf in the ideal velocity formula. Other papers define mass ratio as mf/m0.


Testcases Section

In planning any software, it is advisable to gather a number of testcases to check the results of the program.

Testcase 1

table 1printed in tcl format
quantity value comment, if any
testcase number:1
16840.0 :initial launch cmass1 kg
7840.0 :final mass2, burnout mass2 kg
225.0 :Isp, specific impulse, seconds
30000.0 :constant thrust, kg*meter/sec*sec
1.0 :optional, rocket diameter, meters:
0.3 :optional, drag_coefficient, for metric units:
0.7853981633974483 :rocket cross_section_area1, meter**2:
1.7814726840855106 :initial acceleration, normalized to gravities:
0.6000000000000001 :rocket_efficiency (ideal!, careful) , no units :
1080.7959482657197 :velocity_if_constant_acceleration (diff. assumptions!, careful) , meters/sec :
1023.5875746663603 :velocity_if__gravity_losses (diff. assumptions!, careful) , meters/sec :
67.50000000000001 :rocket burn out time, Tf, seconds
theoretical_exhaust_velocity $Isp1 $gravity :theoretical_exhaust_velocity, meter/sec
133.33333333333331 :preliminary mass flow rate, kg/second
672.3439628961451 :preliminary average drag loss,abs & assumptions, meters/second
0.5344418052256532 : combined propellant mass (O&F) to launch weight , no units
276948.9250042063 :ballistic_range meters
233983.5836999047 :ballistic_altitude meters
277.31671332224903 :ballistic_duration seconds
2.1479591836734695 :mass ratio, no units
1687.4827405588774 :Ideal Rocket velocity, meters/second

Testcase 2

table 2printed in tcl format
quantity value comment, if any
testcase number:2
13000.0 :initial launch cmass1 kg
6500.0 :final mass2, burnout mass2 kg
237.0 :Isp, specific impulse, seconds
25000.0 :constant thrust, kg*meter/sec*sec
1.0 :optional, rocket diameter, meters:
0.3 :optional, drag_coefficient, for metric units:
0.7853981633974483 :rocket cross_section_area1, meter**2:
1.9230769230769231 :initial acceleration, normalized to gravities:
0.52 :rocket_efficiency (ideal!, careful) , no units :
1060.2278949910894 :velocity_if_constant_acceleration (diff. assumptions!, careful) , meters/sec :
1005.4114415685291 :velocity_if__gravity_losses (diff. assumptions!, careful) , meters/sec :
61.620000000000005 :rocket burn out time, Tf, seconds
theoretical_exhaust_velocity $Isp1 $gravity :theoretical_exhaust_velocity, meter/sec
105.48523206751054 :preliminary mass flow rate, kg/second
725.1287347541687 :preliminary average drag loss,abs & assumptions, meters/second
0.5 : combined propellant mass (O&F) to launch weight , no units
252584.46343323274 :ballistic_range meters
213398.9793971134 :ballistic_altitude meters
264.8375241891135 :ballistic_duration seconds
2.0 :mass ratio, no units
1611.546400386456 :Ideal Rocket velocity, meters/second

Testcase 3

table 3printed in tcl format
quantity value comment, if any
testcase number:3
15000.0 :initial launch cmass1 kg
6500.0 :final mass2, burnout mass2 kg
281.0 :Isp, specific impulse, seconds
25000.0 :constant thrust, kg*meter/sec*sec
1.0 :optional, rocket diameter, meters:
0.3 :optional, drag_coefficient, for metric units:
0.7853981633974483 :rocket cross_section_area1, meter**2:
1.6666666666666667 :initial acceleration, normalized to gravities:
0.6799999999999999 :rocket_efficiency (ideal!, careful) , no units :
1440.756041244792 :velocity_if_constant_acceleration (diff. assumptions!, careful) , meters/sec :
1365.6124090436635 :velocity_if__gravity_losses (diff. assumptions!, careful) , meters/sec :
95.53999999999999 :rocket burn out time, Tf, seconds
theoretical_exhaust_velocity $Isp1 $gravity :theoretical_exhaust_velocity, meter/sec
88.96797153024912 :preliminary mass flow rate, kg/second
1993.7283599257628 :preliminary average drag loss,abs & assumptions, meters/second
0.5666666666666667 : combined propellant mass (O&F) to launch weight , no units
516823.04258630774 :ballistic_range meters
436644.0766693572 :ballistic_altitude meters
378.83241868285285 :ballistic_duration seconds
2.3076923076923075 :mass ratio, no units
2305.209665991667 :Ideal Rocket velocity, meters/second

Screenshots Section

figure 1.

Ideal Rocket Performance png figure 1

figure 2.

Ideal Rocket Performance png figure 2


References:

  • Wikipedia search engine < rocket equation >
  • Wikipedia search engine < Tsiolkovsky rocket equation >
  • Moore, William; of the Military Academy at Woolwich (1813).
  • A Treatise on the Motion of Rockets.
  • WolframAlpha search engine <Tsiolkovsky's rocket equations plot>
  • Peter Baum, A derivation of "the rocket equation"
  • from Newton's laws.
  • NASA, Ideal Rocket Equation, - NASA, k-12/rocket/rktpow.html
  • MIT Lecture, Rocket Equation,16.unified/www/SPRING/propulsion
  • Mathematical-Theory-of-Rocket-Flight,J. BARKLEY ROSSER, PH.D.
  • Elementary_Differential_Equations_-6th_Edition
  • Preliminary Solid Rocket Motor Design, Platzekj

Appendix Code

appendix TCL programs and scripts

        # pretty print from autoindent and ased editor
        # Ideal Rocket Performance calculator
        # Ideal Rocket Velocity treats no atmospheric drag, uses simple
        # assumptions & formulas, other accuracy issues.
        # assumption, rocket cross section == nozzle throat area.
        # Reported different velocity quantities 
        # involve different assumptions and formulas.
        # Major velocity loss terms are 1) drag loss,
        # 2) gravity loss, 3) nozzle efficiency
        # and 4) loss to inefficient trajectory path (subset of drag). 
        # Intention is to estimate various known
        # velocity losses from ideal velocity.
        # Need to collect some rocket examples in metric units.
        # written on Windows XP on TCL
        # working under TCL version 8.6
        # gold on  TCL Club, 6Sep2018
        package require Tk
        namespace path {::tcl::mathop ::tcl::mathfunc}
        frame .frame -relief flat -bg aquamarine4
        pack .frame -side top -fill y -anchor center
        set names {{} {initial mass1, kg :} }
        lappend names {final mass2, burnout mass,  kg  :}
        lappend names {Isp, specific impulse, seconds: }
        lappend names {constant thrust, kg*meter/sec*sec:}
        lappend names {optional, rocket diameter, meters:}
        lappend names {optional, drag_coefficient, for metric units: }
        lappend names {rocket mass ratio, no units: }
        lappend names {Ideal Rocket Velocity, meters per second:}
        foreach i {1 2 3 4 5 6 7 8} {
            label .frame.label$i -text [lindex $names $i] -anchor e
            entry .frame.entry$i -width 35 -textvariable side$i
            grid .frame.label$i .frame.entry$i -sticky ew -pady 2 -padx 1 }
        proc about {} {
            set msg "Calculator for Ideal Rocket Performance
            from TCL "
            tk_messageBox -title "About" -message $msg }
        proc pi {} {expr acos(-1)}
        proc degtoradiansconst {} {return [ expr {180./[pi]}  ]}
        proc radianstodegconst {} {return [ expr {[pi]/180.}  ]}
        proc calculate {     } {
            global answer2
            global side1 side2 side3 side4 side5
            global side6 side7 side8
            global mass1 mass2 Isp1 thrust1 acc_ratio
            global acc_01 mass_ratio1 time_b1 ideal_rocket_velocity1
            global rocket_efficiency1 cross_section_area1
            global velocity_if_constant_acceleration1 velocity_if_gravity_losses1
            global  prelim_flow_rate1 prelim_avg_drag_loss1
            global ballistic_range1 ballistic_altitude1 ballistic_duration1
            global theoretical_exhaust_velocity1 prelim_vertical_velocity1
            global testcase_number
            incr testcase_number
            set side1 [* $side1 1. ]
            set side2 [* $side2 1. ]
            set side3 [* $side3 1. ]
            set side4 [* $side4 1. ]
            set side5 [* $side5 1. ]
            set side6 [* $side6 1. ]
            set side7 [* $side7 1. ]
            set side8 [* $side8 1. ]
            set gravity 9.8
            set mass1 $side1
            set mass2 $side2
            set Isp1 $side3
            set thrust1 $side4
            set diameter1 $side5
            set drag_coefficient1 side6
            # inital assumption == variable acceleration over rocket burn
            proc circlearea2 {diameter} { 
            return  [  expr { 0.25*[pi]*($diameter**2) }]}
            proc ideal_rocket_velocity { gravity Isp1 mass1 mass2} {
            return [ expr { $gravity*$Isp1*log($mass1/$mass2)}]}
            proc mass_ratio {mass1 mass2} {return [ expr { $mass1 / $mass2 }]}
            proc acc_0 {thrust mass1} { return [ expr {  ($thrust*1.) / $mass1 }]}
            proc rocket_efficiency {mass_ratio acc_0} {
            return [expr {(2.*($mass_ratio-1.))/($acc_0*$mass_ratio*1.)}]}
            proc theoretical_exhaust_velocity { Isp1 gravity} {
            return [* $Isp1 $gravity ]  }
            proc time_b {mass_ratio Isp acc_0} {
            return [expr {(($mass_ratio-1.)/($acc_0*$mass_ratio*1.))*$Isp}]}           
            set ideal_rocket_velocity1 [ ideal_rocket_velocity $gravity $Isp1 $mass1 $mass2  ]
            set cross_section_area1 [ circlearea2  $diameter1    ]
            set mass_ratio1 [ mass_ratio $mass1 $mass2  ]
            set acc_01 [ acc_0 $thrust1 $mass1   ]
            set rocket_efficiency1 [ rocket_efficiency $mass_ratio1 $acc_01 ]
            set theoretical_exhaust_velocity1 { theoretical_exhaust_velocity $Isp1 $gravity }
            set time_b1 [ time_b $mass_ratio1 $Isp1 $acc_01 ]
            set prelim_flow_rate1 [/ [- $mass1 $mass2] $time_b1 ]
            # preliminary >> ideal<<<  altitude of
            # assumed vertical launch over burntime,
            # no cross winds & no drag, order of magnitude calc. 
            # & many assumptions, altiude in abs meters
            # assumed constant mass fraction rate expelled,
            # val < flow_rate1 / $mass1 > = fraction/sec
            proc vertical_velocity_no_drag { gravity time_b1 Isp1 prelim_flow_rate1 mass1 } {
            set time $time_b1 
            set mass_fraction_rate [/ $prelim_flow_rate1 $mass1  ]
            set quantity [ expr { $mass1 / ($mass1-$mass1*$mass_fraction_rate*$time)}]
            puts " testing $mass1 $mass_fraction_rate $time "
            set vert_velocity1 1
            set vert_velocity1 [ expr { ($gravity*$Isp1*log($quantity)) - ($gravity*$time) }] 
            return $vert_velocity1}  
            set prelim_vertical_velocity1 1
            set prelim_vertical_velocity1 [ vertical_velocity_no_drag  $gravity $time_b1 $Isp1 $prelim_flow_rate1 $mass1 ]
            # avg_drag_loss is flakey here, 
            # drag_c, combo rel. atmo. pressure,
            # back_pressure, and velocity vary over time.
            # average drag in order of magnitude,
            # in absolute value,  m/s velocity +- 30 percent
            # preliminary average drag loss over burntime,
            # absolute value & many assumptions, meters/second
            set v $ideal_rocket_velocity1
            set prelim_avg_drag_loss1 [* .5  $time_b1 [/ 1. $mass1 ] [* .5 .3 $cross_section_area1  $v $v ]] 
            proc velocity_if_gravity_losses { gravity time_b1 Isp1 mass1 mass2} {
            return [ expr { (9.8*$Isp1*log($mass1/$mass2)) - $gravity*$time_b1 }]}
            set velocity_if_gravity_losses1 [ velocity_if_gravity_losses $gravity $time_b1 $Isp1 $mass1 $mass2 ]
            # >>>>> WARNING!!!!  CHANGING ASSUMPTIONS HERE <<<<<<<
            # following cards change initial assumption ( acc. variable)
            # to constant acceleration rocket.
            # c. acc. rocket. has different velocity profile.
            # uses ratio of initial acceleration over gravity (9.8 m/s*s)
            set acc_ratio [/ [* $acc_01 $gravity] $gravity ]
            proc velocity_constant_acceleration {acc_ratio Isp1 mass1 mass2} {
            return [ expr { 9.8*$Isp1*($acc_ratio/($acc_ratio+1.))*log($mass1/$mass2)}]}
            set velocity_if_constant_acceleration1 [ velocity_constant_acceleration $acc_ratio $Isp1 $mass1 $mass2  ]
            set v $ideal_rocket_velocity1
            set launch_angle [* -1. 45. [degtoradiansconst ] 2.]
            proc ballistic_range { gravity  v  launch_angle} {return [ expr {  $v*$v*sin($launch_angle)/$gravity }]}
            set ballistic_range1 [ ballistic_range  $gravity $v $launch_angle ]
            set launch_angle [*  45. [degtoradiansconst ] ]
            proc ballistic_altitude { gravity  v  launch_angle} {return [ expr {  ($v*$v*sin($launch_angle)*sin($launch_angle))/(2.*$gravity) }]}
            set ballistic_altitude1 [ ballistic_range  $gravity $v $launch_angle ]
            proc ballistic_duration { gravity  v  launch_angle} {return [ expr {  (2.*$v*sin($launch_angle))/$gravity }]}
            set ballistic_duration1 [ ballistic_duration  $gravity $v $launch_angle ]
            # Running out of slots on screen, send other results to reportx proc
            set side7 $mass_ratio1
            set side8 $ideal_rocket_velocity1
        }
        proc fillup {aa bb cc dd ee ff gg hh} {
            .frame.entry1 insert 0 "$aa"
            .frame.entry2 insert 0 "$bb"
            .frame.entry3 insert 0 "$cc"
            .frame.entry4 insert 0 "$dd"
            .frame.entry5 insert 0 "$ee"
            .frame.entry6 insert 0 "$ff"
            .frame.entry7 insert 0 "$gg"
            .frame.entry8 insert 0 "$hh"
        }
        proc clearx {} {
            foreach i {1 2 3 4 5 6 7 8 } {
                .frame.entry$i delete 0 end } }
        proc reportx {} {
            global side1 side2 side3 side4 side5
            global side6 side7 side8
            global mass1 mass2 Isp1 thrust1 acc_ratio
            global acc_01 mass_ratio1 time_b1 ideal_rocket_velocity1
            global rocket_efficiency1 cross_section_area1
            global velocity_if_constant_acceleration1 velocity_if_gravity_losses1
            global  prelim_flow_rate1 prelim_avg_drag_loss1
            global theoretical_exhaust_velocity1 prelim_vertical_velocity1
            global ballistic_range1 ballistic_altitude1 ballistic_duration1
            global testcase_number
            console eval {.console config -bg palegreen}
            console eval {.console config -font {fixed 20 bold}}
            console eval {wm geometry . 40x20}
            console eval {wm title . "Ideal Rocket Performance Report, cut and paste from console 2"}
            console eval {. configure -background orange -highlightcolor brown -relief raised -border 30}
            console show;
            puts "%|table $testcase_number|printed in| tcl format|% "
            puts "&| quantity| value| comment, if any|& "
            puts "&| testcase number:|$testcase_number | |&"
            puts "&| $side1 :|initial launch cmass1 kg |   |&"
            puts "&| $side2 :|final mass2, burnout mass2 kg | |& "
            puts "&| $side3 :|Isp, specific impulse, seconds| |& "
            puts "&| $side4 :|constant thrust, kg*meter/sec*sec| |&"
            puts "&| $side5 :|optional, rocket diameter, meters: | |&"
            puts "&| $side6 :|optional, drag_coefficient, for metric units: | |&"
            puts "&| $cross_section_area1 :|rocket cross_section_area1,  meter**2: | |&"
            puts "&| $acc_01 :|initial acceleration, normalized to gravities: | |&"
            puts "&| $rocket_efficiency1 :|rocket_efficiency (ideal!, careful) , no units : | |&"
            puts "&| $velocity_if_constant_acceleration1 :|velocity_if_constant_acceleration (diff. assumptions!, careful) , meters/sec : | |&"
            puts "&| $velocity_if_gravity_losses1 :|velocity_if__gravity_losses  (diff. assumptions!, careful) , meters/sec : | |&"
            puts "&| $time_b1 :|rocket burn out time, Tf, seconds |  |&"
            puts "&| $theoretical_exhaust_velocity1 :|theoretical_exhaust_velocity, meter/sec |  |&"
            puts "&| $prelim_flow_rate1 :|preliminary mass flow rate, kg/second |  |&"
            puts "&| $prelim_avg_drag_loss1 :|preliminary average drag loss,abs & assumptions, meters/second |  |&"
            puts "&| $prelim_vertical_velocity1 :|preliminary vertical velocity,assumed vertical launch, meters/second |  |&"
            puts "&| $ballistic_range1 :|ballistic_range meters |  |&"
            puts "&| $ballistic_altitude1 :|ballistic_altitude meters |  |&"
            puts "&| $ballistic_duration1 :|ballistic_duration seconds |  |&"
            puts "&| $side7 :|mass ratio, no units |  |&"
            puts "&| $side8 :|Ideal Rocket velocity, meters/second|  |&"
            puts "testing $side1 $side2 $side3 $side4 $side5 $side6 $side7 $side8"
            puts "testing $Isp1 [expr ($acc_ratio/($acc_ratio+1.))] $acc_ratio $acc_01 $mass1 $mass2 "
        }
        frame .buttons -bg aquamarine4
        ::ttk::button .calculator -text "Solve" -command { calculate   }
        ::ttk::button .test2 -text "Testcase1" -command {clearx;fillup 16840. 7840. 225. 30000.0  1.0 0.3 2.2 1680.0}
        ::ttk::button .test3 -text "Testcase2" -command {clearx;fillup 13000. 6500. 237. 25000.0  1.0 0.3 2.2 1614.0}
        ::ttk::button .test4 -text "Testcase3" -command {clearx;fillup 15000. 6500. 225. 25000.0  1.0 0.3 2.3 1850.0}
        ::ttk::button .clearallx -text clear -command {clearx }
        ::ttk::button .about -text about -command about
        ::ttk::button .cons -text report -command { reportx }
        ::ttk::button .exit -text exit -command {exit}
        pack .calculator  -in .buttons -side top -padx 10 -pady 5
        pack  .clearallx .cons .about .exit .test4 .test3 .test2   -side bottom -in .buttons
        grid .frame .buttons -sticky ns -pady {0 10}
        . configure -background aquamarine4 -highlightcolor brown -relief raised -border 30
        wm title . "Ideal Rocket Performance Formula Calculator"
        # This code is copyrighted same as TCL version 8.6
        # 6sep2018 copyrighted under and same as TCL license.
        # Editorial rights and disclaimers 
        # are reserved under TCL license.
        # Gold on  TCL club, 6Sep2018  

Pushbutton Operation

For the push buttons, the recommended procedure is push testcase and fill frame, change first three entries etc, push solve, and then push report. Report allows copy and paste from console. For testcases in a computer session, the eTCL calculator increments a new testcase number internally, eg. TC(1), TC(2) , TC(3) , TC(N). The testcase number is internal to the calculator and will not be printed until the report button is pushed for the current result numbers. The current result numbers will be cleared either on the next clear button or on the next solve button.


Comments Section

Please place any comments here, Thanks, gold 12DEC2018




gold 9/27/2021. Switched some comment signs ;# to #. This a big file. Check earlier editions, if not compatible. Maybe obvious, but this page was written on Windows10 Tcl ports including ActiveTCL. I assume that the reader can cut and paste on screen, what the reader needs, and tootle on to his own project and own contribution pages to the TCL Wiki.