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

Example loading an OpenFAST output file #14

Merged
merged 9 commits into from
Sep 4, 2024
Merged
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
6 changes: 5 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ version = "0.8.0"
[deps]
AcousticMetrics = "046f749b-9c1e-43ca-86bc-6902340f753e"
CCBlade = "e1828068-15df-11e9-03e4-ef195ea46fa4"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
FLOWMath = "6cb5d3fb-0fe8-4cc2-bd89-9fe0b19a99d3"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
FlexiMaps = "6394faf6-06db-4fa8-b750-35ccc60383f7"
Expand All @@ -15,18 +17,20 @@ KinematicCoordinateTransformations = "730d3219-0a85-48f9-b699-9f31f8913d09"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Meshes = "eacbb407-ea5a-433e-ab97-5258b1ca43fa"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192"

[compat]
AcousticMetrics = "0.7.0"
CCBlade = "0.2.4"
FLOWMath = "0.3.3"
FLOWMath = "0.4.1"
FillArrays = "1.11.0"
FlexiMaps = "0.1.18"
Format = "1.3.7"
JuliennedArrays = "0.4.0"
KinematicCoordinateTransformations = "0.4.1"
Meshes = "0.46.0"
StaticArrays = "1.5.19"
Statistics = "1.9.0"
WriteVTK = "1.17.1"
julia = "1.9.1"
2 changes: 2 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
FLOWMath = "6cb5d3fb-0fe8-4cc2-bd89-9fe0b19a99d3"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
KinematicCoordinateTransformations = "730d3219-0a85-48f9-b699-9f31f8913d09"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
2 changes: 2 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ function doit()
IN_CI = get(ENV, "CI", nothing)=="true"

makedocs(sitename="AcousticAnalogies.jl", modules=[AcousticAnalogies], doctest=false,
root=@__DIR__,
format=Documenter.HTML(prettyurls=IN_CI),
pages=["Introduction"=>"index.md",
"Guided Example"=>"guided_example.md",
"CCBlade.jl Example"=>"ccblade_example.md",
"WriteVTK.jl Support"=>"writevtk_support.md",
"OpenFAST Example"=>"openfast_example.md",
"API Reference"=>"api.md",
"Software Quality Assurance"=>"sqa.md",
"BPM Airfoil Self-Noise Tests"=>"bpm_tests1.md",
Expand Down
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.
432 changes: 432 additions & 0 deletions docs/src/openfast_example.md

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions src/AcousticAnalogies.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
module AcousticAnalogies

using AcousticMetrics: AcousticMetrics
# using BPM: BPM
using CCBlade: CCBlade
using CSV: CSV
using DataFrames: DataFrames
using FillArrays: Fill
using FLOWMath: akima, linear, ksmax, norm_cs_safe, dot_cs_safe, atan_cs_safe, abs_cs_safe
using FLOWMath: FLOWMath, akima, linear, ksmax, norm_cs_safe, dot_cs_safe, atan_cs_safe, abs_cs_safe
using FlexiMaps: mapview
using Format: format, FormatExpr
using JuliennedArrays: JuliennedArrays
using KinematicCoordinateTransformations: KinematicTransformation, SteadyRotXTransformation, ConstantVelocityTransformation, compose
using LinearAlgebra: cross, norm, mul!
using Meshes: Meshes
using StaticArrays: @SVector
using StaticArrays: @SVector, SVector
using Statistics: mean
using WriteVTK: WriteVTK

include("utils.jl")
Expand Down Expand Up @@ -61,7 +63,13 @@ export f1a_source_elements_ccblade, tblte_source_elements_ccblade, lblvs_source_

include("bpm_test_utils.jl")

include("openfast_helpers.jl")
export AbstractTimeDerivMethod, NoTimeDerivMethod, SecondOrderFiniteDiff, calculate_loading_dot!
export AbstractRadialInterpMethod, FLOWLinearInterp, FLOWAkimaInterp, interpolate_to_cell_centers!
export OpenFASTData, read_openfast_file, f1a_source_elements_openfast

include("writevtk.jl")
export to_paraview_collection

include("deprecated.jl")

Expand Down
45 changes: 45 additions & 0 deletions src/f1a.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,51 @@ function CompactF1ASourceElement(ρ0, c0, r, θ, Δr, Λ, fn, fr, fc, τ)
return CompactF1ASourceElement(ρ0, c0, Δr, Λ, y0dot, y1dot, y2dot, y3dot, f0dot, f1dot, τ, span_uvec)
end

"""
CompactF1ASourceElement(ρ0, c0, r, θ, Δr, Λ, fn, fndot, fr, frdot, fc, fcdot, τ)

Construct a source element to be used with the compact form of Farassat's formulation 1A, using position and loading data expressed in a cylindrical coordinate system.

The `r` and `θ` arguments are used to define the radial and circumferential position of the source element in a cylindrical coordinate system.
Likewise, the `fn`, `fr`, and `fc` arguments are used to define the normal, radial, and circumferential loading per unit span *on the fluid* (in a reference frame moving with the element) in the same cylindrical coordinate system.
The `fndot`, `frdot`, and `fcdot` arguments are the time-derivative of the normal, radial, and circumferential loading per unit span, again *on the fluid* and in a reference frame moving with the element, in the cylindrical coordinate system.
The cylindrical coordinate system is defined as follows:

* The normal axial direction is in the positive x axis
* The circumferential/azimuth angle `θ` is defined such that `θ = 0` means the radial direction is aligned with the positive y axis, and a positive `θ` indicates a right-handed rotation around the positive x axis.

Note that, for a proper noise prediction, the source element needs to be transformed into the "global" frame, aka, the reference frame of the fluid.
This can be done easily with the transformations provided by the `KinematicCoordinateTransformations` package, or manually by modifying the components of the source element struct.

# Arguments
- ρ0: Ambient air density (kg/m^3)
- c0: Ambient speed of sound (m/s)
- r: radial coordinate of the element in the blade-fixed coordinate system (m)
- θ: angular offest of the element in the blade-fixed coordinate system (rad)
- Δr: length of the element (m)
- Λ: cross-sectional area of the element (m^2)
- fn: normal load per unit span *on the fluid* (N/m)
- fndot: time derivative of the normal load per unit span *on the fluid* (N/(m*s))
- fr: radial load *on the fluid* (N/m)
- frdot: time derivative of the radial load *on the fluid* (N/(m*s))
- fc: circumferential load *on the fluid* (N/m)
- fcdot: time derivative of the circumferential load *on the fluid* (N/(m*s))
- τ: source time (s)
"""
function CompactF1ASourceElement(ρ0, c0, r, θ, Δr, Λ, fn, fndot, fr, frdot, fc, fcdot, τ)
s, c = sincos(θ)
y0dot = @SVector [0, r*c, r*s]
T = eltype(y0dot)
y1dot = @SVector zeros(T, 3)
y2dot = @SVector zeros(T, 3)
y3dot = @SVector zeros(T, 3)
f0dot = @SVector [fn, c*fr - s*fc, s*fr + c*fc]
f1dot = @SVector [fndot, c*frdot - s*fcdot, s*frdot + c*fcdot]
span_uvec = @SVector [0, c, s]

return CompactF1ASourceElement(ρ0, c0, Δr, Λ, y0dot, y1dot, y2dot, y3dot, f0dot, f1dot, τ, span_uvec)
end

"""
(trans::KinematicTransformation)(se::CompactF1ASourceElement)

Expand Down
Loading
Loading