Skip to content

Commit

Permalink
Add Fisher to difficulty-based streamlit
Browse files Browse the repository at this point in the history
  • Loading branch information
Ceyron committed May 23, 2024
1 parent 6cd6b37 commit 9d51dcb
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions understanding_normalized_and_difficulty_nd.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
)
num_points = st.slider("Number of points", 16, 256, 48)
num_steps = st.slider("Number of steps", 1, 300, 50)
num_modes_init = st.slider("Number of modes in the initial condition", 1, 40, 5)
num_modes_init = st.slider("Number of modes in the initial condition", 1, 40, 10)
ic_seed = st.slider("Initial condition seed", 0, 100, 0)
num_substeps = st.slider("Number of substeps", 1, 100, 1)

Expand All @@ -49,6 +49,7 @@
"KdV (hyper-viscous, single-channel-hack)",
"KS (conservative, single-channel-hack)",
"KS (combustion)",
"Fisher-KPP (clamps IC)",
],
)

Expand Down Expand Up @@ -146,6 +147,18 @@
b_2_default_mantisssa = 0.6
b_2_default_exponent = 1
b_2_default_sign = "-"
elif preset_mode == "Fisher-KPP (clamps IC)":
a_0_default_mantisssa = 0.2
a_0_default_exponent = -1
a_0_default_sign = "+"

a_2_default_mantisssa = 0.2
a_2_default_exponent = 0
a_2_default_sign = "+"

b_0_default_mantisssa = 0.2
b_0_default_exponent = -1
b_0_default_sign = "-"

use_difficulty = st.toggle("Use difficulty", value=True)

Expand All @@ -155,7 +168,9 @@
with a_0_cols[1]:
a_0_exponent = st.slider("a_0 exponent", -5, 5, a_0_default_exponent)
with a_0_cols[2]:
a_0_sign = st.select_slider("a_0 sign", options=["-", "+"])
a_0_sign = st.select_slider(
"a_0 sign", options=["-", "+"], value=a_0_default_sign
)
a_0 = float(f"{a_0_sign}{a_0_mantissa}e{a_0_exponent}")

a_1_cols = st.columns(3)
Expand Down Expand Up @@ -284,6 +299,8 @@
ic_gen = ex.ic.RandomTruncatedFourierSeries(
num_spatial_dims, cutoff=num_modes_init, max_one=True
)
if preset_mode == "Fisher-KPP (clamps IC)":
ic_gen = ex.ic.ClampingICGenerator(ic_gen, limits=(0, 1))
u_0 = ic_gen(num_points, key=jax.random.PRNGKey(ic_seed))

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

0 comments on commit 9d51dcb

Please sign in to comment.