Giter Site home page Giter Site logo

mann.rs's Introduction

DOI

Mann.rs

A Mann turbulence generator for Python written in Rust. Mannrs can generate 3D coherent turbulence boxes for wind turbine simulations. The numerical innovations used in this package are described in Liew, J., Riva, R., & Göçmen, T. (2023) Efficient Mann turbulence generation for offshore wind farms with applications in fatigue load surrogate modelling. The underlying Mann turbulence model is originially described in Mann, J. (1998). Wind field simulation.

Features include:

  • Parallelized computations: Just set parallel=True
  • Memory efficient: Can generate extremely high resolution turbulence.
  • Blazing fast: Thanks to the stencil method and the Rust backend.
  • Arbitrary box sizing: Box discretization is not limited to powers of 2.

Usage

Mannrs separates the process of generating turbulence into two steps: stencil generation and turbulence generation. The stencil is a 5D matrix containing the spectral tensors needed to generate turbulence for a given set of parameters. A stencil can be reused to generate multiple random instances of turbulence. Implementations are provided in Python and Rust.

Python

import mannrs

params = {
    "L": 30.0,
    "gamma": 3.2,
    "Lx": 6000,
    "Ly": 200,
    "Lz": 200,
    "Nx": 8192,
    "Ny": 64,
    "Nz": 64,
}
ae = 0.2
seed = 1234

stencil = mannrs.Stencil(**params)
U, V, W = stencil.turbulence(ae, seed)

Rust

use mannrs::Stencil;

let (L, gamma) = (30.0, 3.2);
let (Lx, Ly, Lz) = (6000.0, 200.0, 200.0);
let (Nx, Ny, Nz) = (8192, 64, 64);
let ae = 0.2;
let seed = 1234;

let stencil = Stencil::from_params(L, gamma, Lx, Ly, Lz, Nx, Ny, Nz);
let (U, V, W) = stencil.turbulence(ae, seed);

Installation

Installation for both Python and Rust versions requires the Rust compiler to be installed (see here for installation instructions).

Python (Linux and MacOS only)

Clone this repository and pip install:

git clone [email protected]:jaimeliew1/Mann.rs.git
cd Mann.rs
pip install .

Rust

cargo install --git https://github.com/jaimeliew1/Mann.rs mannrs

Contributions

If you have suggestions or issues with Mann.rs, feel free to contact me at [email protected]. Pull requests are welcome.

Citation

If you want to cite Mann.rs, please use this citation:

Jaime Liew. (2022). jaimeliew1/Mann.rs: Publish Mann.rs (v1.0.0). Zenodo. https://doi.org/10.5281/zenodo.7254149

mann.rs's People

Contributors

jaimeliew1 avatar madsmpedersen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.