diff --git a/view/simulation_fns.py b/view/simulation_fns.py index 0be0c48..3c88f11 100644 --- a/view/simulation_fns.py +++ b/view/simulation_fns.py @@ -36,7 +36,11 @@ def create_single_domain(id_: str) -> Layer: def create_single_layer(id_: str) -> tuple: """Do not forget to rescale the units!""" - demag = [CVector(0, 0, 0), CVector(0, 0, 0), CVector(0, 0, 1)] + demag = [ + CVector(st.session_state[f"Nxx{id_}"] * 1e-6, 0, 0), + CVector(0, st.session_state[f"Nyy{id_}"] * 1e-6, 0), + CVector(0, 0, st.session_state[f"Nzz{id_}"] * 1e-6), + ] Kdir = FieldScan.angle2vector( theta=st.session_state[f"theta_K{id_}"], phi=st.session_state[f"phi_K{id_}"] ) diff --git a/view/streamlit_app.py b/view/streamlit_app.py index 1d03aae..5018a96 100644 --- a/view/streamlit_app.py +++ b/view/streamlit_app.py @@ -132,6 +132,25 @@ def import_session_state(file): key=f"phi_K{i}", help="Azimuthal angle of the anisotropy axis", ) + st.write("Demagnetization field") + st.number_input( + f"Nxx ({i+1})", + value=0.0, + key=f"Nxx{i}", + format="%0.5f", + ) + st.number_input( + f"Nyy ({i+1})", + value=0.0, + key=f"Nyy{i}", + format="%0.5f", + ) + st.number_input( + f"Nzz ({i+1})", + value=1.0, + key=f"Nzz{i}", + format="%0.5f", + ) st.markdown("-----\n") with st.expander("Interlayer parameters"): @@ -310,9 +329,9 @@ def import_session_state(file): st.button("Simulate PIMM", on_click=simulate_pimm, key="PIMM_btn") st.number_input( "Hoe (kA/m)", - min_value=0.05, - max_value=50.0, - value=0.05, + min_value=-500.0, + max_value=500.0, + value=50.0, key="Hoe_mag", help="Magnitude of the Oersted field impulse (PIMM excitation)", )