Git Product home page Git Product logo

omega3d's Introduction

Omega3D

Three-dimensional flow solver with GUI using vortex particle and boundary element methods

NOTE: This program currrently uses O(N^2) calculations for velocity, so runs more slowly than desired. A O(N log N) treecode is being prepared to alleviate this.

startupvideo

Overview

Computational Fluid Dynamics (CFD) encompasses a wide variety of methods to aid in the numerical simulation of fluid flows on digital computers. Most methods rely on the subdivision of the fluid domain into small, stationary cells, such as tetrahedra, and solve the Navier-Stokes equations on each Eulerian (not moving) cell. In contrast, vortex methods rely on a Lagrangian (moving with the flow) description of the only the vorticity-containing region of the fluid domain and any solid boundaries present. This eliminates many of the difficulties present in traditional CFD. In addition, the form of the equations used also removes the pressure term from the Navier-Stokes equations, which is a large source of instability and extra effort in traditional CFD. This is why many new flow solvers for unsteady momentum-dominated flows (non-microscopic in scale) are implemented using vortex methods.

Omega3D aims to be an accurate combined Lagrangian-Eulerian fluid flow solver for unsteady flows with complex boundaries, with a greatly reduced reliance on meshing and parameter tuning for achieving accuracy and speed.

Build the software

This code uses some C++17 features, so should compile on GCC 7, Clang 4, and MSVC 19.10 (Visual Studio 15 2017) compilers.

Prerequisites

Users will also need CMake, Eigen (version 3.3 or newer), and GLFW version 3 on their machines to build this, other requirements are included in this distribution. Get these on Fedora with

sudo dnf install cmake glfw3-devel eigen3-devel

or on Ubuntu with

sudo apt-get install cmake glfw3-dev libeigen3-dev

or on OSX via Homebrew with

brew install cmake glfw eigen

Optional libraries

Vc is a vectorization library, and Omega3D uses it to greatly accelerate the velocity evaluations. This package can be built and installed external to Omega3D with

git clone https://github.com/VcDevel/Vc.git
cd Vc
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/Vc -DBUILD_TESTING=OFF ..
make -j 4
sudo make install
cd ../..

The above commands should work verbatim on Linux and OSX. Don't ask about Windows - there's a calling convention issue preventing this from working.

Compile

Upon installation of the prerequisites, the following commands should build Omega3D.

git clone [email protected]:Applied-Scientific-Research/Omega3D.git
cd Omega3D
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DUSE_OMP=ON -DUSE_VC=OFF ..
make

If you were able to build and install Vc, then you should set -DUSE_VC=ON in the above cmake command.

To use the system Clang on Linux, you will want the following variables defined:

cmake -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ ..

On OSX, to get OpenMP parallelization of the solver, you may need to install GCC with brew (as above), and add a few more arguments to the cmake command:

brew install gcc
cmake -DCMAKE_C_COMPILER=/usr/local/bin/gcc-x -DCMAKE_CXX_COMPILER=/usr/local/bin/g++-x ..

where x is the latest version on your machine (you can check this by going to /usr/local/bin).

Run a simulation in the GUI

If you were able to build the software, you should be able to run

./Omega3D.bin

Upon running Omega2D, you will see a GUI floating over a black field. Using the Select a simulation... pull-down menu, you can quickly load and run a preset simulation. Let's load "flow over sphere".

At any time you can press PAUSE to pause the simulation or Reset to go back to the original conditions. At any time, you can left-click and drag on the flow field to move your point of view, or use the scroll wheel to zoom and unzoom. Space bar also pauses and unpauses the simulation. Note that some simulations quickly become large enough to take several seconds between updates. Don't worry: when you pause, the current simulation step will finish.

There are several collapsible headers which you can open to modify this simulation, those include Simulation globals such as viscosity and flow speed, Flow structures such as solid bodies, vortex blobs, and tracers, and Rendering parameters. Some changes you make in these fields will affect the simulation immediately, but most will require you to Reset.

Run a batch job

If you already have an input file in JSON format, or you exported one from the GUI, you can run a batch (no GUI) simulation with

./Omega3Dbatch.bin input.json

