Introduction

Most functions need an instance of the struct AtmosphericModel as first parameter, which can be created using the following code:

using AtmosphericModels, KiteUtils

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

This requires that the files system.yaml and settings.yaml exist in the folder data. See also Settings. The parameter relax=true allows loading a yaml file that does not contain all sections needed to run a kite power system simulation. This is useful if you want to use this package for other purposes than simulating kite power systems.

Types

Exported types

AtmosphericModels.AtmosphericModelType
mutable struct AtmosphericModel

Struct that is storing the settings and the state of the atmosphere.

Fields

  • set::Settings: The Settings struct
  • rho_zero_temp
  • wf::Union{WindField, Nothing}: The 3D WindField or nothing
source
AtmosphericModels.AtmosphericModelMethod
AtmosphericModel(set::Settings; nowindfield::Bool=false)

Constructs an AtmosphericModel using the provided Settings.

Arguments

  • set::Settings: The settings object containing configuration parameters for the atmospheric model.
  • nowindfield::Bool=false: Optional keyword argument. If true, the wind field will not be loaded.

Returns

  • An instance of AtmosphericModel configured according to the provided settings.
source

Private types

AtmosphericModels.WindFieldType
struct WindField

Struct that is storing a 3D model of wind vectors of the atmosphere. The Fields x, y and z store the grid coordinates, the fields u, v and w the wind turbulence vectors.

Fields

  • x_max::Float64 = NaN
  • x_min::Float64 = NaN
  • y_max::Float64 = NaN
  • y_min::Float64 = NaN
  • z_max::Float64 = NaN
  • z_min::Float64 = NaN
  • last_speed::Float64 = 0.0
  • valid::Bool = false
  • x::Union{SRL, Array{Float64, 3}}
  • y::Union{SRL, Array{Float64, 3}}
  • z::Union{SRL, Array{Float64, 3}}
  • u::Array{Float64, 3}
  • v::Array{Float64, 3}
  • w::Array{Float64, 3}
  • param::Vector{Float64} = [0, 0] # [alpha, v_wind_gnd]
source

Functions

Wind shear and air density calculation

AtmosphericModels.calc_rhoFunction
calc_rho(s::AM, height)

Calculates the air density at a given height above ground level.

Arguments

  • s::AM: An instance of the AM (Atmospheric Model) struct containing atmospheric parameters.
  • height: The height above ground level (in meters) at which to calculate the air density.

Returns

  • The air density at the specified height (in kg/m³).

Notes

  • The calculation assumes an exponential decrease of air density with altitude.
  • s.rho_zero_temp is the reference air density at ground level.
  • s.set.height_gnd is the ground height offset.
  • The scale height used is 8550.0 meters.
source
AtmosphericModels.calc_wind_factorFunction
calc_wind_factor(am::AM, height; profile_law::Int64=am.set.profile_law)

Calculates the wind factor at a given height using the specified wind profile law.

Arguments

  • am::AM: An instance of the AM type containing atmospheric model parameters.
  • height: The height (in meters) at which to calculate the wind factor.
  • profile_law::Int64: (Optional) The wind profile law to use for the calculation. Defaults to am.set.profile_law.

Returns

  • The wind factor at the specified height as determined by the chosen profile law.
source

Wind turbulence calculation

AtmosphericModels.get_windFunction
get_wind(am::AtmosphericModel, x, y, z, t; upwind_dir=0.0, interpolate=false)

Returns the wind vector at the specified position (x, y, z) and time t using the given AtmosphericModel (am).

Uses Taylor's frozen-turbulence hypothesis: the field is advected along the mean wind direction. The position is first rotated into the wind-aligned frame so that:

  • the along-wind component (+ time advection) maps to the long field dimension (y, e.g. 4050 m), avoiding short-period repetition during long simulations.
  • the cross-wind component maps to the short field dimension (x, e.g. 100 m).

Arguments

  • am::AtmosphericModel: The atmospheric model providing environmental parameters.
  • x, y, z: Position in the simulation (ENU) frame where the wind is evaluated. [m]
  • t: Current simulation time. [s]
  • upwind_dir (optional, default = 0.0): Direction the wind is coming FROM [rad]. Zero is north, clockwise positive (same convention as in calc_turbulent_wind).
  • interpolate (optional, default = false): If true, interpolate wind values between grid points; otherwise, use nearest-grid-point values.

Returns

  • A tuple (v_x, v_y, v_z) representing the wind velocity in the wind-aligned frame [m/s], where v_x is the along-wind component (includes mean wind), v_y is cross-wind, v_z is vertical.
source
AtmosphericModels.rel_turboFunction
rel_turbo(am::AtmosphericModel, v_wind = am.set.v_wind)

Find the closest relative turbulence value for a given ground wind speed.

Arguments

  • am::AtmosphericModel: The atmospheric model instance containing relevant parameters.
  • v_wind: (Optional) The wind velocity to use for the calculation. Defaults to am.set.v_wind.

Returns

  • The computed relative turbulence value.
source
AtmosphericModels.new_windfieldFunction
new_windfield(am::AtmosphericModel, v_wind_gnd; prn=true)

Create a new wind field file using the given, scalar ground wind velocity v_wind_gnd.

Parameters

  • am::AtmosphericModel: The atmospheric model for which the wind field is created.
  • v_wind_gnd: A scalar representing the wind velocity at ground level.
  • prn: Optional boolean flag to control printing of progress messages (default is true).

Returns

  • nothing
source
AtmosphericModels.new_windfieldsFunction
new_windfields(am::AtmosphericModel; prn=true)

Create and initialize new wind fields for all ground wind speeds, defined in am.set.v_wind_gnds and save them for the given AtmosphericModel instance am.

Arguments

  • am::AtmosphericModel: The atmospheric model for which wind fields are to be generated.
  • prn: Optional boolean flag to control printing of progress messages (default is true).

Returns

  • nothing
source