-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from cibinjoseph/vsp
OpenVSP geometry import feature
- Loading branch information
Showing
19 changed files
with
25,859 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "FLOWUnsteady" | ||
uuid = "b491798d-ac6e-455f-a27c-49c10bb0a666" | ||
authors = ["Eduardo J. Alvarez <[email protected]> and contributors"] | ||
version = "3.2.1" | ||
version = "3.3.0" | ||
|
||
[deps] | ||
PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee" | ||
|
@@ -17,13 +17,14 @@ FLOWVPM = "6e19019d-7c31-4940-9d16-c3f15dfe6020" | |
FLOWVLM = "1a3ff0be-0410-4572-aa62-b496bdd1f33b" | ||
FLOWNoise = "d27480ee-285d-533b-ae3d-5018956ae0bc" | ||
BPM = "f91b385c-3ede-44c9-92c8-2a04f762ef2f" | ||
VSPGeom = "9b3f6a95-fce2-4bc5-94a2-f99b39986ea6" | ||
|
||
[compat] | ||
julia = "1.6" | ||
GeometricTools = "2.1.6" | ||
FLOWVPM = "3.0.1" | ||
FLOWVLM = "2.1.2" | ||
FLOWNoise = "2.3.1" | ||
FLOWNoise = "2.3.2" | ||
BPM = "2.0.1" | ||
|
||
[extras] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# [Importing OpenVSP geometry](@id openvsp_import) | ||
|
||
```@docs | ||
FLOWUnsteady.read_degengeom | ||
FLOWUnsteady.import_vsp | ||
``` |
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# OpenVSP Geometry | ||
|
||
In this example, we import an aircraft model created in OpenVSP into the FLOWUnsteady environment. The `aircraft.vsp3` file used here is available in the folder [`examples/aircraft-vsp/`](https://github.com/byuflowlab/FLOWUnsteady/tree/master/examples) in the FLOWUnsteady GitHub repo. | ||
|
||
After creating the aircraft geometry in OpenVSP, we write out a DegenGeom file using the tab Analysis > DegenGeom as shown below. This creates a CSV file that contains all the components of the aircraft geometry. | ||
|
||
 | ||
|
||
Let's import the geometry into Julia using the [`FLOWUnsteady.read_degengeom`](@ref) function and inspect it. | ||
```@example inspect | ||
import FLOWUnsteady as uns | ||
geom_path = joinpath(uns.examples_path, "aircraft-vsp", "aircraft.csv") | ||
comp = uns.read_degengeom(geom_path); | ||
for i in 1:length(comp) | ||
println("$i. $(comp[i].name)") | ||
end | ||
``` | ||
|
||
Now that we have a good idea about the index of the components in the geometry, we can use them in FLOWUnsteady using the function [`FLOWUnsteady.import_vsp`](@ref). The following example script imports the OpenVSP geometry, creates FLOWUnsteady data structures and writes it out to a vtk file. The geometry can be used with the FLOWUnsteady solver by following one of the previous examples. | ||
|
||
```julia | ||
#=############################################################################## | ||
# DESCRIPTION | ||
Import of OpenVSP geometry into FLOWUnsteady | ||
# AUTHORSHIP | ||
* Author : Cibin Joseph | ||
* Email : [email protected] | ||
* Created : Aug 2023 | ||
* Last updated : Aug 2023 | ||
* License : MIT | ||
=############################################################################### | ||
|
||
import FLOWUnsteady as uns | ||
|
||
run_name = "aircraft-vsp" # Name of this simulation | ||
save_path = run_name # Where to save this simulation | ||
|
||
# Path to DegenGeom file | ||
geom_path = joinpath(uns.examples_path, "aircraft-vsp", "aircraft.csv") | ||
|
||
Vinf(X, t) = [1.0, 0.0, 0.0] # Freestream function | ||
|
||
# ----------------- 1) VEHICLE DEFINITION -------------------------------------- | ||
println("Importing geometry...") | ||
|
||
# Import VSP Components from DegenGeom file | ||
comp = uns.read_degengeom(geom_path); | ||
|
||
fuselage = uns.import_vsp(comp[1]) | ||
wingL = uns.import_vsp(comp[2]) | ||
wingR = uns.import_vsp(comp[2]; flip_y=true) | ||
basefuse = uns.import_vsp(comp[4]) | ||
horstabL = uns.import_vsp(comp[5]) | ||
horstabR = uns.import_vsp(comp[5]; flip_y=true) | ||
verstab = uns.import_vsp(comp[7]) | ||
|
||
println("Generating vehicle...") | ||
|
||
# Generate vehicle | ||
system = uns.vlm.WingSystem() # System of all FLOWVLM objects | ||
uns.vlm.addwing(system, "WingL", wingL) | ||
uns.vlm.addwing(system, "WingR", wingR) | ||
uns.vlm.addwing(system, "HorStabL", horstabL) | ||
uns.vlm.addwing(system, "HorStabR", horstabR) | ||
uns.vlm.addwing(system, "VerStab", verstab) | ||
|
||
fuse_grid = uns.gt.MultiGrid(3) | ||
uns.gt.addgrid(fuse_grid, "Fuselage", fuselage) | ||
|
||
basefuse_grid = uns.gt.MultiGrid(3) | ||
uns.gt.addgrid(basefuse_grid, "BaseFuse", basefuse) | ||
|
||
grids = [fuse_grid, basefuse_grid] | ||
|
||
vlm_system = system # System solved through VLM solver | ||
wake_system = system # System that will shed a VPM wake | ||
|
||
vehicle = uns.VLMVehicle( system; | ||
vlm_system=vlm_system, | ||
wake_system=wake_system, | ||
grids=grids | ||
); | ||
|
||
# ----------------- EXPORT GEOMETRY -------------------------------------------- | ||
if isdir(save_path); rm(save_path, recursive=true, force=true); end | ||
mkdir(save_path) | ||
|
||
uns.vlm.setVinf(system, Vinf) | ||
str = uns.save_vtk(vehicle, run_name; path=save_path) | ||
|
||
# Open up geometry in ParaView | ||
str = joinpath(save_path, str) | ||
run(`paraview -data=$(str)`) | ||
``` | ||
|
||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#=############################################################################## | ||
# DESCRIPTION | ||
Import of OpenVSP geometry into FLOWUnsteady | ||
# AUTHORSHIP | ||
* Author : Cibin Joseph | ||
* Email : [email protected] | ||
* Created : Aug 2023 | ||
* Last updated : Aug 2023 | ||
* License : MIT | ||
=############################################################################### | ||
|
||
import FLOWUnsteady as uns | ||
|
||
run_name = "aircraft-vsp" # Name of this simulation | ||
save_path = run_name # Where to save this simulation | ||
|
||
|
||
Vinf(X, t) = [1.0, 0.0, 0.0] # Freestream function | ||
|
||
# ----------------- 1) VEHICLE DEFINITION -------------------------------------- | ||
println("Importing geometry...") | ||
|
||
comp = uns.read_degengeom("aircraft.csv") | ||
|
||
fuselage = uns.import_vsp(comp[1]) | ||
wingL = uns.import_vsp(comp[2]) | ||
wingR = uns.import_vsp(comp[2]; flip_y=true) | ||
basefuse = uns.import_vsp(comp[4]) | ||
horstabL = uns.import_vsp(comp[5]) | ||
horstabR = uns.import_vsp(comp[5]; flip_y=true) | ||
verstab = uns.import_vsp(comp[7]) | ||
|
||
println("Generating vehicle...") | ||
|
||
# Generate vehicle | ||
system = uns.vlm.WingSystem() # System of all FLOWVLM objects | ||
uns.vlm.addwing(system, "WingL", wingL) | ||
uns.vlm.addwing(system, "WingR", wingR) | ||
uns.vlm.addwing(system, "HorStabL", horstabL) | ||
uns.vlm.addwing(system, "HorStabR", horstabR) | ||
uns.vlm.addwing(system, "VerStab", verstab) | ||
|
||
fuse_grid = uns.gt.MultiGrid(3) | ||
uns.gt.addgrid(fuse_grid, "Fuselage", fuselage) | ||
|
||
basefuse_grid = uns.gt.MultiGrid(3) | ||
uns.gt.addgrid(basefuse_grid, "BaseFuse", basefuse) | ||
|
||
grids = [fuse_grid, basefuse_grid] | ||
|
||
vlm_system = system # System solved through VLM solver | ||
wake_system = system # System that will shed a VPM wake | ||
|
||
vehicle = uns.VLMVehicle( system; | ||
vlm_system=vlm_system, | ||
wake_system=wake_system, | ||
grids=grids | ||
) | ||
|
||
# ----------------- 2) GEOMETRY EXPORT ----------------------------------------- | ||
rm(save_path, recursive=true, force=true) | ||
mkdir(save_path) | ||
|
||
uns.vlm.setVinf(system, Vinf) | ||
uns.save_vtk(vehicle, run_name; path=save_path) |
Oops, something went wrong.