Skip to content

OpenSourceAWE/AtmosphericModels.jl

Repository files navigation

AtmosphericModels

Dev 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

First, create a new Julia project:

mkdir test
cd test
julia --project=.

You can now add AtmosphericModels from Julia's package manager, by typing

using Pkg
pkg"add AtmosphericModels"

at the Julia prompt.

Running the tests

Launch Julia using this project and run the tests:

julia --project
julia> using Pkg
julia> Pkg.test("AtmosphericModels")

Running the examples

If you check out the project using git, you can more easily run the examples:

git clone https://github.com/OpenSourceAWE/AtmosphericModels.jl
cd AtmosphericModels.jl

Launch Julia using this project with julia --project and run the example menu:

include("examples/menu.jl")

The first time will take some time, because the graphic libraries will get installed, the second time it is fast.

Usage

Calculate the height dependant wind speed

Make sure that the folder data exist and contains the files system_nearshore.yaml and settings_nearshore.yaml. These configuration files contain the wind profile parameters, fitted to the near shore location Maasvlakte, NL on a specific day.

using AtmosphericModels, KiteUtils
set_data_path("data")
set = load_settings("system.yaml"; relax=true)
am = AtmosphericModel(set)

height = 100.0
wf = calc_wind_factor(am, height)

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

Using the turbulent wind field

You can get a wind vector as function of x,y,z and time using the following code:

using AtmosphericModels, KiteUtils

set_data_path("data")
set = load_settings("system.yaml"; relax=true)
am::AtmosphericModel = AtmosphericModel(set)

@info "Ground wind speed: $(am.set.v_wind) m/s"

wf::WindField = WindField(am, am.set.v_wind)
x, y, z = 20.0, 0.0, 200.0
t = 0.0
vx, vy, vz = get_wind(wf, am, x, y, z, t)
@time get_wind(am, x, y, z, t)
@info "Wind at x=$(x), y=$(y), z=$(z), t=$(t): v_x=$(vx), v_y=$(vy), v_z=$(vz)"
@info "Wind speed: $(sqrt(vx^2 + vy^2 + vz^2)) m/s"

It is suggested to check out the code using git before executing this example, because it requires that a data directory with the correct files system.yaml and settings.yaml exists. See below how to do that.

Plot a wind profile

using AtmosphericModels, KiteUtils, ControlPlots
am = AtmosphericModel(se())

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

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

Wind profile nearshore

using AtmosphericModels, ControlPlots, KiteUtils
am = AtmosphericModel(se())
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", fig="Onshore")

Air density

using AtmosphericModels, BenchmarkTools, KiteUtils
am = AtmosphericModel(se())
@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³]")

Further reading

Please read the documentation. At the end of the documentation (here) you find references to the scientific literature.

License

This project is licensed under the MIT License. Please see the below Copyright notice in association with the licenses that can be found in the file LICENSE in this folder.

Copyright notice

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, Technische Universiteit Delft.

See the copyright notices in the source files, and the list of authors in AUTHORS.md.

See also

About

1d and 3d models of the atmosphere for the simulation of airborne wind energy systems

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •