AtmosphericModels.jl

1d and 3d models of the atmosphere for the simulation of airborne wind energy systems
Author aenarete
Popularity
9 Stars
Updated Last
5 Months Ago
Started In
May 2022

AtmosphericModels

Build Status Coverage

Installation

Install Julia 1.10 or later, if you haven't already. You can add AtmosphericModels from Julia's package manager, by typing

using Pkg
pkg"add AtmosphericModels"

at the Julia prompt.

Exported types

AtmosphericModel
@enum ProfileLaw EXP=1 LOG=2 EXPLOG=3 FAST_EXP=4 FAST_LOG=5 FAST_EXPLOG=6

Exported functions

clear(s::AM)
calc_rho(s::AM, height)
calc_wind_factor(am::AM, height, profile_law::Int64=am.set.profile_law)

Wind profile

The EXPLOG profile law is the fitted linear combination of the exponential and the log law.

Usage

using AtmosphericModels
am = AtmosphericModel()

const profile_law = Int(EXPLOG)
height = 100.0
wf = calc_wind_factor(am, height, profile_law)

The result is the factor with which the ground wind speed needs to be multiplied to get the wind speed at the given height.

Plot a wind profile

using AtmosphericModels, Plots
am = AtmosphericModel()

heights = 6:1000
wf = [calc_wind_factor(am, height, Int(EXPLOG)) for height in heights]

plot(heights, wf, legend=false, xlabel="height [m]", ylabel="wind factor")
using AtmosphericModels, ControlPlots
am = AtmosphericModel()
AtmosphericModels.se().alpha = 0.234  # set the exponent of the power law

heights = 6:200
wf = [calc_wind_factor(am, height, Int(EXP)) for height in heights]

plot(heights, wf, xlabel="height [m]", ylabel="wind factor")

Benchmark

using AtmosphericModels, BenchmarkTools

am = AtmosphericModel()
@benchmark calc_wind_factor(am, height, Int(EXPLOG)) setup=(height=Float64((6.0+rand()*500.0)))
Profile law time [ns]
EXP 12
LOG 16
EXPLOG 33
FAST_EXP 6.6
FAST_LOG 6.6
FAST_EXPLOG 6.6

The FAST versions are an approximations with an error of less than $1.5 \cdot 10^{-5}$ and are correct only for the default values of h_ref, z0 and alpha.

Air density

using AtmosphericModels, BenchmarkTools
am = AtmosphericModel()
@benchmark calc_rho(am, height) setup=(height=Float64((6.0+rand()*500.0)))

This gives 4.85 ns as result. Plot the air density:

heights = 6:1000
rhos = [calc_rho(am, height) for height in heights]
plot(heights, rhos, legend=false, xlabel="height [m]", ylabel="air density [kg/m³]")

Running the test scripts

First, add TestEnv to your global environment.

julia
using Pkg
Pkg.add("TestEnv")
exit()

Then you can run Julia using this project and run the tests:

julia --project
using TestEnv
TestEnv.activate()
include("test/bench.jl")
include("calc_approximations.jl")
include("runtests.jl")

Further reading

These models are described in detail in Dynamic Model of a Pumping Kite Power System.

Licence

This project is licensed under the MIT License. Please see the below WAIVER in association with the license.

WAIVER

Technische Universiteit Delft hereby disclaims all copyright interest in the package “AtmosphericModels.jl” (models for airborne wind energy systems) written by the Author(s).

Prof.dr. H.G.C. (Henri) Werij, Dean of Aerospace Engineering

See also