Output will be written to the terminal and files to the working directory.

To do

Tasks to consider or implement:

  • Add GUI checkbox for saving the per-step status file
  • Add measure feature for 3D grid of values
  • Add option to only compute vels on fldpts when a vtu file is written - saves time
  • Make the freestream a formula-entry system as well
  • Standardize the core function selection: put it in the GUI, update the moments for aVRM, update flops, use new shader
  • Get compute shader evaluation to work when called within vtu-writing
  • Get BEM working for moving bodies
  • Allow general rectangles - use the ips to scale panel sizes
  • Use Eigen's Quaternion to represent rotations internally, but load them in as axis-angle
  • Consider using libigl to find point-mesh closest point queries
  • Instead of manipulating the projection matrix, have the mouse change the view matrix (assume model matrix is unity), see here for a nice write-up on the three OpenGL matrices
  • Add arcball rotation to the viewport - see here for some glm code
  • Add other repos as submodules, or just by copying? submodule add https://...xxx.git thirdparty/xxx

Thanks

This project is funded by the National Institutes of Health (NIH) under grant number 1 R01 EB022180-01A1 ("A Fast High-Order CFD for Turbulent Flow Simulation in Cardio-Devices").

Thanks to Omar Cornut for his dear imgui library, file browser dialogs from Imgui-IGS-Snippets, sol-prog's OpenGL Tutorials, Jim Susinno's OpenGL-Boilerplate, and the miniz compression library. Reading triangle mesh files was easy with libigl.

VRM code is functional thanks to jlblancoc for Nanoflann (a header-only tree search library), and to all of the developers of Eigen (a C++ matrix/vector library). The BEM code also relies heavily on Eigen. We also love Vc, an excellent SIMD library by Matthias Kretz.

JSON reading and writing is thanks to JSON for Modern C++ by Niels Lohmann. XML output to VTK files is done using tinyxml2 and cppcodec for base64 encoding. And mathematical expression parsing came from Lewis Van Winkle's tinyexpr.

Many thanks to NBL for valuable discussions of architecture and C++ syntax and idioms.

omega3d's People

Contributors

bhill96 avatar markstock avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

omega3d's Issues

Draw 3D stuff better

Both drawing boundaries (triangles) and particles (billboards) can be better, as can upgrading the view from orthogonal to perspective. There are three tasks here.

  1. Render in perspective, this means implementing an arcball-like rotation and an allowance to move the center of rotation.
  2. Render boundaries as solid with basic direct and ambient lighting.
  3. Instead of drawing billboards with transparency (costly with lots of overlap, and difficulty when depth culling), we may consider using instanced rendering or geometry shaders to convert each point into a screen-space fan of 7 or 9 opaque triangles. I have code for that in my lidar viewer. With the size ratio properly set, this would look much more 3D.

Crash when json on command line doesn't exist

When running something like Omega3D.bin threeblobs.json where the json file does not exist, the program crashes with the following ugly error:

Omega3D.bin: /home/mstock/asr/version3/Omega3D/src/json/json.hpp:17944: const value_type& nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::operator[](T*) const [with T = const char; ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::const_reference = const nlohmann::basic_json<>&; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::value_type = nlohmann::basic_json<>]: Assertion `m_value.object->find(key) != m_value.object->end()' failed.
Aborted (core dumped)

What should happen is the program opens, and a dialog opens saying that we couldn't find that file.

When editing a feature, the feature's existing properties need to be used

It seems that if I have more than one of a type of feature (vortex blob, for example), and I edit the first blob that I made, the edit dialog is populated with the properties from the latest blob that was made/edited. I would expect to have it populated with the specific blob's properties instead.

File IO window for Geometry Files won't resize

When trying to add a 3D model through a .obj file on Mac, the file selection window will not keep its new window size when clicking on the resize tab. It snaps back to its original size.

Add Torus as boundary Feature

It is currently used to draw vortex rings pre-sim, but would be a cool object to add. This would require #6 to be implemented first to use for generate_draw_geom.

Create boundaries from Quad

In 2D we make our boundaries from boundary segments. We should be doing the same here with boundary quads.

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.