Skip to content

Commit

Permalink
Update to demo
Browse files Browse the repository at this point in the history
  • Loading branch information
dbhart committed May 7, 2024
1 parent 5ba02f3 commit 4894e82
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions examples/demos/multisource-cl-decay.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@
"### Add the MSX reaction system information\n",
"This reaction system comes from the EPANET-MSX user manual. There are two species: Free Chlorine and a tracer. The tracer is used to select which decay coefficient is being used. The river is source 1, the lake is source 2.\n",
"\n",
"The amount of free chlorine is based on the rate reaction below, "
"The amount of free chlorine is based on the rate reaction:\n",
"\n",
"$$\n",
" \\frac{d}{dt}\\mathrm{Cl_2} = -(k_1 T + k_2(1-T)) \\mathrm{Cl_2}\n",
"$$"
]
},
{
Expand All @@ -82,15 +86,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"(\"Species(name='CL2', species_type=<SpeciesType.BULK: 1>, units='MG', \"\n",
" \"atol=None, rtol=None, note='Free Chlorine')\")\n"
"Species(name='CL2', species_type=<SpeciesType.BULK: 1>, units='MG', atol=None, rtol=None, note='Free Chlorine')\n"
]
}
],
"source": [
"T1 = wn.msx.add_species('T1','bulk',units='MG', note='Source 1 Tracer')\n",
"Cl2 = wn.msx.add_species('CL2','bulk', units='MG', note='Free Chlorine')\n",
"pprint(repr(Cl2))"
"print(repr(Cl2))"
]
},
{
Expand All @@ -102,14 +105,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"\"Constant(name='k2', value=17.7, units='1/day')\"\n"
"Constant(name='k2', value=17.7, units='1/day')\n"
]
}
],
"source": [
"k1 = wn.msx.add_constant('k1', 1.3, units='1/day')\n",
"k2 = wn.msx.add_constant('k2', 17.7, units='1/day')\n",
"pprint(repr(k2))"
"print(repr(k2))"
]
},
{
Expand All @@ -121,15 +124,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"(\"Reaction(species_name='CL2', expression_type=<ExpressionType.RATE: 2>, \"\n",
" \"expression='-(k1*T1 + k2*(1-T1))*CL2')\")\n"
"Reaction(species_name='CL2', expression_type=<ExpressionType.RATE: 2>, expression='-(k1*T1 + k2*(1-T1))*CL2')\n"
]
}
],
"source": [
"rxn_T1 = wn.msx.add_reaction('T1', 'pipe', 'rate', '0')\n",
"rxn_Cl2 = wn.msx.add_reaction('CL2', 'pipe', 'rate', '-(k1*T1 + k2*(1-T1))*CL2')\n",
"pprint(repr(rxn_Cl2))"
"print(repr(rxn_Cl2))"
]
},
{
Expand All @@ -142,7 +144,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -176,15 +178,15 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Node results: demand, head, pressure, quality, T1, CL2\n",
"Link results: quality, flowrate, velocity, headloss, status, setting, friction_factor, reaction_rate, T1, CL2\n"
"Node results: demand, head, pressure, quality, T1, CL2\n",
"Link results: quality, flowrate, velocity, headloss, status, setting, friction_factor, reaction_rate, T1, CL2\n"
]
}
],
Expand Down

0 comments on commit 4894e82

Please sign in to comment.