GithubHelp home page GithubHelp logo

pressio / pressio-demoapps Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 3.0 71.22 MB

Suite of 1D, 2D, 3D demo apps of varying complexity with built-in support for sample mesh and exact Jacobians

License: Other

CMake 3.10% C++ 83.94% Python 3.29% C 2.02% Shell 0.15% HTML 0.10% Cuda 0.76% Fortran 6.55% XSLT 0.03% JavaScript 0.04% CSS 0.03%
euler-equations compressible-flows numerical-methods weno-schemes hyper-reduction advection pybind11 riemann-problem finite-volume hydrodynamics

pressio-demoapps's Introduction

Overview

pressio-demoapps is a library of 1D, 2D and 3D demo problems of varying complexity, ranging from a simple 1D linear advection, to 2D reaction-diffusion, and 3D Euler equations, and more.

Key features include:

  • support for both C++ and Python
  • cell-centered finite volume discretization with various numerical schemes and exact Jacobians
  • focus on providing self-contained and well-defined problems
  • built-in support for a sample mesh: this mean that one can evaluate the residual and Jacobian at a disjoint subset of the mesh cells (this is useful for intrusive ROMs, but in general for other purposes too)

Click below to check the documentation for more details:

Development status

pressio-demoapps is planned to be maintained in the long-term. Hopefully, more problems and features will be implemented. If you are interested in collaborating or would like to see a specific problem added, please reach out.

Questions?

Find us on Slack: https://pressioteam.slack.com or open an issue on github.

License and Citation

While we work on publishing this, if you use this code, please reference this Github page!

License

The full license is available here.

pressio-demoapps's People

Contributors

antoinemeyer5 avatar cwentland0 avatar distractor avatar eparish1 avatar fnrizzi avatar jcocola avatar marcinwrobel1986 avatar pjb236 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pressio-demoapps's Issues

add FD Jacobians

Currently only support evaluation of the RHS, need to add FD Jacobians to all classes

select face reconstruction order via constructor's arg

we currently select which order to use (1st, or 5th weno) based on the stencil size of the mesh provided. This is constraining a bit, since the 7 point stencil of the weno can support 1st order too.
So we need to add a way to select the order and then check that the selected order is compatible with the mesh provided.

doc: check math formulation for each problem page, add it if missing

Goal: self-explanatory

Steps:

  • make a new branch from develop
  • look inside pressio-demoapps/docs/src
  • doc is written in rst
  • fill math formulation for each problem
  • once done, open PRs for individual problems, or for example groups of problems (e.g. one PR for 1d, one for 2d ,etc)

Building the documentaiton:

cd pressio-demoapps/docs
make html

then open index.html in a browser. If you rebuild, you can refresh the page.
To build, you need sphinx and some other things.

Roe flux

Add Roe flux capability.

Following chapter 11 of "Riemann Solvers and Numerical Methods" by Toro, the algorithm should

  1. Compute Roe averaged velocities, total enthalpy, and speed of sound
  2. Compute Roe averaged eigenvalues using an analytical expression, potentially with an "entropy fix".
  3. Compute the Roe averaged right eigenvectors using analytical expressions for each entry
  4. Project the jump in each conserved quantity onto the right eigenvectors. Again, there are analytical expressions for this in Toro's book or Roe's original paper.
  5. Compute fluxes using equations 11.27-11.29 in Toro.

All of this should be possible following the same API used for the Rusanov flux in pressiodemoapps/impl_apps/eulerCommon/fluxes.hpp

Important note: there is a typo in Roe's original paper! The right hand side of Equation 22b should be \delta u_4 - w * \delta u_1.

Jacobians!

  • 1st order local Jacobians for Rusanov Flux
  • Convert tests to gtest format
  • Set up complex step derivative in tests
  • Global Jacobian contruction
    • Dirichlet BCs
    • Neumann BCs
    • Reflection BCs
    • Periodic BCs
  • Weno reconstruction contributions
  • 1st order local Jacobians for Roe Flux

bindings: operator (...) for pybind array_t is not efficient

The operator () for pybind::array_t in line 906 of this file is not efficient. I added this myself originally since natively array_t did not support it.
One reason behind the perf issue is that looking at the impl (traces back to the parent array class, see that same file), it still performs a bound check.

Problem is that inside pressio-demoapps, we are using this to access the graph entries. We should change things to use the mutable and mutable_unchecked that seem to perform well since these proxy classes do not perform bounds check. However, we need to figure out how to handle these proxies properly.

python has changed installation method, need to fix

should not do anymore python setup.py install but sometihing else.

in fact I get:

/usr/local/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(

list of supported problems

Test problems below are partially taken from here
A list of specific references for each is shown below, and will be updated.

1D

  • linear advection

    • use domain:[-1, 1]
    • IC either provided by user or default one is \phi = sin(\pi x)
    • BC: periodic
  • Euler Smooth

    • use domain: [-1, 1]
    • default IC is \rho =1 + 0.2*sin(\pi x), u= 1, p = 1
    • BC: periodic
    • analytical density at time t : \rho =1 + 0.2*sin(\pi (x-t))
  • Sod problem

    • use domain: [-0.5, 0.5]
    • IC:
      • x<=0: \rho =1, u= 1, p = 1
      • x>0 : \rho =0.125, u= 1, p = 0.1
    • BC: homogeneous Neumann
  • Lax problem

    • use domain: [-5, 5]
    • IC:
      • x<=0: \rho = 0.445, u = 0.698, p = 3.528
      • x>0 : \rho = 0.5, u = 0., p = 0.571
    • BC: homogeneous Neumann

2D

  • Euler Smooth

    • use domain: [-1, 1]^2
    • default IC is \rho =1 + 0.2*sin(\pi (x+y)), u = 1, v = 1, p = 1
    • BC: periodic
    • analytical density at time t : \rho =1. + 0.2*sin(\pi (x+y- 2 t))
  • Sedov problem (full version, no symmetry use)

    • reference
    • use domain: [-0.6, 0.6]^2
    • BC: homogeneous Neumann on all boundaries
    • IC is a high pressure concentrated small spherical region of radius R = 2. * std::min(dx, dy)
      • r<=R: \rho =1, u = 0, v = 0, p = (\gamma-1)/(pi*R*R)
      • r>R : \rho =1, u = 0, v = 0, p = 5e-5
    • dx, dy are the cell widths and the factor of 2 is used to spread the source over 2 cells for numerical reasons, and r = sqrt(x^2+y^2) is the distance from the origin.
  • Sedov problem (exploit symmetry to simulate only one quadrant)

    • use domain: [0, 1.2]^2
    • BC: reflective on y=0 and x=0 and homogeneous Neumann for x=1.2 and y=1.2
    • IC involves a small spherical region of radius R = 3. * std::min(dx, dy) with high pressure
      • r<=R: \rho =1, u = 0, v = 0, p = ((\gamma-1)* 0.851072)/(pi*R*R)
      • r>R : \rho =1, u = 0, v = 0, p = 2.5e-5
    • dx, dy are the cell widths, and r = sqrt(x^2+y^2) is the distance from the origin.
  • Riemann problem

    • use domain: [0.0, 1.0]^2
    • BC: homogeneous Neumann on all boundaries
    • various initial conditions are supported:
      • IC 1:
        • x>=0.5, y>=0.5: \rho = 0.5313, u = 0, v = 0, p = 0.4
        • x<0.5, y>=0.5 : \rho = 1, u = 0.7276., v = 0, p = 1
        • x<0.5, y<0.5. : \rho = 0.8, u = 0, v = 0., p = 1
        • x>0.5, y<0.5. : \rho = 1., u = 0, v = 0.7276, p = 1
      • IC 2:
        • x>=0.8, y>=0.8 : \rho = 1.5, u = 0, v = 0, p = 1.5
        • x<0.8, y>=0.8 : \rho = 0.5323, u = 1.206, v = 0, p = 0.3
        • x<0.8, y<0.8 : \rho = 0.138, u = 1.206, v = 1.206, p = 0.029
        • x>0.8, y<0.8 : \rho = 0.5323, u = 0, v = 1.206, p = 0.3
  • Double Mach reflection

    • in progress
  • Wind tunnel with step

    • in progress

3D

  • Euler Smooth

    • use domain: [-1, 1]^3
    • default IC is \rho = 1 + 0.2*sin(\pi (x+y+z)), u = 1, v = 1, w = 1, p = 1
    • BC: periodic
    • analytical density at time t : \rho =1 + 0.2*sin(\pi (x+y+z-3 t))
  • Sedov problem (exploit symmetry to simulate only 1/8)

    • use domain: [0, 1.2]^3
    • BC: reflective on planes next to source, homogeneous Neumann for the others
    • IC involves a small spherical region of radius R = 3. * min(dx, dy, dz) with high pressure
      • r<=R: \rho =1, u = 0, v = 0, p = (3 (\gamma-1)* 0.851072)/(4 pi R^3)
      • r>R : \rho =1, u = 0, v = 0, p = 2.5e-5
    • dx, dy, dz are the cell widths, and r = sqrt(x^2+y^2+z^2) is the distance from the origin.

meshing: make stand-alone script to visualize

Curerntly, the code to plot the mesh is part of the generation. we need to extract it and makeing it self-contained.
So that generating the mesh and visualizing it are separate steps/scripts

list of problems/capability [do not close]

1D

  • linear advection
    • rhs (1st/weno3/weno5)
    • first-order Jacobian
    • OpenMP
    • Python bindings
  • diffusion reaction
    • rhs
    • Jacobian
    • OpenMP
    • Python bindings
  • 1d Euler
    • rhs (1st/weno3/weno5)
    • first-order Jacobian
    • OpenMP
    • Python bindings

2D

  • 2d euler
    • rhs (1st/weno3/weno5)
    • first-order Jacobian
    • OpenMP
    • Python bindings
  • 2d swe
    • rhs (1st/weno3/weno5)
    • first-order Jacobian
    • OpenMP
    • Python bindings
  • 2d diffusion-reaction
    • rhs
    • Jacobian
    • OpenMP
    • Python bindings
  • 2d compre nav-sto
    • rhs (1st/weno3/weno5)
    • first-order Jacobian
    • OpenMP
    • Python bindings

3D

  • 3d euler
    • rhs (1st/weno3/weno5)
    • first-order Jacobian
    • OpenMP
    • Python bindings
  • 3d compre nav-sto
    • rhs (1st/weno3/weno5)
    • first-order Jacobian
    • OpenMP
    • Python bindings

Change name of the Python script which builds library

TODO:

  • there is a need of the name change for a Python script which builds dynamic library with CMake
  • name build confuses Python interpreter and python -m build is not using build package, to actually build the , but is running the script
  • changes needs to be done in CI as well

Add shallow water equation examples to pressio demo apps

Add the shallow water equations along with a case setup to pressio demo apps. To do:

  • Add code for SWE equations
  • test for the velocity function in the case of full mesh
  • test for the velocity function in the case of sample mesh
  • test for the full time integration
  • validate against existing SWE solver

support python bindings via pybind11

Obj: to create problem classes in python that use the c++ implementation

how:

  • follow how we did bindings for pressio-tools or pressio4py
  • should be relatively easy to do , maybe some issues can come up related to sparse jacobians

Priorites:

  • Sedov problem for John to use

fix warning

/home/fnrizzi/pressio-demoapps/include/pressiodemoapps/./impl/functor_reconstruct_from_state.hpp(54): warning #858: type qualifier on return type is meaningless
    const ReconstructionScheme reconstructionScheme() const{
    ^

In file included from /home/fnrizzi/pressio-demoapps/include/pressiodemoapps/./impl/advection_1d_prob_class.hpp(6),
                 from /home/fnrizzi/pressio-demoapps/include/pressiodemoapps/advection.hpp(17),
                 from /home/fnrizzi/pressio-demoapps/src_py/main_binder.cc(14):
/home/fnrizzi/pressio-demoapps/include/pressiodemoapps/./impl/functor_reconstruct_from_state.hpp(139): warning #858: type qualifier on return type is meaningless
    const ReconstructionScheme reconstructionScheme() const{
    ^

In file included from /home/fnrizzi/pressio-demoapps/include/pressiodemoapps/./impl/euler_1d_prob_class.hpp(11),
                 from /home/fnrizzi/pressio-demoapps/include/pressiodemoapps/euler1d.hpp(22),
                 from /home/fnrizzi/pressio-demoapps/src_py/main_binder.cc(16):
/home/fnrizzi/pressio-demoapps/include/pressiodemoapps/./impl/functor_reconstruct_from_stencil.hpp(51): warning #858: type qualifier on return type is meaningless
    const ReconstructionScheme reconstructionScheme() const{
    ^

In file included from /home/fnrizzi/pressio-demoapps/include/pressiodemoapps/./impl/euler_1d_prob_class.hpp(11),
                 from /home/fnrizzi/pressio-demoapps/include/pressiodemoapps/euler1d.hpp(22),
                 from /home/fnrizzi/pressio-demoapps/src_py/main_binder.cc(16):
/home/fnrizzi/pressio-demoapps/include/pressiodemoapps/./impl/functor_reconstruct_from_stencil.hpp(115): warning #858: type qualifier on return type is meaningless
    const ReconstructionScheme reconstructionScheme() const{
    ^

In file included from /home/fnrizzi/pressio-demoapps/include/pressiodemoapps/./impl/euler_1d_prob_class.hpp(11),
                 from /home/fnrizzi/pressio-demoapps/include/pressiodemoapps/euler1d.hpp(22),
                 from /home/fnrizzi/pressio-demoapps/src_py/main_binder.cc(16):
/home/fnrizzi/pressio-demoapps/include/pressiodemoapps/./impl/functor_reconstruct_from_stencil.hpp(242): warning #858: type qualifier on return type is meaningless
    const ReconstructionScheme reconstructionScheme() const{
    ^

In file included from /home/fnrizzi/pressio-demoapps/include/pressiodemoapps/./impl/euler_1d_prob_class.hpp(11),
                 from /home/fnrizzi/pressio-demoapps/include/pressiodemoapps/euler1d.hpp(22),
                 from /home/fnrizzi/pressio-demoapps/src_py/main_binder.cc(16):
/home/fnrizzi/pressio-demoapps/include/pressiodemoapps/./impl/functor_reconstruct_from_stencil.hpp(395): warning #858: type qualifier on return type is meaningless
    const ReconstructionScheme reconstructionScheme() const{
    ^

double mach: WENO5 not working

Using same BCs as first and WENO3, still gets unstable right away near wedge location.
Currently, the code throws if user selects WENO5 for double mach.

cpp: cleanup constructors

need to change how constructors are exposed now. We have a mix of things: inside includable headers we have some that pretty much as just variadic and forward everything to problem classes. We need to expose public constructors ONLY in the includable headers.

support mix of periodic and non periodic

Need to change:

  • meshing script: should be pretty easy to change mesh scripts to do this
  • mesh class in the code (now periodic means fully periodic along all axes)

add double Mach reflection

References:

cpp: check that mesh provided is consistent with problem selected

Since we have specific problems, we need to add inside the impl classes checks such that when the problems are constucted , the mesh object passed in satisfies the physical bounds for that specific problem

e.g., for the Euler2d:

explicit EigenApp2d(const mesh_t &amp; meshObj, int icId = 1)  
: meshObj_(meshObj), icId_(icId)  {    
 if (probid == 1){ 
   // throw if domain not compatible with 2d Sedov, else throw
 }
else if (probid==2){
   // throw if domain not compatible with 2d Riemann 
}
 ///
}

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.