Skip to content

Commit

Permalink
Add type category of dynamics to streamlit demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Ceyron committed May 13, 2024
1 parent f1ad937 commit 2063354
Showing 1 changed file with 64 additions and 4 deletions.
68 changes: 64 additions & 4 deletions reaction_diffusion_dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
st.divider()

rd_type = st.select_slider(
"Type of Equation", ["FisherKPP", "GrayScott", "SwiftHohenberg"]
"Type of Equation",
["FisherKPP", "GrayScott", "GrayScottType", "SwiftHohenberg"],
)

domain_extent_cols = st.columns(3)
Expand Down Expand Up @@ -85,6 +86,65 @@
feed_rate = st.slider("feed_rate", 0.00, 0.08, 0.008, 0.004, format="%.3f")
kill_rate = st.slider("kill_rate", 0.03, 0.07, 0.046, 0.002, format="%.3f")

st.write("Only displays the second channel")
elif rd_type == "GrayScottType":
gs_type = st.select_slider(
"Type of Gray-Scott",
[
"alpha",
"beta",
"gamma",
"delta",
"epsilon",
"zeta",
"eta",
"theta",
"iota",
"kappa",
"lambda",
"mu",
],
)

if gs_type == "alpha":
feed_rate = 0.008
kill_rate = 0.046
elif gs_type == "beta":
feed_rate = 0.016
kill_rate = 0.040
elif gs_type == "gamma":
feed_rate = 0.024
kill_rate = 0.056
elif gs_type == "delta":
feed_rate = 0.028
kill_rate = 0.056
elif gs_type == "epsilon":
feed_rate = 0.02
kill_rate = 0.056
elif gs_type == "zeta":
feed_rate = 0.024
kill_rate = 0.06
elif gs_type == "eta":
feed_rate = 0.036
kill_rate = 0.063
elif gs_type == "theta":
feed_rate = 0.04
kill_rate = 0.06
elif gs_type == "iota":
feed_rate = 0.05
kill_rate = 0.0605
elif gs_type == "kappa":
feed_rate = 0.04
kill_rate = 0.063
elif gs_type == "lambda":
feed_rate = 0.036
kill_rate = 0.0655
elif gs_type == "mu":
feed_rate = 0.044
kill_rate = 0.066

st.write(f"feed_rate: {feed_rate}")
st.write(f"kill_rate: {kill_rate}")
st.write("Only displays the second channel")
elif rd_type == "SwiftHohenberg":
reactivity = st.slider("reactivity", 0.0, 1.0, 0.7)
Expand Down Expand Up @@ -116,7 +176,7 @@
),
num_substeps,
)
elif rd_type == "GrayScott":
elif rd_type == "GrayScott" or rd_type == "GrayScottType":
stepper = ex.RepeatedStepper(
ex.reaction.GrayScott(
num_spatial_dims,
Expand All @@ -141,7 +201,7 @@
num_substeps,
)

if rd_type == "GrayScott":
if rd_type == "GrayScott" or rd_type == "GrayScottType":
ic_gen = ex.ic.RandomMultiChannelICGenerator(
[
ex.ic.RandomGaussianBlobs(num_spatial_dims, one_complement=True),
Expand All @@ -165,7 +225,7 @@

trj = ex.rollout(stepper, num_steps, include_init=True)(u_0)

if rd_type == "GrayScott":
if rd_type == "GrayScott" or rd_type == "GrayScottType":
trj = trj[:, 1:]


Expand Down

0 comments on commit 2063354

Please sign in to comment.