<jupyter_start><jupyter_text>L. Viva-Para Lizard Project! By: <NAME> and <NAME><jupyter_code>def make_system(Tenv, K1, K2, K3,depth, delta, dt, side_length, C1, C2, C3, CL, D1, D2, D3, ML):
    """Make a system object for the Lizard model.
    returns: System object
    """
    init = State(Lay1=26.7, Lay2=26.7, Lay3=26.7, L= 26.7)  
    
    t0 = 0
    t_end = 30*(1/dt) #in seconds
    dt = dt

    return System(init=init, t0=t0, t_end=t_end, 
                  Tenv=Tenv, K1=K1, K2=K2, K3=K3,
                  depth=depth, delta=delta, dt=dt, 
                  side_length=side_length, C1=C1, 
                  C2=C2, C3=C3, CL=CL, D1 = D1, D2=D2, 
                  D3=D3, ML=ML)
def update_func(state, t, system):
    """Update the model.  
    returns: State ()     
    """
    unpack(system)
    lay1, lay2, lay3, l = state
   
    #The below four diff EQs represent the rate of heat changing 
    #between the outer layer to the inner layer(lizard)"""

    d1dt = K1*(side_length**3)*(Tenv-lay1)/depth      
    d2dt = K2*((side_length-.0127)**3)*(lay1-lay2)/depth
    d3dt = K3*((side_length-.0254)**3)*(lay2-lay3)/depth
    dLdt = ((side_length-.0381)**3)*0.5*(lay3-l)/(delta/2)
    
    lay1 += (d1dt/(C1*(D1*(side_length**3-(side_length-0.0127)**3))))*dt #these update the temps of each layer
    lay2 += (d2dt/(C2*(D2*((side_length-.0127)**3-(side_length-0.0254)**3))))*dt
    lay3 += (d3dt/(C3*(D3*((side_length-.0254)**3-(side_length-0.381)**3))))*dt
    l += (dLdt/(CL*ML))*dt

    return State(Lay1=lay1, Lay2=lay2, Lay3=lay3, L=l)
def run_simulation(system, update_func):
    """Runs a simulation of the system.     
    system: System object
    update_func: function that updates state    
    returns: TimeFrame
    """
    unpack(system)
    
    frame = TimeFrame(columns=init.index)
    frame.row[t0] = init
    
    for t in linrange(t0, t_end):
        frame.row[t+1] = update_func(frame.row[t], t, system)
    return frame.L
"""Each pair of three lines creates the function, runs the simulation with that particular function, and then plots the results
   Each function has a permutation of the three layers"""

system = make_system(-10, .35, .15, .03, .0127, .0762, 0.1, .2032, 0.24, 0.19, 0.33, 0.899) 
results = run_simulation(system, update_func)
plot(results, label = 'epoxy-soild-styro')

system = make_system(-10, .03, .15, .35, .0127, .0762, 0.1, .2032, 0.33, 0.19, 0.24, 0.899) #.03 = Polystyrene, expanded styrofoam
results = run_simulation(system, update_func)
plot(results, label = 'styro-soil-epoxy')

system = make_system(-10, .15, .03, .35, .0127, .0762, 0.1, .2032, 0.19, 0.33, 0.24, 0.899) #.15 = soil
results = run_simulation(system, update_func)
plot(results, label = 'soil-styro-epoxy')

system = make_system(-10, .35, .03, .15, .0127, .0762, 0.1, .2032, 0.24, 0.33, 0.19, 0.899)
results = run_simulation(system, update_func)
plot(results, label = 'epoxy-styro-soil')

system = make_system(-10, .03, .35, .15, .0127, .0762, 0.1, .2032, 0.33, 0.24, 0.19, 0.899)
results = run_simulation(system, update_func)
plot(results, label = 'styro-epoxy-soil')

system = make_system(-10, .15, .35, .03, .0127, .0762, 0.1, .2032, 0.19, 0.24, 0.33, 0.899)
results = run_simulation(system, update_func)
plot(results, label = 'soil-epoxy-styro')

decorate(xlabel='Time (days)',
         ylabel='Joules',
         title = 'Different Orders of Layers and Lizards Temp')
dQdt =<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17141196978500872, 'fraction_numerical': 0.10052295177222545, 'mean_word_length': 3.183475091130012, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '527620', 'license': 'MIT', 'n_tokens_mistral': 1555, 'n_tokens_neox': 1381, 'n_words': 328, 'path': 'code/Lizards Staying Warm A Little Better-Copy1.ipynb', 'repo_name': 'kgosbee/ModSimPy', 'size': '3458'}