File size: 1,993 Bytes
1357ed1
 
 
 
 
 
 
 
 
 
 
21c3c90
1357ed1
21c3c90
1357ed1
 
21c3c90
1357ed1
21c3c90
a8d579d
1357ed1
 
 
04c3d9f
a8d579d
91f2caf
1357ed1
21c3c90
1357ed1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21c3c90
1357ed1
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import streamlit as st
from stream_functions import calculate_stream_function, calculate_velocity_field
from visualization import create_flow_visualization, display_equations
from ui_components import create_sidebar_controls
import numpy as np
import matplotlib.pyplot as plt

def main():
    st.set_page_config(page_title="Flow Visualizer", layout="wide")
    
    st.title("Flow Visualizer")
    st.write("""This app aims to improve the understanding through the visualisation of the flow. Streamlines can be thought as the paths taken by a fluid particle and are described using Stream functions (ψ). Stream functions are scalars that describe fluid flow patterns where streamlines are lines of constant ψ. The velocity components can be derived from the stream function as: u = ∂ψ/∂y and v = -∂ψ/∂x """)
    
    # Two columsn
    col1, col2 = st.columns([1, 2])
    
    # Left column
    with col1:
        # Heading for the side bar
        st.subheader("Flow Parameters")
        
        # Get all user inputs and parameters from the controls in the left column
        pattern_type, params, domain_settings, viz_settings = create_sidebar_controls(col1)

        st.subheader("Developers")
        st.write("<a href='https://www.linkedin.com/in/nandurdikarvijay/'>Vijay Nandurdikar</a>", unsafe_allow_html=True)
        
    # Right column
    with col2:
        # Extract domain settings
        domain_size = domain_settings["domain_size"]
        grid_points = domain_settings["grid_points"]
        
        # Create visualization based on user parameters
        create_flow_visualization(
            pattern_type, 
            params, 
            domain_size, 
            grid_points, 
            viz_settings
        )
        
        # Display relevant equations for the selected flow pattern
        # Pass params to display_equations for custom functions
        display_equations(pattern_type, params)

# Main function
if __name__ == "__main__":
    main()