Giter Site home page Giter Site logo

compgrids.jl's Introduction

CompGrids.jl

Creates computational grids and initializes fields on these grids that can be used with ParallelStencil.jl or PETSc.jl

The basic idea is that you specify a backend (ParallelStencil or PETSc), after which the grid can be created. A 2D example using ParallelStencil & ImplicitGlobalGrid:

julia> using CompGrids, MPI, ParallelStencil, ImplicitGlobalGrid, PETSc
julia> @init_backend(ParallelStencil, Threads, true, 2);
julia> grid = RegularRectilinearCollocatedGrid(size=(10,20), extent=(100.0,110), fields=(T=0,P=11.22))
Global grid: 12x22x1 (nprocs: 1, dims: 1x1x1)
RegularRectilinearCollocatedGrid{Float64, 2, Backend{BackendParallelStencil, Float64}}
        Backend: ParallelStencil ( Threads | MPI ) 
       gridtype: Collocated 
         domain: x  [-50.0, 50.0], y  [-55.0, 55.0] 
       topology: (Bounded, Bounded)
     resolution: (10, 20) (global, no halo)
                 (12, 22) (local  + halo)
                 (12, 22) (global + halo)
 grid spacing Δ: (11.11111111111111, 5.7894736842105265)
         fields: (:T, :P)

We can initialize the same grid, but using the PETSc MPI-parallel backend, by changing one line:

julia> @init_backend(PETSc, Threads, true, 2);
julia> grid = RegularRectilinearCollocatedGrid(size=(10,20), extent=(100.0,110), fields=(T=0,P=11.22))
RegularRectilinearCollocatedGrid{Float64, 2, Backend{BackendPETSc, Float64}}
        Backend: PETSc ( Threads | MPI ) 
       gridtype: Collocated 
         domain: x  [-50.0, 50.0], y  [-55.0, 55.0] 
       topology: (Bounded, Bounded)
     resolution: (10, 20) (global, no halo)
                 (10, 20) (local,  no halo)
 grid spacing Δ: (11.11111111111111, 5.7894736842105265)
         fields: (:T, :P) 

The resulting grid is a structure that holds information about the grid (the global grid in case it is run on one core, and the local portion in case it is run in MPI-parallel). If indicated, it also initializes the fields (as a global vector for the PETSc and as 1D/2D/3D arrays for PS), which you can access with grid.fields.T or grid.fields[:T] (for the examples above).

Development

This is work in progress. If you want to get a feel for it, have a look at the test and examples directories.

  • The functionality is fairly complete for collocated grids (using PS and PETSc).
  • Staggered grid support will be added
  • Support for other types of structurally regular grids (e.g., cylindrical, yin-yang?) should be fairly straightforward to add as well, but as we don't use these grids on a daily basis, we would require volunteers to help with this
  • Adding interfaces to other types of meshes (finite elements, AMR) could be added as well, but would require external volunteers

compgrids.jl's People

Contributors

boriskaus avatar

Watchers

 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.