{ "cells": [ { "cell_type": "markdown", "id": "d31149d6-a2ab-45e8-a465-6428937e2086", "metadata": {}, "source": [ "### Exploring effect of Time Resolution on accuracy\n", "\n", "In the examples below, the _time advance_ always remains constant,\n", "but the _number of steps_ used to arrive there vary" ] }, { "cell_type": "markdown", "id": "4e59b390-6f36-4548-92e3-f1601ec4a111", "metadata": {}, "source": [ "### TAGS : \"diffusion 1D\", \"under-the-hood\"" ] }, { "cell_type": "code", "execution_count": 1, "id": "27c384de-cb14-4a12-9c3d-5b2a75e6f4f8", "metadata": {}, "outputs": [], "source": [ "LAST_REVISED = \"May 3, 2025\"\n", "LIFE123_VERSION = \"1.0.0rc3\" # Library version this experiment is based on" ] }, { "cell_type": "code", "execution_count": 2, "id": "f594d956", "metadata": {}, "outputs": [], "source": [ "#import set_path # Using MyBinder? Uncomment this before running the next cell!" ] }, { "cell_type": "code", "execution_count": 3, "id": "5755befb-8156-43cc-bef9-c742a3498e6e", "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, check_version" ] }, { "cell_type": "code", "execution_count": 4, "id": "dca5fbbd-3a21-409e-a2f2-0d866bb5988b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OK\n" ] } ], "source": [ "check_version(LIFE123_VERSION)" ] }, { "cell_type": "code", "execution_count": null, "id": "bf15a069-5683-4a2b-ac3e-31397d069e17", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 5, "id": "baf827af-6cad-4ffb-a7a8-af415113345d", "metadata": {}, "outputs": [], "source": [ "def set_initial_condition():\n", " # Set or reset the initial concentrations\n", " bio.set_uniform_concentration(chem_index=0, conc=0.)\n", " bio.inject_conc_to_bin(bin_address=2, chem_index=0, delta_conc=10.)" ] }, { "cell_type": "code", "execution_count": 6, "id": "e20f3dd6-f5b3-47b7-8846-122ae250640e", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "SYSTEM STATE at Time t = 0:\n", "10 bins and 1 chemical species:\n" ] }, { "data": { "text/html": [ "
| \n", " | Species | \n", "Diff rate | \n", "Bin 0 | \n", "Bin 1 | \n", "Bin 2 | \n", "Bin 3 | \n", "Bin 4 | \n", "Bin 5 | \n", "Bin 6 | \n", "Bin 7 | \n", "Bin 8 | \n", "Bin 9 | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "Chemical 1 | \n", "0.1 | \n", "0.0 | \n", "0.0 | \n", "10.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "