GithubHelp home page GithubHelp logo

demezy / sphsimulation Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 9.24 MB

Physical based liquid simulation tool written in haskell

License: BSD 3-Clause "New" or "Revised" License

Haskell 100.00%

sphsimulation's Issues

value at point

valueAtPoint :: Position -> smothering Length -> Kernel function -> Ai (see below) -> value

Ai :: (Particle -> Position -> value)

formulas are available in pdf.

if/any question, contact @Demezy

setup configuration

You need to change FluidConfig to get real water near result.

You may use settings provided in the pdf with formulas or found new ones

render particle

This is base for future rendering system.

renderParticle :: Particle -> Picture

for now just place gradient circle in the position of particle.
For gradient use:

knowledge base

Form a knowledge base for current project.

criteria:

  • describe physical sense of simulation
  • provide summary from assignment (formulas,etc)
  • page for program structure

Solid

implement data storage and access methods for:

  • isMovable :: bool
  • shape :: for now some stub
  • renderFunction :: Solid -> Picture

if/any questions, contact @Demezy or @Skril3366

find neigbors

findNeighbors :: [Particle] -> Position -> smothering Length -> [Particle]

findNeighbors particles' position len = ...
this function find all particles in particles' in the area of the radius len and center in position.

optimize density computing

density for each particle is currently computing 1 time for each force (pressure, viscosity, tension)
Fix that

Configure building system

  • provide cabal config
  • test that it works
  • write to readme.md command
  • test with stack
  • if works as well note it in readme.md

test approach to group particles

The model:

  • particles that located nearby can be grouped.
  • Such group have a center of mass, all forces can be computed according to it.
  • Then, each particle in the group get changes in velocity according to the changes of the group

You need to determine is this model more suitable or not. Then, contact @Demezy

implement universe type

implement the universe type with following attributes:

  • time multiplier (speed of simulation)
  • acceleration of gravity (direction and force)
  • walls storage
  • fluid storage

Universe

implement data storage and access methods for:

  • simulation scale :: (Float, Float)
  • #26
  • particles :: list of #29
  • solids :: list of #27

if/any questions, contact @Demezy

include rendering library

  • find library name in PDF provided by prof. Kudasov
  • include it in project
  • test it
  • provide link to documentation in readme.md

Implement time passing

Implement time passing, assuming University as a state.
Make sure to test it out (i. e. spawn several particles with pre-defined velocity, all of them should be moved and displayed properly)

interpolation function

InterpolationFunction :: value -> value -> phase -> value

This function takes two values and return new value between arguments with respect to phase.

Common example is gradient.

Particle

implement data storage and access methods for:

  • r - position :: Point
  • v - velocity :: Vector
  • #31

if/any questions, contact @Demezy

Implement walls type

Implement walls as a segments (preferable) or lines. You can think of it as of 1-dimensional border. Implement the following features:

  • collisions with particles
  • render function for walls

Make sure to test collisions (i. e. spawn particles with pre-defined velocity and make them collide against the wall)

fluid config

implement data storage and access methods for:

  • h - smothering length :: Double
  • k - stiffness :: double
  • c - colouring :: Color
  • m - mass of particle :: double
  • v - viscosity :: double
  • o - surface tension :: double
  • density kernel :: ?
  • pressure kernel :: ?
  • viscosity kernel :: ?
  • tension kernel :: ?

if/any questions, contact @Demezy

test lab implementation

  • as a core use implementation of n-body simulation from lab
  • test how it behaves with N particles, where N is:
    • 100
    • 200
    • 500
    • 1000
    • 2000
    • 4000
    • if perform well continue till significant freezes

criteria:

  • simple statistics
  • relation between N and time for 1 second simulation
  • verdict is it performs well or not

fancy liquids

criteria:

  • fluid particles unite in one paddle
  • different fluids can be mixed as well (see screenshot in assignment)

include QuadTree

  • Implement QuadTree data structure for a general item.
  • use this DS to replace findNeighbors function algorithm .

Criteria:

  • provide methods to add new nodes
  • remove nodes
  • search nodes in given range

Enviroment

implement data storage and access methods for:

  • time multiplier :: Double
  • direction of gravity :: vector
  • gravity acceleration :: double
  • density of enviroment :: double

if/any questions, contact @Demezy

gravity of particle

gravityForceOfParticle :: Partcicle -> Enviroment -> Force

formula is available in our PDF.

You should use:

  • #26 as source of constants
  • #32 force type

apply velocity

applyVelocity :: Particle -> time -> Particle

this function move point according to its velocity

implement math functions

provide:

  • functions from assignment paper written in Haskell
  • filter for interacting particles range

implement functional required in Object.hs (kernel functions)

particles storage

develop model to store particle objects.

determine place for:

  • coordinates
  • velocity vector
  • velocity itself
  • particles themself
  • properties

Properties:

  • Color
  • fluid type

criteria:

  • provided access functions for fields.
  • all necessary information stored
  • system is easy to configure and develop
  • easy to introduce new types of points

code guideline

Provide code guideline for:

  • objects structure
  • access methods etc
  • module structure
  • curvy braces tricks

Requirements:

  • code is easy to extend
  • logic is separated from data structure
  • page in Knowledge base

pressure of particle

pressureOfParticle :: Particle -> Enviroment -> value

formula is available in pdf.

You should use:

apply force

applyForce :: Particle -> Force -> time -> Particle

this function change velocity according to applied force

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.