{
"cells": [
{
"cell_type": "markdown",
"id": "f43cd6af-d772-43f7-a4da-30bcc41c7e50",
"metadata": {},
"source": [
"## Diffusion of a bell-shaped initial concentration along an initial gradient\n",
"A single chemical, whose initial concentration is a mix of a bell shape and a gradient. \n",
"Contrary to perhaps an intuition of a \"pile sliding down a sand dune as a unit\", the concentration peak\n",
"remains in place, and simply spreads out from there"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "2b6f0de7-d66f-4f4e-8850-8a092fca20b8",
"metadata": {},
"outputs": [],
"source": [
"LAST_REVISED = \"Nov. 12, 2024\"\n",
"LIFE123_VERSION = \"1.0.0.rc.0\" # Library version this experiment is based on"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "806647d0-4c0b-4abf-8d86-53460378d93e",
"metadata": {},
"outputs": [],
"source": [
"#import set_path # Using MyBinder? Uncomment this before running the next cell!"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "f6e0f263",
"metadata": {},
"outputs": [],
"source": [
"#import sys\n",
"#sys.path.append(\"C:/some_path/my_env_or_install\") # CHANGE to the folder containing your venv or libraries installation!\n",
"# NOTE: If any of the imports below can't find a module, uncomment the lines above, or try: import set_path \n",
"\n",
"from life123 import BioSim1D, ChemData"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "a7c31adc-b1b2-419e-8a09-e049e6a95f5d",
"metadata": {},
"outputs": [],
"source": [
"# Initialize the system\n",
"chem_data = ChemData(names=[\"A\"], diffusion_rates=[10.])\n",
"\n",
"bio = BioSim1D(n_bins=200, chem_data=chem_data)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "c984f746-d373-4a8a-89a4-9c3f0a3fca69",
"metadata": {},
"outputs": [],
"source": [
"# Set up the initial bell-shape concentration, with the peak close to one end of the system\n",
"bio.inject_bell_curve(species_name=\"A\", mean=0.25, sd=0.1, amplitude=20., bias=0)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "b0064638-528f-40a6-9d07-8c4175af16e0",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" \n",
" "
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"hovertemplate": "Bin number=%{x}
[A]=%{y}