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

Overset tut #23

Merged
merged 39 commits into from
Mar 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
0d0bbd3
moved OversetTut from MACH-Aero-tuts
DavidAnderegg Nov 25, 2020
4370283
created new branch
DavidAnderegg Nov 25, 2020
10c5b22
created VSP tut
DavidAnderegg Nov 26, 2020
13bd810
WIP Pointwise tut
DavidAnderegg Nov 27, 2020
78fc814
WIP pointwise part
DavidAnderegg Nov 27, 2020
6f0ecf7
finished 'near_wing' mesh
DavidAnderegg Nov 30, 2020
b58258a
WIP
DavidAnderegg Nov 30, 2020
292d560
WIP
DavidAnderegg Dec 1, 2020
9999fc4
WIP
DavidAnderegg Dec 2, 2020
c4a937a
WIP
DavidAnderegg Dec 2, 2020
03ee8a7
WIP
DavidAnderegg Dec 2, 2020
3ca7888
Started working on CFD Analysis
DavidAnderegg Dec 3, 2020
01efaf0
Started working on the ADflow part
DavidAnderegg Dec 11, 2020
7a4941e
Finished surface mesh tut
DavidAnderegg Dec 11, 2020
6a99e9a
Finished analysis part
DavidAnderegg Dec 11, 2020
8706250
Clean up
DavidAnderegg Dec 18, 2020
eeb5c58
Merge remote-tracking branch 'mdolab/master' into overset_tut
ewu63 Dec 21, 2020
efc9390
Fixed Ref Error and some minor misc stuff
DavidAnderegg Jan 4, 2021
1698586
Merge branch 'overset_tut' of https://github.com/DavidAnderegg/MACH-A…
DavidAnderegg Jan 4, 2021
d0cab43
Incorpurated the changes @marcomangano suggested
DavidAnderegg Jan 6, 2021
2a17dc9
fixed some typos
DavidAnderegg Jan 6, 2021
f3dc3f3
renamed overset overview file
anilyil Feb 14, 2021
c726651
edits to the overview file
anilyil Feb 14, 2021
c89c526
changes to gitignore
anilyil Feb 14, 2021
af9bbaa
compressed figure. working on overset theory
anilyil Feb 14, 2021
533bfab
added neys tips and edited overset theory
anilyil Feb 14, 2021
1d16a02
spell check
anilyil Feb 14, 2021
c4812f7
final few edits
anilyil Feb 14, 2021
bbe4e89
compressed overset zipper figure
anilyil Feb 14, 2021
f714ac6
updated the overset theory to include all of the material from Ney's …
anilyil Mar 17, 2021
b32d1c4
addressing comments
anilyil Mar 19, 2021
69a1bda
fixed 'iblank' statement and
DavidAnderegg Mar 19, 2021
a9d29ad
updated the stencil figure and its caption
anilyil Mar 19, 2021
575a37a
formatting
anilyil Mar 19, 2021
d2ed360
formatting take 2
anilyil Mar 19, 2021
b933500
why doesnt my formatter work?
anilyil Mar 19, 2021
36516e4
added ihc_check script and some explanation of it
anilyil Mar 19, 2021
bf89caf
tip.cgns without missing TE-part
DavidAnderegg Mar 19, 2021
a43d4b7
updated options.
anilyil Mar 19, 2021
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
_build
.DS_Store
*.cgns
.vscode/*
make.bat
Binary file added machAeroTutorials/images/cubeplot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added machAeroTutorials/images/overset_IHC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added machAeroTutorials/images/overset_Overview.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added machAeroTutorials/images/overset_bad_IHC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added machAeroTutorials/images/overset_guide_10.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added machAeroTutorials/images/overset_guide_11.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added machAeroTutorials/images/overset_guide_14.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added machAeroTutorials/images/overset_guide_15.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added machAeroTutorials/images/overset_guide_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added machAeroTutorials/images/overset_guide_4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added machAeroTutorials/images/overset_guide_8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added machAeroTutorials/images/overset_tip1.png
Binary file added machAeroTutorials/images/overset_tip2.png
Binary file added machAeroTutorials/images/overset_vsp_export.png
Binary file added machAeroTutorials/images/overset_vsp_overview.png
Binary file added machAeroTutorials/images/overset_zipper.jpg
1 change: 1 addition & 0 deletions machAeroTutorials/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
aero_overview
opt_overview
airfoilopt_overview
overset_overview
117 changes: 117 additions & 0 deletions machAeroTutorials/ney_overset_tips.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
Overset Tips
============
--------------------------------------------------------------------------------
General
--------------------------------------------------------------------------------
- all meshes should have same off-wall spacing
- intersecting meshes must have mating surfaces (no actual intersections)
- once you have a valid hole-cutting, decrease the 'nearwalldist' to the
minimum possible value
- each compute cell must have at least two donor cells in each orthogonal
direction and one cell in each diagonal direction otherwise, it will be
flagged as an orphan (see ASCII art below)

|---|---|---|---|---| The compute cell in the center would
| B | B | D | B | B | not be flagged as an orphan as long
|---|---|---|---|---| as it maintains the stencil of donor
| B | D | D | D | B | cells (marked with D) in 3D.
|---|---|---|---|---|
| D | D | C | D | D | Key:
|---|---|---|---|---| D (donor) - compute or interpolate
| B | D | D | D | B | B (blanked) - blanked, flooded,
|---|---|---|---|---| flood seed or explicitly blanked
| B | B | D | B | B |
|---|---|---|---|---|
--------------------------------------------------------------------------------
Collar meshes
--------------------------------------------------------------------------------
- must be much finer mesh in comparison to overlapping meshes

--------------------------------------------------------------------------------
How Implicit Hole Cutting Works
--------------------------------------------------------------------------------
1) Determine Overlap of N Blocks
Create an N x N matrix that tells, for a given block, which other blocks
overlap it.

*) Designate Flood Seeds
Any cell farther than 'nearwalldist' from a wall in its own block that
intersects a wall on another block will be flagged as a flood seed.

m) Flooding
In a given block, any compute cells that interface with a flood seed or a
flooded cell are converted to flooded cells. The flood is only contained
by interpolate cells.

n) Fringe Reduction
After the iterative portion of the algorithm is over, excess fringe cells
are converted to blanked cells if they do not influence any compute cells.

iBlank Values
1 : Compute
0 : Blanked
-1 : Fringe (interpolate)
-2 : Flooded
-3 : Flood seed
-4 : Explicitly blanked (cutCallBack)

--------------------------------------------------------------------------------
Adjusting Implicit Hole Cutting Process
--------------------------------------------------------------------------------
There are two related flags in pyADflow to help with this:

'usezippermesh': False (default=True)
Sometimes if your mesh is flooding out, the zipper mesh will fail and
the mesh will not be written to file. This is basically impossible to
troubleshoot. This can be avoided by setting 'usezippermesh' to False.

'nrefine': 1 (default=10)
You can choose how many cycles to run the hole cutting algorithm. In
flood-out cases, you may want to stop after 1 cycle to see where a leak
is occurring.

Within each hole cutting cycle, there is a flooding procedure which generally
takes at least two iterations. If the mesh is flooding out, you can go into the
Fortran code to limit the number of iterations in this cycle so that you can
tell where the leak starts.

> Open adflow/src/overset/floodInteriorCells.F90

> Insert an additional if statement in the code after line 231.

231 loopIter = loopIter + 1
232
233 ! Choose number of flood cycles
234 if (loopIter == 2) then
235 exit parallelSyncLoop
236 end if
237
238 end do parallelSyncLoop

> Using 'loopIter == 2' will stop the cycle after one Flood Iteration.

> Don't forget to recompile the code. (make in hg/adflow)

--------------------------------------------------------------------------------
Viewing iBlanks in Tecplot
--------------------------------------------------------------------------------
1. One Tecplot zone per CGNS/zone solution
2. Check "Load Cell-centered Directly" (default)
3. Change Surfaces to "Exposed cell faces"
4. Change Contour Type to "Primary value flood"
5. Contour Levels
- Minimum = -3
- Maximum = 0
- N levels = 4
6. Blanking

--------------------------------------------------------------------------------
Generating grid families for a grid convergence study
--------------------------------------------------------------------------------
Say we have a base grid with level = j.
Another grid with level "i" should be generated such that:
- Number of cells: Ni = Nj / (2**dim)**(i-j)
- Number of nodes on an edge: add one to # of cells
- Growth ratio: ri = rj**(i+1-j)

For more information, see https://www.grc.nasa.gov/www/wind/valid/tutorial/spatconv.html
19 changes: 19 additions & 0 deletions machAeroTutorials/overset.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@misc{nasaM6sim,
title={{3D} {ONERA} {M6} {W}ing Validation for Turbulence Model Numerical Analysis},
url={https://turbmodels.larc.nasa.gov/onerawingnumerics_val.html},
journal={NASA},
publisher={NASA}
}

@misc{nasaM6real,
title={{ONERA} {M6} {W}ing},
url={https://www.grc.nasa.gov/WWW/wind/valid/m6wing/m6wing.html},
journal={NASA},
publisher={NASA}
}

@misc{nasaM6SA,
title = {{3D} {ONERA} {M6} {W}ing Validation for Turbulence Model Numerical Analysis - {SA}-neg Model Results},
url = {https://turbmodels.larc.nasa.gov/onerawingnumerics_val_sa.html},
urldate = {2020-12-11},
}
207 changes: 207 additions & 0 deletions machAeroTutorials/overset_analysis.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
.. _overset_analysis:

*******************************************************
CFD Analysis
*******************************************************

Introduction
============

This part will help guide you through the analysis part. We will setup the run script and let ADflow compute the
solution. From :cite:`nasaM6real` and :cite:`nasaM6SA`
we know the flow conditions:

+--------------------+---------+
| AoA | 3.06° |
+--------------------+---------+
| Mach | 0.8395 |
+--------------------+---------+
| Reynolds Number | 11.71e6 |
+--------------------+---------+
| Reynolds Ref Length| 0.646m |
+--------------------+---------+
| Temperature | 300° K |
+--------------------+---------+

There is a convenience package for ADflow called
`adflow_util <https://github.com/DavidAnderegg/adflow_util>`_\. It allows to plot the ADflow state variables live in the console and
handles some annoying stuff like creating the ``output`` folder for ADflow automatically. It also makes it easy
to sweep a variable, for example ``alpha``. This utility will be used here, but the regular python API,
that is detailed in other tutorials, would work as well.

For simplicity, only the calculation on the ``L3`` mesh is covered. The other meshes might require slightly different ADflow options.


Files
=====
Navigate to the directory ``overset/analysis`` in your tutorial folder and create an empty file called
``run_adflow_L3.py``. If you did not create the volume mesh on the previous page, you will also have to
copy the mesh file:
::

$ cp tutorial/overset/analysis/ONERA_M6_L3.cgns .

If you want to use ``adflow_util`` download and install it:
::

$ pip install git+https://github.com/DavidAnderegg/adflow_util.git


ADflow
======

Setup the Script
----------------

First we have to import ``adflow_util``:

.. literalinclude:: ../tutorial/overset/analysis/run_adflow_L3.py
:start-after: # rst Imports (beg)
:end-before: # rst Imports (end)

Then we define a variable for the level we want to use. This makes it easier to switch, if we want to:

.. literalinclude:: ../tutorial/overset/analysis/run_adflow_L3.py
:start-after: # rst Level (beg)
:end-before: # rst Level (end)

``adflow_util`` takes 3 different dictionaries as input. One sets some ``adflow_util``-specific options,
one sets the boundary conditions, as ``AeroProblem`` would and the last one is the regular ``ADflow`` options dict.
Lets set the ``adflow_util`` options first:

.. literalinclude:: ../tutorial/overset/analysis/run_adflow_L3.py
:start-after: # rst Options (beg)
:end-before: # rst Options (end)

name
This sets the name for the analysis. It defines how the various output files are named.

surfaceFamilyGroups
This defines how the various surface families should be assembled. The ``key`` sets the family name and
the ``array`` defines the various surfaces the family is made off.

All adflow_util options can be found `here <https://github.com/DavidAnderegg/adflow_util/blob/master/adflow_util/adflow_util.py#L52>`_\.

Now we define the ``AeroProblem`` options:

.. literalinclude:: ../tutorial/overset/analysis/run_adflow_L3.py
:start-after: # rst AeroOptions (beg)
:end-before: # rst AeroOptions (end)

Here we set the various flow parameters. It is exactly the same as you would set in ``baseclasses.AeroProblem``.
But we could, for example, set alpha as an array of variables. In that case, ``adflow_util`` would handle everything else
for us.

Now, let's set the ``ADflow`` options:

.. literalinclude:: ../tutorial/overset/analysis/run_adflow_L3.py
:start-after: # rst SolverOptions (beg)
:end-before: # rst SolverOptions (end)

Some things to note:

outputsurfacefamily
We choose ``wall`` which we defined earlier as consisting of ``near_wing`` and ``near_tip``. This will
write out only the wing as our surface solution.

zippersurfacefamily
This tells ADflow which surfaces it should use to construct the geometry on which the forces are integrated.

surfacevariables & volumevariables
Here it is very important to add ``blank``. This way we know which cells we can hide in the postprocessor as
the 'blanked' cells still show up in the solution.

.. note:: To only view computed cells, add a filter to your post-processor in a way, that only cells where
``blank`` is bigger than 0 are shown.

And lastly, we plug everything into ``adflow_util``:

.. literalinclude:: ../tutorial/overset/analysis/run_adflow_L3.py
:start-after: # rst Run (beg)
:end-before: # rst Run (end)


Simply Run the Script
---------------------
To run the script, proceed as usual:
::

$ python run_adflow_L3.py

If you want to run in parallel, start it with mpi
::

$ mpirun -np 4 python run_adflow_L3.py


Plot the Iterations in realtime
-------------------------------
If you want to have a graphical representation of all the ADflow variables, ``adflow_util`` comes in handy as well.
It has an additional package called ``adflow_plot``. If you installed it using pip, you can simply start it this way:
::

$ adflow_plot -i run_adflow_L3.py

If you want to run in parallel:
::

$ adflow_plot -i run_adflow_L3.py -np 4

This is simply an overlay, which starts the adflow script in the background and parses it's ``stdout``. At startup
you will see the regular adflow-ouput. But as soon as the calculation starts, you'll see a plot of ``resRho``:

.. figure:: images/overset_analysis_adflow_plot.png
:width: 600
:align: center

``adflow_plot`` output.

At the bottom is a console where you can define which variables you want to see. As terminals usually have a low
number of 'pixels', it is also possible to show only a limited number of iterations. Simply type ``help`` or ``h``
and hit ``Enter``. You will get a list of all available commands. To quit, simply type ``q`` and confirm with ``y``.

Output files
------------
In addition to the expected volume and surface files from adflow, there will also be a file called ``ONERA_M6_L3.out``.
It is from ``adflow_util`` and looks like this:
::

ONERA_M6_L3

Aero Options
-------------- ---------------------
alpha 3.06
mach 0.8395
reynolds 11720000.0
reynoldsLength 0.646
T 300
xRef 0.0
areaRef 0.7575
chordRef 0.646
evalFuncs cl, cd, cmy, cdp, cdv
-------------- ---------------------


RESULTS
cd cdp cdv cl cmy totalRes iterTot
---------- ---------- ---------- ---------- ----------- ---------- ---------
0.01879813 0.01326940 0.00552873 0.26064807 -0.18639411 0.00011945 82

It gives us a nice summary of the input and output values. If we had a sweep variable defined, the multiple
points would be listed here too.


Results
=======

For validation purposes, ADflow was run with all meshes and the results were plotted against various different solvers from :cite:`nasaM6SA`. As you can see,
ADflow lies right in the middle:

.. figure:: images/overset_grid_convergence.png
:width: 800
:align: center

Grid Convergence of ADflow in comparison to various other solvers.



Loading