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 autolink to docs #76

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,11 @@
project = "MACH-Aero Documentation"

# -- General configuration -----------------------------------------------------
# Specify the baseurls for the projects I want to link to
repos = [
"pygeo",
"pyoptsparse",
"baseclasses",
"idwarp",
"adflow",
"pyhyp",
"multipoint",
"pyspline",
]
intersphinx_mapping = {r: (f"https://mdolab-{r}.readthedocs-hosted.com/en/latest", None) for r in repos}
# autolink
extensions.extend(["sphinx_codeautolink"])
codeautolink_concat_default = True
codeautolink_warn_on_missing_inventory = True
codeautolink_warn_on_failed_resolve = True

# bibtex
bibtex_bibfiles = [
Expand Down
24 changes: 11 additions & 13 deletions machAeroTutorials/aero_adflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Then copy the code from each of the following sections into this file.
Import libraries
----------------
.. literalinclude:: ../tutorial/aero/analysis/aero_run.py
:language: py
:start-after: # rst Imports
:end-before: # rst ADflow options

Expand All @@ -50,6 +51,7 @@ The ``analysis`` option here will simply run a single ADflow analysis, and the `
ADflow options
--------------
.. literalinclude:: ../tutorial/aero/analysis/aero_run.py
:language: py
:start-after: # rst ADflow options
:end-before: # rst Start ADflow

Expand All @@ -64,6 +66,7 @@ We strongly recommend going over the descriptions and tips on solvers and solver
Create solver
-------------
.. literalinclude:: ../tutorial/aero/analysis/aero_run.py
:language: py
:start-after: # rst Start ADflow
:end-before: # rst Create AeroProblem

Expand All @@ -75,6 +78,7 @@ Also, ADflow can write airfoil data for a given set of slices along the wing usi
Set flow conditions
-------------------
.. literalinclude:: ../tutorial/aero/analysis/aero_run.py
:language: py
:start-after: # rst Create AeroProblem
:end-before: # rst Run ADflow

Expand All @@ -87,6 +91,7 @@ Some available functions include ``'cl'``, ``'cd'``, ``'cmz'``, ``'lift'``, and
Single analysis
---------------
.. literalinclude:: ../tutorial/aero/analysis/aero_run.py
:language: py
:start-after: # rst Run ADflow
:end-before: # rst Create polar arrays

Expand All @@ -103,45 +108,38 @@ The only difference is that the analysis is now done within a loop.


.. literalinclude:: ../tutorial/aero/analysis/aero_run.py
:language: py
:start-after: # rst Create polar arrays
:end-before: # rst Start loop

We start by creating a list of the angle of attack values that we wish to analyze.
In this case we use the ``numpy.linspace`` function to create a uniformly-spaced array with six whole number entries from 0 -- 5.
We also create the empty lists for storing the lift and drag coefficients.
We also create the empty lists for storing the lift and drag coefficients.
The lift and drag data will be appended to these lists as the flow solutions are completed.


.. literalinclude:: ../tutorial/aero/analysis/aero_run.py
:language: py
:start-after: # rst Start loop
:end-before: # rst update AP
:end-before: # rst Print polar

Having created the input array and data storage lists, we can now loop over the desired angles of attack to evaluate the polar.
We accomplish this by using the builtin ``for`` loop structure in python.


.. literalinclude:: ../tutorial/aero/analysis/aero_run.py
:start-after: # rst update AP
:end-before: # rst Run ADflow polar

Now for each angle of attack, we update two attributes of the aero problem.
We update the name to include the current angle of attack.
This allow the filenames of the lift distribution, slices, volume solution and surface solution to be updated with the current angle of attack, making it easier to keep track of the output files.
We also update the alpha parameter, which is the attribute of the AeroProblem that represents the angle of attack.


.. literalinclude:: ../tutorial/aero/analysis/aero_run.py
:start-after: # rst Run ADflow polar
:end-before: # rst Print polar

Running the solver is identical to the simple single point example.
Running the solver is identical to the simple single point example.
We simply call the ``CFDSolver`` instance with the current AeroProblem.
This causes the CFD solver to be updated with the values of that AeroProblem prior to solving the flow.
We then use the same ``EvalFunctions`` call to integrate the surface forces to get the lift and drag coefficients.
The difference is that here, we append the coefficients from ``funcs`` into the ``CLList`` and ``CDList`` variables, so that they can be used later.


.. literalinclude:: ../tutorial/aero/analysis/aero_run.py
:language: py
:start-after: # rst Print polar

Once we complete the loop and evaluate all of the desired flow conditions, we can print the completed data set to the screen.
Expand Down
11 changes: 8 additions & 3 deletions machAeroTutorials/aero_pygeo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ We need to import the pyGeo library in order to use its functions.
The pyGeo library, along with all other MACH libraries, should be importable because its code is located in a directory which is exposed to the system environment variable PYTHON_PATH.

.. literalinclude:: ../tutorial/aero/geometry/generate_wing.py
:language: py
:start-after: # rst Imports
:end-before: # rst Airfoil file

Wing Definition
---------------
.. literalinclude:: ../tutorial/aero/geometry/generate_wing.py
:language: py
:start-after: # rst Airfoil file
:end-before: # rst Wing definition

Expand Down Expand Up @@ -76,12 +78,14 @@ An offset in the x-y plane can be added to this position with the ``offset`` arr
In this case, we don't want to apply any rotation (the rotation options shown below would be for rotation about the airfoil leading edge points and the units are degrees) or offset.

.. literalinclude:: ../tutorial/aero/geometry/generate_wing.py
:language: py
:start-after: # rst Wing definition
:end-before: # rst Run pyGeo

Call pyGeo
----------
.. literalinclude:: ../tutorial/aero/geometry/generate_wing.py
:language: py
:start-after: # rst Run pyGeo
:end-before: # rst Write output files

Expand All @@ -92,11 +96,12 @@ Write output files
------------------
There are three options for writing the geometry surface definition to file.

1. Write a dat file to view wing in Tecplot.
2. Write an IGES file. This can be converted to a TIN file in ICEM.
3. Write a TIN file directly from pyGeo.
#. Write a dat file to view wing in Tecplot.
#. Write an IGES file. This can be converted to a TIN file in ICEM.
#. Write a TIN file directly from pyGeo.

.. literalinclude:: ../tutorial/aero/geometry/generate_wing.py
:language: py
:start-after: # rst Write output files

Run it yourself!
Expand Down
7 changes: 7 additions & 0 deletions machAeroTutorials/aero_pyhyp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Then copy the code from each of the following sections into this file.
Import libraries
----------------
.. literalinclude:: ../tutorial/aero/meshing/volume/run_pyhyp.py
:language: py
:start-after: # rst Imports
:end-before: # rst general

Expand All @@ -45,6 +46,7 @@ Here we will point a few of the more basic options.
For pyHyp, the options can be organized like so:

.. literalinclude:: ../tutorial/aero/meshing/volume/run_pyhyp.py
:language: py
:start-after: # rst general
:end-before: # rst grid

Expand All @@ -68,6 +70,7 @@ General options:
Name given to wall surfaces. If a dictionary is submitted, each wall patch can have a different name. This can help the user to apply certain operations to specific wall patches in ADflow.

.. literalinclude:: ../tutorial/aero/meshing/volume/run_pyhyp.py
:language: py
:start-after: # rst grid
:end-before: # rst pseudo

Expand All @@ -88,21 +91,25 @@ More information can be found in the :doc:`pyHyp documentation <pyhyp:index>`.
For example, ``epsE`` may be of interest when dealing with concave corners.

.. literalinclude:: ../tutorial/aero/meshing/volume/run_pyhyp.py
:language: py
:start-after: # rst pseudo
:end-before: # rst smoothing

.. literalinclude:: ../tutorial/aero/meshing/volume/run_pyhyp.py
:language: py
:start-after: # rst smoothing
:end-before: # rst solution

.. literalinclude:: ../tutorial/aero/meshing/volume/run_pyhyp.py
:language: py
:start-after: # rst solution
:end-before: # rst run pyHyp

Running pyHyp is quite simple, as shown below.
After the mesh extrusion is done, we can write the volume mesh with the ``writeCGNS`` function.

.. literalinclude:: ../tutorial/aero/meshing/volume/run_pyhyp.py
:language: py
:start-after: # rst run pyHyp

Run it yourself!
Expand Down
6 changes: 6 additions & 0 deletions machAeroTutorials/airfoilopt_ffd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,21 @@ Create the following empty runscript in the current directory.
Import Packages
===============
.. literalinclude:: ../tutorial/airfoilopt/ffd/genFFD.py
:language: py
:start-after: # rst Import
:end-before: # rst Load

Load Airfoil
============
.. literalinclude:: ../tutorial/airfoilopt/ffd/genFFD.py
:language: py
:start-after: # rst Load
:end-before: # rst UpperLower

The following two functions are used to get the upper and lower points of the airfoil.

.. literalinclude:: ../tutorial/airfoilopt/ffd/genFFD.py
:language: py
:start-after: # rst UpperLower
:end-before: # rst FFDBox1

Expand All @@ -47,6 +50,7 @@ FFD Box Creation
The FFD box can now be set up.

.. literalinclude:: ../tutorial/airfoilopt/ffd/genFFD.py
:language: py
:start-after: # rst FFDBox1
:end-before: # rst FFDBox2

Expand All @@ -61,6 +65,7 @@ An empty FFD box is created.


.. literalinclude:: ../tutorial/airfoilopt/ffd/genFFD.py
:language: py
:start-after: # rst FFDBox2
:end-before: # rst WriteFile

Expand All @@ -74,6 +79,7 @@ Writing to File
===============

.. literalinclude:: ../tutorial/airfoilopt/ffd/genFFD.py
:language: py
:start-after: # rst WriteFile

Run it yourself!
Expand Down
5 changes: 5 additions & 0 deletions machAeroTutorials/airfoilopt_mesh.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pyHyp runscript
Import the pyHyp libraries and numpy.

.. literalinclude:: ../tutorial/airfoilopt/mesh/genMesh.py
:language: py
:start-after: # rst Import
:end-before: # rst SurfMesh

Expand All @@ -46,6 +47,7 @@ Surface Mesh Generation
=======================

.. literalinclude:: ../tutorial/airfoilopt/mesh/genMesh.py
:language: py
:start-after: # rst SurfMesh
:end-before: # rst GenOptions

Expand All @@ -65,6 +67,7 @@ Options
=======

.. literalinclude:: ../tutorial/airfoilopt/mesh/genMesh.py
:language: py
:start-after: # rst GenOptions
:end-before: # rst GridOptions

Expand All @@ -87,6 +90,7 @@ General Options


.. literalinclude:: ../tutorial/airfoilopt/mesh/genMesh.py
:language: py
:start-after: # rst GridOptions
:end-before: # rst Run

Expand All @@ -108,6 +112,7 @@ Running pyHyp and Writing to File
The following three lines of code extrude the surface mesh and write the resulting volume mesh to a ``.cgns`` file.

.. literalinclude:: ../tutorial/airfoilopt/mesh/genMesh.py
:language: py
:start-after: # rst Run

Run it yourself!
Expand Down
5 changes: 5 additions & 0 deletions machAeroTutorials/airfoilopt_multipoint.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Specifying parameters for the optimization
For multipoint optimization, the parameters have to be specified in lists of the same size.

.. literalinclude:: ../tutorial/airfoilopt/multipoint/airfoil_multiopt.py
:language: py
:start-after: # rst parameters (beg)
:end-before: # rst parameters (end)

Expand All @@ -65,6 +66,7 @@ This is largely unchanged from the single-point case, since we use a very simila
The only difference is in defining the variable ``nGroup`` which is used later on to distinguish between the two AeroProblems.

.. literalinclude:: ../tutorial/airfoilopt/multipoint/airfoil_multiopt.py
:language: py
:start-after: # rst multipoint (beg)
:end-before: # rst multipoint (end)

Expand All @@ -75,6 +77,7 @@ For more than one AeroProblem, a list needs to be created.
Each AeroProblem is created with the respective optimization point and appended to the list.

.. literalinclude:: ../tutorial/airfoilopt/multipoint/airfoil_multiopt.py
:language: py
:start-after: # rst aeroproblem (beg)
:end-before: # rst aeroproblem (end)

Expand All @@ -86,6 +89,7 @@ The lines that require a call to the an AeroProblem is now put into a for-loop t


.. literalinclude:: ../tutorial/airfoilopt/multipoint/airfoil_multiopt.py
:language: py
:start-after: # rst funcs (beg)
:end-before: # rst funcs (end)

Expand All @@ -99,6 +103,7 @@ In addition, we use the ``wrt`` keyword to specify the variables that affect eac
In this case, the ``alpha`` from the other flight conditions do not impact the lift constraint, so they are set to zero.

.. literalinclude:: ../tutorial/airfoilopt/multipoint/airfoil_multiopt.py
:language: py
:start-after: # rst optprob (beg)
:end-before: # rst optprob (end)

Expand Down
Loading