Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into joss
  • Loading branch information
kieran-mackle committed Feb 14, 2024
2 parents 3d88827 + 193483a commit b0c4add
Show file tree
Hide file tree
Showing 23 changed files with 586 additions and 117 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ __pycache__/
.coverage
docs/build/
testing*
build/

# Miscellaneous
*.stl
*.csv
*.vtk
build/
29 changes: 29 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/source/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
formats:
- pdf

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/source/requirements.txt
- method: pip
path: .
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
## v0.5.0 (2024-01-02)

### Feat

- **Component**: added add_clustering_options method
- **utilities**: improve verbosity of senstivity study
- **SensitivityStudy**: optionally provide generator overrides
- **SensitivityStudy**: improved verbosity
- **merge_stls**: return merged stl filename
- **merge_stls**: added verbosity control
- **SensitivityStudy**: writing results to csv also writes combined csv
- **utilities**: added print_banner utility function
- **hangar**: add waverider to hangar
- **Component**: ghost components
- **Vehicle**: include option to merge all stls when writing to_stl
- **utilities**: added stl mesh merge function
- **SensitivityStudy**: calculates and saves component volume and mass sensitivities
- **Vehicle**: component volume and mass included in vehicle assessment
- **Component**: clean mesh on writing to stl
- **Vehicle**: allow specifying component modifier function to manipulate surfaces
- **parametricSurfce2stl**: allow passing custom clustering function
- **Vehicle**: ability to define and differentiate vehicle properties

### Fix

- **CompositeComponent**: added sphere and cube to allowable components
- **hangar**: include waverider in hangar namespace loading
- **Vehicle.to_stl**: exclude ghost components in stl merge

### Refactor

- **Component**: only clean mesh on writing to STL
- **Component**: clean STL mesh when generating mesh object instead of on saving to file
- **SensitivityStudy**: component volmass sens replaces just vehicle sens

## v0.4.0 (2023-03-10)

### Feat
Expand Down
62 changes: 33 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,50 @@
[![x43](docs/source/images/logo-dark.png)](docs/hangar.md)

<p align="center">

<a href="https://pypi.org/project/hypervehicle/">
<img src="https://img.shields.io/pypi/v/hypervehicle?color=blue&style=plastic" alt="Latest version" width=95 height=20>
</a>

<a href="https://github.com/psf/black">
<img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg">
</a>

<a>
<img src="https://github.com/kieran-mackle/hypervehicle/actions/workflows/tests.yml/badge.svg" alt="Test Status" class="center">
</a>

</p>

A Python package to rapidly generate parametric geometries
defined by hyperpatches. Check out the
[hangar](docs/source/hangar.md) for some examples.


## Getting Started
## Installation

