Skip to content

Commit bc5b399

Browse files
committed
Relax fixed-point tolerance to 1e-6 in point kinetics notebook for 70x speedup
1 parent d90bc85 commit bc5b399

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

docs/source/examples/point_kinetics.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
{
3333
"cell_type": "markdown",
3434
"metadata": {},
35-
"source": "The point kinetics system is very stiff — the prompt neutron generation time $\\Lambda \\sim 10^{-5}\\,\\text{s}$ creates eigenvalues on the order of $10^5$. The variable-order BDF solver GEAR52A is ideal here: it requires only one implicit solve per step and adapts both step size and order to the smooth exponential dynamics.\n\n## 1. Delayed Supercritical Step\n\nInsert a step reactivity of $\\rho = 0.003$ (about $0.46\\beta$). Since $\\rho < \\beta$, the reactor is delayed supercritical — the power rises on a slow time scale governed by the delayed neutrons."
35+
"source": "The point kinetics system is very stiff — the prompt neutron generation time $\\Lambda \\sim 10^{-5}\\,\\text{s}$ creates eigenvalues on the order of $10^5$. The variable-order BDF solver GEAR52A is ideal here: it requires only one implicit solve per step and adapts both step size and order to the smooth exponential dynamics. The default fixed-point tolerance (`1e-9`) is unnecessarily tight for this problem; relaxing it to `1e-6` gives a ~70x speedup with negligible loss in accuracy.\n\n## 1. Delayed Supercritical Step\n\nInsert a step reactivity of $\\rho = 0.003$ (about $0.46\\beta$). Since $\\rho < \\beta$, the reactor is delayed supercritical — the power rises on a slow time scale governed by the delayed neutrons."
3636
},
3737
{
3838
"cell_type": "code",
3939
"execution_count": null,
4040
"metadata": {},
4141
"outputs": [],
42-
"source": "reactor = PointKinetics(n0=1.0)\n\nrho_step = 0.003\nsrc_rho = Source(lambda t: rho_step if t > 0 else 0.0)\nsrc_s = Source(lambda t: 0.0)\nsco = Scope(labels=[\"n\"])\n\nsim = Simulation(\n [src_rho, src_s, reactor, sco],\n [\n Connection(src_rho, reactor), # rho\n Connection(src_s, reactor[1]), # S\n Connection(reactor, sco), # n\n ],\n dt=0.01,\n Solver=GEAR52A,\n log=True,\n)\n\nsim.run(100)"
42+
"source": "reactor = PointKinetics(n0=1.0)\n\nrho_step = 0.003\nsrc_rho = Source(lambda t: rho_step if t > 0 else 0.0)\nsrc_s = Source(lambda t: 0.0)\nsco = Scope(labels=[\"n\"])\n\nsim = Simulation(\n [src_rho, src_s, reactor, sco],\n [\n Connection(src_rho, reactor), # rho\n Connection(src_s, reactor[1]), # S\n Connection(reactor, sco), # n\n ],\n dt=0.01,\n Solver=GEAR52A,\n tolerance_fpi=1e-6,\n log=True,\n)\n\nsim.run(100)"
4343
},
4444
{
4545
"cell_type": "code",
@@ -74,7 +74,7 @@
7474
"execution_count": null,
7575
"metadata": {},
7676
"outputs": [],
77-
"source": "reactor = PointKinetics(n0=1.0)\n\nrho_prompt = 0.008\nsrc_rho = Source(lambda t: rho_prompt if t > 0 else 0.0)\nsrc_s = Source(lambda t: 0.0)\nsco = Scope(labels=[\"n\"])\n\nsim = Simulation(\n [src_rho, src_s, reactor, sco],\n [\n Connection(src_rho, reactor),\n Connection(src_s, reactor[1]),\n Connection(reactor, sco),\n ],\n dt=0.001,\n Solver=GEAR52A,\n log=True,\n)\n\nsim.run(0.5)"
77+
"source": "reactor = PointKinetics(n0=1.0)\n\nrho_prompt = 0.008\nsrc_rho = Source(lambda t: rho_prompt if t > 0 else 0.0)\nsrc_s = Source(lambda t: 0.0)\nsco = Scope(labels=[\"n\"])\n\nsim = Simulation(\n [src_rho, src_s, reactor, sco],\n [\n Connection(src_rho, reactor),\n Connection(src_s, reactor[1]),\n Connection(reactor, sco),\n ],\n dt=0.001,\n Solver=GEAR52A,\n tolerance_fpi=1e-6,\n log=True,\n)\n\nsim.run(0.5)"
7878
},
7979
{
8080
"cell_type": "code",
@@ -111,7 +111,7 @@
111111
"execution_count": null,
112112
"metadata": {},
113113
"outputs": [],
114-
"source": "rho_sub = -0.05\ns_ext = 1e5\nLambda = 1e-5\n\nreactor = PointKinetics(n0=0.001, Lambda=Lambda)\n\nsrc_rho = Source(lambda t: rho_sub)\nsrc_s = Source(lambda t: s_ext)\nsco = Scope(labels=[\"n\"])\n\nsim = Simulation(\n [src_rho, src_s, reactor, sco],\n [\n Connection(src_rho, reactor),\n Connection(src_s, reactor[1]),\n Connection(reactor, sco),\n ],\n dt=0.01,\n Solver=GEAR52A,\n log=True,\n)\n\nsim.run(50)"
114+
"source": "rho_sub = -0.05\ns_ext = 1e5\nLambda = 1e-5\n\nreactor = PointKinetics(n0=0.001, Lambda=Lambda)\n\nsrc_rho = Source(lambda t: rho_sub)\nsrc_s = Source(lambda t: s_ext)\nsco = Scope(labels=[\"n\"])\n\nsim = Simulation(\n [src_rho, src_s, reactor, sco],\n [\n Connection(src_rho, reactor),\n Connection(src_s, reactor[1]),\n Connection(reactor, sco),\n ],\n dt=0.01,\n Solver=GEAR52A,\n tolerance_fpi=1e-6,\n log=True,\n)\n\nsim.run(50)"
115115
},
116116
{
117117
"cell_type": "code",

0 commit comments

Comments
 (0)