<jupyter_start><jupyter_text>How to Ideally Toast a Marshmallow<jupyter_code># Configure Jupyter so figures appear in the notebook
%matplotlib inline

# Configure Jupyter to display the assigned value after an assignment
%config InteractiveShell.ast_node_interactivity='last_expr_or_assign'

# import functions from the modsim.py module
from modsim import *
params = Params(
    HRR = , #heat output of fire -- heat release rate
    marsh_absorption = ,
    r_outer = ,
    r_inner = ,
    t_coals = ,
    area_marshmallow = 11.3,  #cm^2
    t_outside = 42   #degrees F
    conv_dec = ,
    )
def make_system(params, d, t_end):
    """Make a system object for the marshmallow model.
    inner is inner temperature of marshmallow
    outer is outer temperature of marshmallow
    
    params is the r and C values for thermal compartments
    d is the distance from the fire
    t_end is when the marshmallow is removed from the fire
    dt is the time step for euler's method
    )
    
    returns: System object
    """
    #initial temperatures are 42 degrees farenheit - outside temp - in kelvin
    t_outside_k = (params.t_outside - 32) * (5/9) + 273.15
    params.t_outside = t_outside_k
    init = State(t_inner=t_outside_k, t_outer=t_outside_k)

    return System(init=init, t0=0, t_end=t_end,
                  params = params, d = d)

#state(outer, inner)
#system(init, t0, t_end, parameters, distance)
def slope_func(state, t, system):
    """Makes the differential equations.
    
    state: State (t_inner, t_outer)
    t: time
    system: System object
    
    returns: didt, dodt
    """
    
    unpack(system)
    # ... = params
    t_inner, t_outer = state
    
    #compute and sum up outer temperature change from radiation and conduction
    dodt_rad = HRR * (area_marshmallow) / (4*pi*(d^2)) * marsh_absorption
    dodt_conv = (r_outer * (t_coals - t_outer))/conv_dec
    if d <= 0.5:
        dodt_cond = r_outer * (t_coals - t_outer)
    else: 
        dodt_cond = 0
    dodt = dodt_rad + dodt_cond
    
    #compute inner temperature change
    didt = r_inner * (t_inner - t_outer)

    return didt, dodt
def plot_results(inner, outer):
    """Plot the inner and outer temperatures of the marshmallow
    
    inner: TimeSeries
    outer: TimeSeries
    
    """
    plot(t_inner, '-', label='Inner Marshmallow Temp')
    plot(t_outer, '-', label='Outer Marshmallow Temp')
    
    decorate(xlabel='Minutes',
             ylabel='Temperature')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08686949559647718, 'fraction_numerical': 0.010008006405124099, 'mean_word_length': 2.9354330708661416, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '276145', 'license': 'MIT', 'n_tokens_mistral': 867, 'n_tokens_neox': 822, 'n_words': 251, 'path': 'code/Marshmallows.ipynb', 'repo_name': 'MellieZito/Project-2', 'size': '2498'}