### Prerequisites
Hypervehicle relies on the [GDTK](https://github.com/gdtk-uq/gdtk) geometry
package. Note that a full install of GDTK is not required. Instead, you can simply do a
[sparse checkout](https://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository)
of the relevant files, using the commands below.
To install `hypervehicle`, use the command below.

```
mkdir gdtk
cd gdtk/
git init
git remote add -f origin https://github.com/gdtk-uq/gdtk.git
git config core.sparseCheckout true
echo "src/lib/" >> .git/info/sparse-checkout
git pull origin master
cd src/lib
python3 -m pip install -e ./
cd ../../../
pip install hypervehicle
```

#### PyMesh

Having [PyMesh](https://github.com/PyMesh/PyMesh) installed can greatly enhance the capabilities
offered by `HyperVehicle`. However, it can be difficult to install. Troubleshooting
guide coming soon.

## Usage
Please see the [example geometry generation](docs/source/examples/x43.md)
to generate a mockup of the X-43A, shown above.

### Installation

To install `hypervehicle` from source, use the command below.
## Citing HyperVehicle
If you use HyperVehicle in any published work, please cite it using the BibTex reference below.

```
pip install git+https://github.com/kieran-mackle/hypervehicle
```text
@inproceedings{Mackle2024,
author = {Mackle, Kieran and Jahn, Ingo},
booktitle = {AIAA Science and Technology Forum and Exposition},
title = {Efficient and Flexible Methodology for the Aerodynamic Shape Optimisation of Hypersonic Vehicle Concepts in a High-Dimensional Design Space},
year = {2024},
}
```

## Usage
Please see the [example geometry generation](docs/source/examples/x43.md)
to generate a mockup of the X-43A, shown above.
## License
HyperVehicle is licensed under [GPLv3](COPYING).
45 changes: 11 additions & 34 deletions docs/source/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,8 @@
# Getting Started with HyperVehicle

## Dependencies

### GDTK
<tt>HyperVehicle</tt> depends on the
[GDTK](https://github.com/gdtk-uq/gdtk) Python package for its geometric toolkit.
Note that a full install of GDTK is not required. Instead, simply do a
[sparse checkout](https://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository)
of the relevant files, using the commands below.

```
mkdir gdtk
cd gdtk/
git init
git remote add -f origin https://github.com/gdtk-uq/gdtk.git
git config core.sparseCheckout true
echo "src/lib/" >> .git/info/sparse-checkout
git pull origin master
cd src/lib
python3 -m pip install .
cd ../../../
```

## Optional Dependencies

### PyMESH

To access more advanced features of <tt>HyperVehicle</tt>, such as compeonent mesh merging
and cleaning, [PyMesh](https://github.com/PyMesh/PyMesh) is required. You do not need to install
this to use <tt>HyperVehicle</tt>, but it can come in handy, especially when extracting
sensitivities for multi-component geometries.


## Installation


### Installation from PyPi
### Installation from PyPI

```
pip install hypervehicle
Expand All @@ -57,3 +24,13 @@ ready to go, run the command below.
```
python3 -m pytest tests/
```


## Optional Dependencies

### PyMESH

To access more advanced features of <tt>HyperVehicle</tt>, such as compeonent mesh merging
and cleaning, [PyMesh](https://github.com/PyMesh/PyMesh) is required. You do not need to install
this to use <tt>HyperVehicle</tt>, but it can come in handy, especially when extracting
sensitivities for multi-component geometries.
6 changes: 6 additions & 0 deletions docs/source/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sphinx
furo
sphinx_copybutton
myst_parser
sphinx_inline_tabs
Jinja2<3.1
78 changes: 78 additions & 0 deletions examples/tagging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
from hypervehicle import Vehicle
from hypervehicle.generator import Generator
from hypervehicle.components import SweptComponent
from hypervehicle.geometry import Vector3, Line, CoonsPatch


class ParametricWedge(Generator):
def __init__(self, **kwargs) -> None:
# Wedge parameters
self.wingspan = 1
self.chord = 1
self.thickness = 0.1

# Complete instantiation
super().__init__(**kwargs)

def create_instance(self) -> Vehicle:
# Create vehicle object
wedge_tags = Vehicle()
wedge_tags.configure(name="Wedge_Tags", verbosity=1)

# Define wedge cross-section points
# ^ +y
# |
# W _ - _ N ___
# _ - | - _ |
# +x <--- < -------------- > | thickness
# - _ | _ - |
# S - _ - E ___
#
# |-----------------|
# wingspan

NW = Vector3(x=0, y=0.5 * self.thickness)
NE = Vector3(
x=-0.5 * self.chord,
y=0,
)
SE = Vector3(x=0, y=-0.5 * self.thickness)
SW = Vector3(x=0.5 * self.chord, y=0)

# Define patches forming wedge
sections = []
for i in [-1, 1]:
z_loc = 0.5 * i * self.wingspan
axial_shift = Vector3(x=0, y=0, z=z_loc)

N = Line(p0=NW + axial_shift, p1=NE + axial_shift)
S = Line(p0=SW + axial_shift, p1=SE + axial_shift)
E = Line(p0=SE + axial_shift, p1=NE + axial_shift)
W = Line(p0=SW + axial_shift, p1=NW + axial_shift)

patch = CoonsPatch(north=N, south=S, east=E, west=W)
sections.append(patch)

fuselage_tags = {
"swept_tag": "FreeStream",
"end_0_tag": "Inlet",
"end_1_tag": "Outlet",
}
fuselage = SweptComponent(
cross_sections=sections,
sweep_axis="z",
stl_resolution=10,
tags=fuselage_tags,
)
wedge_tags.add_component(fuselage)

# Generate STL
return wedge_tags


if __name__ == "__main__":
# To create the nominal geometry
parametric_wedge_generator = ParametricWedge()
wedge_tags = parametric_wedge_generator.create_instance()
wedge_tags.generate()
wedge_tags.to_vtk(prefix="tagged_wedge")
2 changes: 1 addition & 1 deletion hypervehicle/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.4.0"
__version__ = "0.5.0"


from .vehicle import Vehicle
Loading

0 comments on commit b0c4add

Please sign in to comment.