#!/usr/bin/env python # coding: utf-8 # ### Exploring effect of Time Resolution on accuracy # # In the examples below, the _time advance_ always remains constant, # but the _number of steps_ used to arrive there vary # # NO log file. # # LAST REVISED: June 4, 2023 # In[1]: import set_path # Importing this module will add the project's home directory to sys.path # In[2]: from src.modules.reactions.reaction_data import ChemData as chem from src.life_1D.bio_sim_1d import BioSim1D # In[3]: def set_initial_condition(): # Set or reset the initial concentrations bio.set_uniform_concentration(species_index=0, conc=0.) bio.inject_conc_to_bin(bin_address=2, species_index=0, delta_conc=10.) # In[4]: chem_data = chem(diffusion_rates=[0.1]) bio = BioSim1D(n_bins=10, chem_data=chem_data) set_initial_condition() bio.describe_state() # In[5]: t_final = 33.3 bio.debug = True bio.diffuse(total_duration=t_final, n_steps=10) set_initial_condition() # Reset the concentrations bio.diffuse(total_duration=t_final, n_steps=20) set_initial_condition() # Reset the concentrations bio.diffuse(total_duration=t_final, n_steps=30) set_initial_condition() # Reset the concentrations bio.diffuse(total_duration=t_final, n_steps=50) set_initial_condition() # Reset the concentrations bio.diffuse(total_duration=t_final, n_steps=100) set_initial_condition() # Reset the concentrations bio.diffuse(total_duration=t_final, n_steps=1000) set_initial_condition() # Reset the concentrations bio.diffuse(total_duration=t_final, n_steps=10000) set_initial_condition() # Reset the concentrations bio.diffuse(total_duration=t_final, n_steps=100000)