{
"cells": [
{
"cell_type": "markdown",
"id": "29473a1b-493c-40a0-80b6-4873d04b9407",
"metadata": {},
"source": [
"## Diffusion of a bell-shaped initial concentration along a persistent gradient\n",
"Similar to the experiment `diffusion_along_gradient_1`, but now the gradient is NOT an initial condition; rather, it's a persistent dynamic condition (explored in experiment *gradient_1*).\n",
"\n",
"The one-chemical system starts out with a uniform concentration. \n",
"The persistent concentration gradient is attained by continuosly injecting and draining, at opposite ends.\n",
"\n",
"After a stable gradient is established, a one-time injection is performed, to\n",
"add a bell-shape concentration near one end of the system, on the \"uphill\" side of the gradient.\n",
"\n",
"Just as seen in the case of `diffusion_along_gradient_1`, the concentration peak\n",
"remains in place, and simply spreads out from there"
]
},
{
"cell_type": "markdown",
"id": "ac60b210-df99-4660-a428-7405ef79f553",
"metadata": {},
"source": [
"### TAGS : \"diffusion 1D\""
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "eae00b7a-49a4-4c4d-91c8-527c471d24f0",
"metadata": {},
"outputs": [],
"source": [
"LAST_REVISED = \"Dec. 16, 2024\"\n",
"LIFE123_VERSION = \"1.0-rc.1\" # Library version this experiment is based on"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "d73e2c5a-503f-4a6a-823d-e2f90e7efe5d",
"metadata": {},
"outputs": [],
"source": [
"#import set_path # Using MyBinder? Uncomment this before running the next cell!"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "9f96dbc0",
"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\n",
"\n",
"import plotly.express as px\n",
"from life123 import ChemData as chem"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "99ab76d6",
"metadata": {},
"outputs": [],
"source": [
"# Initialize the system with a uniform concentration (of the only species)\n",
"chem_data = chem(names=\"A\", diffusion_rates=3.)\n",
"bio = BioSim1D(n_bins=200, chem_data=chem_data)\n",
"\n",
"bio.set_uniform_concentration(species_index=0, conc=150.)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "d1c3fcac-410b-4f3f-85dd-972964b7e607",
"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}