Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add docker/jupyter #58

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open

add docker/jupyter #58

wants to merge 3 commits into from

Conversation

scivm
Copy link

@scivm scivm commented Jul 27, 2021

I am working on creating a docker container with a set of aerospace software so analysis can be driven from a jupyter notebook.

So far I have included xfoil, avl and aerosandbox though others that fit can be added.

Sample jupyter notebook that uses aerosandbox and xfoil to create geometry for a plane, perform 2d analysis using xfoil and graph the polars.

reynolds = [10000,20000,30000,50000,100000,150000,200000,300000,500000]
polars = {}
for re in reynolds:
    xf = XFoil(
        airfoil=rg15,
        Re=re,
        max_iter=40
    )
    polars[re] = xf.alpha(np.arange(-3, 9, .25))
from plotly.subplots import make_subplots
import plotly.graph_objects as go
import seaborn as sns

def graphPolars(polars):
    reynolds = polars.keys()
    # setup colors
    increment = 0
    palette = sns.color_palette(None, len(reynolds)).as_hex()
    for re in reynolds:
        reynolds_color[re] = palette[increment]
        increment = increment + 1
    

    # Initialize figure with subplots
    fig = make_subplots(
        rows=3, cols=2, vertical_spacing = 0.07, horizontal_spacing = 0.07, 
        subplot_titles=("CD Vs. CL", "alpha Vs CL", "alpha Vs CM", "xtr_upper Vs CL", "alpha Vs CL/CD")
    )

    # Add traces
    for re in reynolds:
        polar = polars[re]
        fig.add_trace(go.Scatter(x=polar['CD'], y=polar['CL'], name="Re"+str(re), legendgroup="Re" + str(re), line=dict(color=reynolds_color[re])), row=1, col=1)
        fig.add_trace(go.Scatter(x=polar['alpha'], y=polar['CL'], name="Re"+str(re), legendgroup="Re" + str(re), line=dict(color=reynolds_color[re]), showlegend=False), row=1, col=2)
        fig.add_trace(go.Scatter(x=polar['alpha'], y=polar['CM'], name="Re"+str(re), legendgroup="Re" + str(re), line=dict(color=reynolds_color[re]), showlegend=False), row=2, col=1)
        fig.add_trace(go.Scatter(x=polar['xtr_upper'], y=polar['CL'], name="Re"+str(re), legendgroup="Re" + str(re), line=dict(color=reynolds_color[re]), showlegend=False), row=2, col=2)
        fig.add_trace(go.Scatter(x=polar['alpha'], y=polar['CL']/polar['CD'], name="Re"+str(re), legendgroup="Re" + str(re), line=dict(color=reynolds_color[re]), showlegend=False), row=3, col=1)
    
    # Update xaxis properties
    fig.update_xaxes(title_text="CD", row=1, col=1)
    fig.update_xaxes(title_text="alpha", row=1, col=2)
    fig.update_xaxes(title_text="alpha", row=2, col=1)
    fig.update_xaxes(title_text="xtr_upper", row=2, col=2)
    fig.update_xaxes(title_text="alpha", row=3, col=1)

    # Update yaxis properties
    fig.update_yaxes(title_text="CL", row=1, col=1)
    fig.update_yaxes(title_text="CL", row=1, col=2)
    fig.update_yaxes(title_text="CM", row=2, col=1)
    fig.update_yaxes(title_text="CL", row=2, col=2)
    fig.update_yaxes(title_text="CL/CD", row=3, col=1)

    # Update title and height
    fig.update_layout(title_text="Polars", height=1200)
    return fig

polar

@peterdsharpe
Copy link
Owner

Hi Michael,

This looks great!

I'm off the grid for the next week or so (currently out camping), but will be able to review this when I get back.

In the meantime, I wanted to make you aware of the new aerosandbox.AVL that is available in the just-released AeroSandbox 3.1.0! It's an interface between AeroSandbox objects and AVL.

@scivm
Copy link
Author

scivm commented Aug 2, 2021

ok, will take a look and see if I can call avl from jupyter.

I also have openVsp dockerized now in a non gui mode with python api. I can display the openvsp geometry in threejs inside a jupyter notebook by converting it to stl first.

Was thinking to create a geometry importer from openVsp->Aerosandbox if no one else is looking at that. suave has a similar importer and I could modify that code. suave importer

@peterdsharpe peterdsharpe changed the base branch from master to develop May 23, 2023 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants