Skip to content

Commit 4b45dcf

Browse files
committed
Version bump, and added some docs for the StructArrays.jl
1 parent 67f1f73 commit 4b45dcf

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "CCBlade"
22
uuid = "e1828068-15df-11e9-03e4-ef195ea46fa4"
33
authors = ["Andrew Ning <aning@byu.edu>"]
4-
version = "0.2.7"
4+
version = "0.2.8"
55

66
[deps]
77
FLOWMath = "6cb5d3fb-0fe8-4cc2-bd89-9fe0b19a99d3"

docs/src/reference.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,31 @@ Most of these parameters are defined in the figure below. The variables Np and
8080

8181
![inflow2](inflow2.png)
8282

83-
When using broadcasting to retrieve multiple outputs as once (as would be commonly done for multiple sections along a blade) the return type is an array of structs. However, the `dot` notation is overloaded so that the outputs can be accessed as if it was a struct of arrays (e.g., `outputs.Np`). This was shown in the introductory [tutorial](tutorial.md).
83+
When using broadcasting to retrieve multiple outputs at once (as would be commonly done for multiple sections along a blade) the return type is a `StructArray` from [the StructArrays.jl package](https://github.com/JuliaArrays/StructArrays.jl). A `StructArray` acts like a normal `Array` when indexed with integers, but can also be indexed with the output names like `Np` and `Tp`.
84+
To show this, we'll create an example `Output` array of length 4 with random data:
85+
86+
```@example structarray
87+
using CCBlade
88+
89+
# Create an array of `N` Outputs
90+
N = 4
91+
outs = Outputs.(rand(N), rand(N), rand(N), rand(N), rand(N), rand(N), rand(N), rand(N), rand(N), rand(N), rand(N), rand(N), rand(N), rand(N), rand(N))
92+
```
93+
94+
Now we can retrieve all of the inputs for e.g. the third entry by indexing with an integer:
95+
96+
```@example structarray
97+
outs[3]
98+
```
99+
100+
But we can also get all of the e.g. `Np` outputs using `outs.Np`:
101+
102+
```@example structarray
103+
outs.Np
104+
```
105+
106+
This was shown in the introductory [tutorial](tutorial.md).
107+
The same is true for the [`Section`](@ref) and [`OperatingPoint`](@ref) structs.
84108

85109

86110
One subtle notes regarding the way the tip-loss factor works. The BEM methodology applies hub/tip losses to the loads rather than to the velocities. This is the most common way to implement a BEM, but it means that the raw velocities may be misleading as they do not contain any hub/tip loss corrections. To fix this we compute the effective hub/tip losses that would produce the same thrust/torque. In other words:
@@ -283,4 +307,4 @@ While not used in CCBlade directly, for convenience a preprocessing method is pr
283307

284308
```@docs
285309
viterna
286-
```
310+
```

0 commit comments

Comments
 (0)