Coder Social home page Coder Social logo

jellespijker / fluids Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 43 KB

Solve a steady-state fluid problem. This repo is mirrored from my Gitlab

Home Page: https://gitlab.com/HAN-thesis/fluids

License: MIT License

CMake 5.87% Dockerfile 0.27% C++ 93.86%
fluid-solver boost eigen3

fluids's Introduction

Fluids

Solve a steady-state fluid problem. This project makes use of Boost::units Zero-overhead dimensional analysis and unit/quantity manipulation and conversion.

Use in your own projects

Link to library using cmake, see example CMakeLists.txt below:

cmake_minimum_required(VERSION 3.8)
project(example_program)

find_package(Fluids)

add_executable(example_program example_program.cpp)
target_link_libraries(example_program Fluids::fluids)

Source code:

#include <memory>
#include <iostream>

#include <fluids/Liquid.h>
#include <fluids/Pipes.h>
#include <fluids/System.h>
#include <fluids/Solver.h>

int main (int argc, char *argv[]) {
      Fluids::Liquid water;
      auto system = std::make_shared<Fluids::System>(water, 6);
      auto p0 = std::make_shared<Fluids::Pipes>(0.2 * si::meter, 10. * si::meter, 46e-5 * si::meters);
      system->add_FluidComponent(p0, 0, 1);
      auto p1(p0);
      *p1->Get_Diameter() = 0.3 * si::meter;
      system->add_FluidComponent(p1, 1, 2);
      auto p2(p0);
      *p2->Get_Length() = 20. * si::meter;
      system->add_FluidComponent(p2, 2, 3);
      auto p3(p0);
      system->add_FluidComponent(p3, 3, 4);
      auto p4(p0);
      system->add_FluidComponent(p4, 4, 5);
      auto p5(p0);
      system->add_FluidComponent(p5, 1, 4);
      system->Set_Known_Speed(0, 2 * si::meters_per_second);
      system->Set_Known_Static_Pressure(0, static_cast<quantity<si::pressure>>(2. * si::bar));
      system->Set_Known_Static_Pressure(5, static_cast<quantity<si::pressure>>(1. * si::bar));
      Fluids::Solver solver(system);
      solver.solve();
      std::cout << "The fluid speed at point 1 is: " << *system->Get_Liquid(1)->Get_speed();
}

Dependencies

for development:

Release

The latest main release can be downloaded from:

The latest develop release can be downloaded from:

Build from source

make sure you have Boost, Eigen3 and GTest installed.

$ mkdir build
$ cd build
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
$ make -j 4
$ sudo make install

fluids's People

Contributors

jellespijker 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.