Giter VIP home page Giter VIP logo

turbogenpy's Introduction

TurboGenPY

TurboGenPY is a synthetic isotropic turbulence generator for structured grids. It can take in an arbitrary turbulent energy spectrum and produce a three dimensional vector field (e.g. velocity) whose energy spectrum matches the input spectrum up to the discrete nyquist limit.

As the name indicates, this generator is written for Python, and specifically, Python 3.x.

To cite this work, please use the following citations:

  1. Tony Saad, Derek Cline, Rob Stoll, and James C. Sutherland. “Scalable Tools for Generating Synthetic Isotropic Turbulence with Arbitrary Spectra”. ,http://dx.doi.org/10.2514/1.J055230. (available online: Aug 25, 2016).
  2. Saad, T., & Sutherland, J. C. (2016). Comment on “Diffusion by a random velocity field” [Phys. Fluids 13, 22 (1970)]. Physics of Fluids (1994-Present), 28(11), 119101. https://doi.org/10.1063/1.4968528.
  3. Austin Richards, Tony Saad, and James C. Sutherland. “A Fast Turbulence Generator using Graphics Processing Units”, 2018 Fluid Dynamics Conference, AIAA AVIATION Forum, (AIAA 2018-3559). https://doi.org/10.2514/6.2018-3559.

Supported Spectra

TurboGenPY supports the following turbulent energy spectra:

  1. CBC (Comte-Bellot, Corrsin)
  2. von-Karman Pao
  3. Kang, Chester, and Meneveau
  4. Your experimentally measured data

You can certainly add your own spectrum. If you are using experimentally observed data, then mimic how the CBC spectrum is implemented via an interpolant.

Usage

See examply.py for an example of how to use the generator.

> python example.py -h

usage: example.py [-h] [-l LENGTH [LENGTH ...]] -n RES [RES ...] [-m MODES]
                  [-gpu] [-mp MULTIPROCESSOR [MULTIPROCESSOR ...]] [-o]
                  [-spec SPECTRUM]

This is the Utah Turbulence Generator.

optional arguments:
  -h, --help            show this help message and exit
  -l LENGTH [LENGTH ...], --length LENGTH [LENGTH ...]
                        Domain size, lx ly lz
  -n RES [RES ...], --res RES [RES ...]
                        Grid resolution, nx ny nz
  -m MODES, --modes MODES
                        Number of modes
  -gpu, --cuda          Use a GPU if availalbe
  -mp MULTIPROCESSOR [MULTIPROCESSOR ...], --multiprocessor MULTIPROCESSOR [MULTIPROCESSOR ...]
                        Use the multiprocessing package
  -o, --output          Write data to disk
  -spec SPECTRUM, --spectrum SPECTRUM
                        Select spectrum. Defaults to cbc. Other options
                        include: vkp, and kcm.

Examples

python example.py -n 32

generates turbulence in a $32^3$ box using the default CBC spectrum along with the default length for that spectrum

python example.py -n 32 34 32 -l 0.565 0.6 0.565

generates turbulence in a domain of size lx = 0.2, ly = 0.3, and lz = 0.2 with grid resolution nx = 32, ny = 34, and nz = 32.

python example.py -n 32 -l 0.565 -m 1000 -spec vkp

generates turbulence in a box of size 0.565^3 with resolution of 32^3 along with 1000 modes (resolution in wave space) and according to the von-Karman-Pao spectrum

python example.py -n 32 -mp 2 1 2

uses multiprocessors (or threads). Here, each spatial direction will have its own thread layout: 2 threads in the x direction, 1 thread in the y direction, and 2 threads in the z direction for atotal of 2x1x2 = 4 threads

turbogenpy's People

Contributors

jcsutherland avatar saadtony avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

turbogenpy's Issues

Loop in the power spectra calculation

I am trying to use the routine for 2D energy spectrum (tkespe.py file). However, the loop at line 261 is from –n//2 to n//2-1 and does not seems correct: according to the fftn documentation it should be –n//2+1 to n//2 (?)

The cbc or power spectrum is not working properly due to an issue with the interpolate function

Hi, I found an issue when running the code from the examples e.g.,
python example.py -n 32 34 32 -l 0.565 0.6 0.565, this would call the cbc-spectrum as a default.
This crashes with a
ValueError: A value in x_new is below the interpolation range. given by the "scipy" function "interpolate".

This can be solved by adding the flag fill_value = "extrapolate" in the interp1d function:
self.especf = interpolate.interp1d(kcbc, ecbc,'cubic', fill_value="extrapolate")

Note:
I am unaware of the physical implication this might have.

Issue with HIT setup from literature

HIT setup has been run with standard parameters found in the literature:

  • Box with length L=2.785e-04m
  • Passot-Pouquet spectrum with ke=67682.4 and uavg=17.64m/s
  • Resolution of 64 points in each direction

I have tried several number of modes (from 100 to 100 000) and the results are wrong in any case. A plot is attached.

passot_pouquet

minor question

In the line

lx = 9 * 2.0 * pi / 100.0

lx = 18pi/100, and the previous line states L=2pi/15 for a CBC spectrum. Does that mean the default value of lx is not for the CBC spectrum ?

The 2D example is not working properly

I am trying to run the 2D example, but it seems like its not working properly. I tried running it "out of the box", but the function
'isoturb.generate_isotropic_turbulence' requires 9 arguments, in the example2D.py, only 7 were provided. If values for lz and nz are provided, the generator crashes.

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.