Coder Social home page Coder Social logo

microhh / microhh2 Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 18.0 23.97 MB

Deprecated repository: use master branch of `microhh` for new 2.0 version.

License: GNU General Public License v3.0

CMake 1.81% Python 12.55% Shell 0.39% C++ 62.96% Cuda 17.57% Fortran 4.72%

microhh2's Introduction

MicroHH

Travis Documentation Status

MicroHH is a computational fluid dynamics code made for Direct Numerical Simulation (DNS) and Large-Eddy Simulation of turbulent flows in the atmospheric boundary layer. The code is written in C++.

MicroHH is hosted on GitHub (http://github.com/microhh). Here, the latest version of the source code can be found, as well as all releases. Bug notifications and fixes are always welcome.

MicroHH is described in detail in Van Heerwaarden et al. (2017). In case you decide to use MicroHH for your own research, the developers would appreciate to be notified and kindly request to cite their reference paper. The version described in the reference paper has been assigned a DOI via Zenodo.

DOI

Requirements

In order to compile MicroHH you need:

  • C++ compiler
  • FFTW3 libraries
  • Boost libraries
  • NetCDF4
  • CMake
  • MPI2/3 implementation (optional for MPI support)
  • CUDA (optional for GPU support)
  • Python + numpy + python-netcdf4 (optional for running example cases)
  • Ipython + python-netcdf4 + matplotlib (optional for plotting results example cases)

Compilation of the code

First, enter the config directory:

cd config

Here, you find a potential series of settings with the extension .cmake for different systems. Check whether your system is there. If not, create a file with the correct compiler settings and the proper location for all libraries. Then, copy your system file to default.cmake. Let us assume your system is Ubuntu:

cp ubuntu.cmake default.cmake

Then, go back to the main directory and create a subdirectory with an arbitrary name in which you will compile the code. Let us assume this directory is called "build":

cd ..  
mkdir build  
cd build   

From this directory, run cmake with the suffix .. to point to the parent directory where the CMakeLists.txt is found. This builds the model without Message Passing Interface (MPI) and CUDA support.

cmake ..

In case you prefer to enable either MPI or CUDA, run INSTEAD of the previous command:

cmake .. -DUSEMPI=TRUE

or

cmake .. -DUSECUDA=TRUE

(Note that once the build has been configured and you wish to change the USECUDA or USEMPI setting, you must delete the build directory or create an additional empty directory from which cmake is run.)

With the previous command you have triggered the build system and created the make files, if the default.cmake file contains the correct settings. Now, you can start the compilation of the code and create the microhh executable with:

make -j

Your directory should contain a file named microhh now. This is the main executable.

Running an example case

To start one of the included test cases, go back to the main directory and open the directory cases. Here, a collection of test cases has been included. In this example, we start the drycblles case, a simple large-eddy simulation of a dry convective boundary layer.

cd cases/drycblles

First, we have to create the vertical profiles for our prognostic variables:

python drycblles_input.py

Then, we have to copy or link the microhh executable to the current directory. Here we assume the executable is in the build directory that we have created before.

cp ../../build/microhh .

Now, we can start microhh in initialization mode to create the initial fields:

./microhh init drycblles

If everything works out properly, a series of files has been created. The model can be started now following:

./microhh run drycblles

This will take some time. Now, a statistics file called drycblles.default.0000000.nc has been created. You can open this file with your favorite plotting tool, or run some example plots using the provided plotting script that uses Python and matplotlib. This is most easily done in interactive python:

ipython  
run drycbllesstats

This should show you a set of basic plots. Congratulations, you have just completed your first run of MicroHH.

Happy MicroHHing!

microhh2's People

Contributors

chiil avatar elynnwu avatar ivanbastak avatar jeremygibbs avatar julietbravo avatar thijsheus avatar wbmol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

microhh2's Issues

Split column out of stat

Column takes up very little CPU time, but frequent column outputting is limited by waiting for the stats.

Bug in writing restart file times

With the MicroHH2 master I get:

Saving "time.0010800" ... OK
Saving "qt.0010801" ... OK
Saving "thl.0010801" ... OK

This is the relevant piece of code:

                // Save the data for restarts.
                if (timeloop->do_save())
                {
                    #ifdef USECUDA
                    if (!cpu_up_to_date)
                    {
                        #pragma omp taskwait
                        cpu_up_to_date = true;
                        fields  ->backward_device();
                        boundary->backward_device();
                        thermo  ->backward_device();
                    }
                    #endif
                    // Save data to disk.
                    #pragma omp task default(shared)
                    {
                        timeloop->save(timeloop->get_iotime());
                        fields  ->save(timeloop->get_iotime());
                    }
                }

Not sure what the best solution would be; save the iotime inside the block with pragma omp?taskwait?

Column ql with GPU

Column at the edge (x=0, y=0) has incorrect ql and b in CUDA code, works with MPI. Column in the middle seems to be okay.

Overall cleanup

*) Remove superfluous includes
*) Make sure that parameters are const/restrict, where possible
*) make sure that all numbers are of type TF

Tmp field dispatch system

Create a piece of code that can reserve and release tmp fields, to avoid having to manually manage the numbering of tmp fields.

Make logical stats groups

Groups can be confusing with prognostic thermo fields in default group and diagnostic fields in thermo group.

Clean up stats

Make sure that masks are current in the stats class and have stats routines that calculate most standard statistics all at once

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.