Giter Club home page Giter Club logo

orc's Introduction

Open Rust CFD: A 3D, unstructured computational fluid dynamics (CFD) solver

Couette flow contour plots

Are you tired of Fluent crashing (I thought so!) and you don't care about features or performance (ok, maybe not)? ORC is a simple finite volume CFD solver implemented in Rust with minimal dependencies. ORC supports arbitrary unstructured grids with the following numerical schemes and details:

  • Co-located grid
  • Algebraic multigrid solver with BiCGSTAB, Jacobi, or Gauss-Seidel smoothing (GMRES will be evaluated)
  • Pressure-velocity coupling: SIMPLE (coupled solver may be added later)
  • Momentum discretization: UD, CD, LUD, QUICK, UMIST, or any arbitrary TVD flux limiter scheme.
  • Gradient reconstruction: Green-Gauss cell-based (least squares may be added)
  • Pressure interpolation: linear and second-order
  • Velocity interpolation: linear and Rhie-Chow distance-based

Alpha state with major stability issues. Pressure relaxation factor must be very small to converge to the correct solution. As the pressure relaxation factor increases, the solution fields become extremely spurious.

Supported cell types:

  • Tetrahedron (4 faces, 4 nodes)
  • Pyramid (5 faces, 5 nodes)
  • Wedge (5 faces, 6 nodes)
  • Hexahedron (6 faces, 8 nodes)
  • Polyhedron (M faces, N nodes)

Supported boundary conditions:

  • Wall
  • Pressure outlet
  • Pressure inlet
  • Velocity inlet (unfinished)
  • Symmetry

Roadmap:

  • Read TGRID (ANSYS Fluent) mesh into memory
  • Build solution matrices
  • Initialize flow (90% complete)
  • Iterate steady
  • Add under-relaxation
  • Implement Rhie-Chow interpolation (very unstable for now)
  • Improve Rhie-Chow stability or use another scheme
  • Fix velocity inlet BC (50%)
  • Add moving wall BC (50%)
  • Implement bounded high-order momentum schemes, e.g. Jasak et al.'s bounded central differencing
  • Add cross diffusion correction
  • Multigrid
  • Read/write solution data
  • Read/write settings?
  • Replace panics with proper error handling
  • CLI
  • Iterate transient
  • Standard k-epsilon turbulence model?
  • Add other mesh formats?
  • Add validation of canonical flows
  • Optimize performance (20%; preliminary profiling and adjustment has been done)
  • Polish logging - ideally write error/warn/info to console and everything to file, all depending on RUST_LOG env var

Validation: Only very preliminary validation has been performed. As seen below, the velocity profile for steady, Couette flow exactly matches the analytical profile. Couette flow velocity profile

orc's People

Contributors

reidprichard avatar

Watchers

 avatar

orc's Issues

High-order momentum schemes diverge when continuing from nearly-converged data

When using higher-order schemes, e.g. TVD_QUICK, stopping and restarting an otherwise-stable simulation can cause divergence. In other words, you can have the following situation:

  • Case A:
    • Run the solver for 50k timesteps with TVD_QUICK
    • Save your data
    • Attempt to resume the solver with TVD_QUICK -> solver diverges
    • Attempt to resume the solver with UD -> solver does not diverge
  • Case B:
    • Run the solver with the same settings, mesh, etc. as Case A for 100k timesteps
    • Solver makes it to 100k without issue
    • Save your data
    • Attempt to resume the solver with TVD_QUICK -> solver diverges
    • Attempt to resume the solver with UD -> solver does not diverge

Currently, my only thought is that truncation error in the saved data introduces sharp local gradients that make high-order schemes become unstable. I would think 8 sig figs would be enough for the channel flow example, but I will try increasing this value.

Solver nondeterministically diverges

With no internal or external changes, sometimes ORC will diverge and sometimes it will converge. This issue occurs:

  • With all iterative solver types (though it seems like it might happen more often with multigrid and/or BiCGSTAB)
  • With and without --release optimization
  • With and without multi-threaded solution of u, v, w
  • At random iteration numbers - sometimes right off the bat, sometimes 1k iterations in, sometimes 30k iterations in.

It seems that it's not a question of if this occurs, but when.

Hashes are known to cause nondeterministic behavior in Rust, as the hashing function is chosen randomly, so it might be worth trying:

  • Iterating over HashMap keys (e.g. for cell_index in 0..mesh.cells.len()) rather than key/value pairs (e.g. for (cell_index, cell) in mesh.cells) to force constant order
  • Specify a user-defined hashing function
  • Switch from HashMap to BTreeMap (this may have performance benefits as well)

Other than that, my only thought is that nalgebra_sparse contains some unsafe code that is causing issues.

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.