Skip to content

Commit

Permalink
Revert some changes from testing
Browse files Browse the repository at this point in the history
  • Loading branch information
emmetfrancis committed Apr 1, 2024
1 parent 317c87a commit 4e49086
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 42 deletions.
39 changes: 4 additions & 35 deletions examples/example3/example3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
"Atot = Parameter(\"Atot\", 1.0, vol_unit)\n",
"# Phosphorylation of Adephos at the PM\n",
"kkin = Parameter(\"kkin\", 50.0, 1/sec)\n",
"curRadius = 2 # first radius value to test\n",
"curRadius = 1 # first radius value to test\n",
"# vol to surface area ratio of the cell (overwritten for each cell size)\n",
"VolSA = Parameter(\"VolSA\", curRadius/3, um)\n",
"r1 = Reaction(\"r1\", [], [\"Aphos\"], param_map={\"kon\": \"kkin\", \"Atot\": \"Atot\", \"VolSA\": \"VolSA\"},\n",
Expand Down Expand Up @@ -366,18 +366,8 @@
"source": [
"# Base mesh\n",
"# 0 in second argument corresponds to no inner sphere\n",
"xSize, ySize, zSize = 20.0, 20.0, 2.0\n",
"domain = d.BoxMesh(d.Point(0.0, 0.0, 0.0), d.Point(xSize, ySize, zSize), 10, 10, 2)\n",
"cell_markers = d.MeshFunction(\"size_t\", domain, 3, 1)\n",
"facet_markers = d.MeshFunction(\"size_t\", domain, 2, 0)\n",
"for f in d.facets(domain):\n",
" x, y, z = f.midpoint()[:]\n",
" if np.isclose(z, 0.) or np.isclose(z, zSize):\n",
" # or np.isclose(y, 0.) or np.isclose(y, ySize)\\\n",
" # or np.isclose(z, 0.) or np.isclose(z, zSize):\n",
" facet_markers[f] = 10\n",
"# domain, facet_markers, cell_markers = mesh_tools.create_spheres(curRadius, 0, hEdge=0.05, hInnerEdge=0.05)\n",
"# visualization.plot_dolfin_mesh(domain, cell_markers, facet_markers)"
"domain, facet_markers, cell_markers = mesh_tools.create_spheres(curRadius, 0, hEdge=0.05, hInnerEdge=0.05)\n",
"visualization.plot_dolfin_mesh(domain, cell_markers, facet_markers)"
]
},
{
Expand Down Expand Up @@ -526,7 +516,7 @@
" # End if we've passed the final time\n",
" if model_cur.t >= model_cur.final_t:\n",
" break\n",
"# visualization.plot(model_cur.sc['Aphos'].u['u'])"
"visualization.plot(model_cur.sc['Aphos'].u['u'])"
]
},
{
Expand Down Expand Up @@ -580,27 +570,6 @@
"print(f\"Current L2 norm is {L2norm}\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "993c1b6a",
"metadata": {},
"outputs": [],
"source": [
"xvec = d.SpatialCoordinate(cc[\"Cyto\"].dolfin_mesh)\n",
"k_kin = kkin.value*VolSA.value\n",
"k_p = kp.value\n",
"cT = Atot.value\n",
"D = Aphos.D\n",
"zFactor = zSize / np.sqrt(D/k_p)\n",
"Az = (k_kin*zSize/(2*D))*np.exp(zFactor) / ((zFactor/2)*(np.exp(zFactor)-1) + (k_kin*zSize/(2*D))*(1+np.exp(zFactor)))\n",
"Bz = (k_kin*zSize/(2*D)) / ((zFactor/2)*(np.exp(zFactor)-1) + (k_kin*zSize/(2*D))*(1+np.exp(zFactor)))\n",
"expFactor = np.sqrt(k_p/(D))\n",
"sol = cT * ((Az*d.exp(-expFactor*xvec[2]) + Bz*d.exp(expFactor*xvec[2])))\n",
"L2norm = d.assemble_mixed((sol-model_cur.sc[\"Aphos\"].u[\"u\"])**2 *dx)\n",
"print(f\"Current L2 norm is {L2norm}\")"
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand Down
4 changes: 2 additions & 2 deletions examples/example3/example3_withaxisymm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
"metadata": {},
"outputs": [],
"source": [
"Aphos = Species(\"Aphos\", 0.1, vol_unit, 0.1, D_unit, \"Cyto\")"
"Aphos = Species(\"Aphos\", 0.1, vol_unit, 10.0, D_unit, \"Cyto\")"
]
},
{
Expand Down Expand Up @@ -367,7 +367,7 @@
"outputs": [],
"source": [
"# Base mesh\n",
"domain, facet_markers, cell_markers = mesh_tools.create_2Dcell(outerExpr=f\"r**2 + (z-({curRadius}+1))**2 - {curRadius}**2\", innerExpr=\"\", hEdge=0.2)\n",
"domain, facet_markers, cell_markers = mesh_tools.create_2Dcell(outerExpr=f\"r**2 + (z-({curRadius}+1))**2 - {curRadius}**2\", innerExpr=\"\", hEdge=0.1)\n",
"visualization.plot_dolfin_mesh(domain, cell_markers)"
]
},
Expand Down
5 changes: 0 additions & 5 deletions smart/model_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -1785,11 +1785,6 @@ def sbmodel_from_locals(local_values):
species = [x for x in local_values if isinstance(x, Species)]
compartments = [x for x in local_values if isinstance(x, Compartment)]
reactions = [x for x in local_values if isinstance(x, Reaction)]
# we just reverse the list so that the order is the same as how they were defined
# parameters.reverse()
# species.reverse()
# compartments.reverse()
# reactions.reverse()
pc.add(parameters)
sc.add(species)
cc.add(compartments)
Expand Down

0 comments on commit 4e49086

Please sign in to comment.