Lagrangian Liquid Simulation
Master Thesis project on simulation of liquids using Lagrangian approach and SPH
|
stores all attributes for a fluid for use with SPH More...
#include <FluidParticle.h>
Public Member Functions | |
FluidParticle () | |
ctor | |
FluidParticle (const FluidParticle &_fluidParticle) | |
ctor | |
FluidParticle (const int _id, const ngl::Real _mass=0, const ngl::Real _density=0, const ngl::Vector _position=0, const ngl::Vector _velocity=0, const ngl::Real _viscosityConstant=0, const ngl::Real _gasConstant=0, const ngl::Real _surfaceTensionCoefficient=0, const ngl::Real _surfaceTensionThreshold=0, const ngl::Real _surfaceColorCoefficient=0, const ngl::Real _interfaceTensionCoefficient=0, const ngl::Real _interfaceTensionThreshold=0, const ngl::Real _interfaceColorCoefficient=0, const ngl::Colour _colour=0, const ngl::Real _radius=0, const std::string _name="na", const bool _waitUntilFirstHitBoundary=false, const bool _waitUntilFirstHitRBD=false) | |
ctor | |
~FluidParticle () | |
dtor | |
void | calculatePressure () |
calculate the scalar pressure | |
void | resetForce () |
reset the accumulated force | |
std::string | getName () const |
get the name of the fluid to which this particle belongs to | |
ngl::Vector | getPressureForce () const |
get the pressure force | |
void | setPressureForce (const ngl::Vector _f) |
set the pressure force | |
ngl::Vector | getViscosityForce () const |
get the viscosity force | |
void | setViscosityForce (const ngl::Vector _f) |
set the viscosity force | |
ngl::Vector | getSurfaceTensionForce () const |
get the surface tension force | |
void | setSurfaceTensionForce (const ngl::Vector _f) |
set the surface tension force | |
ngl::Vector | getInterfaceTensionForce () const |
get the interface tension force | |
void | setInterfaceTensionForce (const ngl::Vector _f) |
set the interface tension force | |
ngl::Vector | getGravityForce () const |
get the gravitational force | |
void | setGravityForce (const ngl::Vector _f) |
set the gravitational force | |
ngl::Real | getPressure () const |
get the pressure | |
ngl::Real | getDensity () const |
get the density | |
void | setDensity (const ngl::Real _d) |
set the density | |
ngl::Real | getMaterialRestDensity () const |
get the rest density | |
void | setMaterialRestDensity (const ngl::Real _v) |
set the rest density | |
ngl::Real | getGasConstant () const |
get the gas constant | |
void | setGasConstant (const ngl::Real _c) |
set the gas constant force | |
ngl::Real | getViscosityConstant () const |
get the viscosity constant | |
void | setViscosityConstant (const ngl::Real _c) |
set the viscosity constant | |
ngl::Real | getSurfaceTensionCoefficient () const |
get the surface tension coefficient | |
void | setSurfaceTensionCoefficient (const ngl::Real _c) |
set the surface interface coefficient | |
ngl::Real | getSurfaceTensionThreshold () const |
get the surface tension threshold | |
void | setSurfaceTensionThreshold (const ngl::Real _c) |
set the surface tension threshold | |
ngl::Real | getSurfaceColorCoefficient () const |
get the surface tension color | |
void | setSurfaceColorCoefficient (const ngl::Real _c) |
set the surface color | |
ngl::Real | getInterfaceTensionCoefficient () const |
get the interface tension coefficient | |
void | setInterfaceTensionCoefficient (const ngl::Real _c) |
set the surface tension coefficient | |
ngl::Real | getInterfaceTensionThreshold () const |
get the interface tension threshold | |
void | setInterfaceTensionThreshold (const ngl::Real _c) |
set the interface tension threshold | |
ngl::Real | getInterfaceColorCoefficient () const |
get the interface tension color | |
void | setInterfaceColorCoefficient (const ngl::Real _c) |
set the interface color | |
void | updateHitForTheFirstTime (const bool _hitBoundary, const bool _hitRBD) |
update the properties of the particle to check when it can start behaving as a fluid | |
bool | fluidRulesEnabled () const |
check if particle can act as a fluid | |
void | setWaitUntilFirstHitBoundary (const bool _v) |
set flag to determine if object can behave as a fluid when first hit the boundary | |
void | setWaitUntilFirstHitRBD (const bool _v) |
set flag to determine if object can behave as a fluid when first hit the rbds | |
Private Attributes | |
std::string | m_name |
name of fluid for identification by user later on | |
ngl::Vector | m_pressureForce |
pressure force | |
ngl::Vector | m_viscosityForce |
viscosity force | |
ngl::Vector | m_surfaceTensionForce |
surface tension force | |
ngl::Vector | m_interfaceTensionForce |
interface tension force | |
ngl::Vector | m_gravityForce |
gravity force | |
ngl::Real | m_density |
density at particle | |
ngl::Real | m_materialRestDensity |
rest density at particle | |
ngl::Real | m_pressure |
pressure at particle | |
ngl::Real | m_viscosityConstant |
viscosity constant | |
ngl::Real | m_gasConstant |
gas constant | |
ngl::Real | m_surfaceTensionCoefficient |
surface tension coefficient | |
ngl::Real | m_surfaceTensionThreshold |
surface tension threshold | |
ngl::Real | m_surfaceColorCoefficient |
surface color coefficient | |
ngl::Real | m_interfaceTensionCoefficient |
interface tension coefficient | |
ngl::Real | m_interfaceTensionThreshold |
interface tension threshold | |
ngl::Real | m_interfaceColorCoefficient |
interface color coefficient | |
bool | m_hasHitEnvironmentYet |
flag to show whether the particle has hit the environment yet | |
bool | m_waitUntilFirstHitBoundary |
flag to set whether particle wait until first hit the boundary before behaving as a fluid | |
bool | m_waitUntilFirstHitRBD |
flag to set whether particle wait until first hit the rbd before behaving as a fluid |
stores all attributes for a fluid for use with SPH
Definition at line 16 of file FluidParticle.h.
FluidParticle::FluidParticle | ( | ) |
FluidParticle::FluidParticle | ( | const FluidParticle & | _fluidParticle | ) |
ctor
Definition at line 12 of file FluidParticle.cpp.
References getDensity(), getGasConstant(), getInterfaceColorCoefficient(), getInterfaceTensionCoefficient(), getInterfaceTensionThreshold(), getMaterialRestDensity(), getName(), getPressure(), getSurfaceColorCoefficient(), getSurfaceTensionCoefficient(), getSurfaceTensionThreshold(), getViscosityConstant(), m_hasHitEnvironmentYet, m_waitUntilFirstHitBoundary, and m_waitUntilFirstHitRBD.
: Particle ( _particle.getId(), _particle.getMass(), _particle.getPosition(), _particle.getColour(), _particle.getRadius(), _particle.getMoveable(), _particle.getVelocity(), _particle.getAcceleration(), _particle.getNetForce() ) { m_name = _particle.getName(); m_density = _particle.getDensity(); m_materialRestDensity =_particle.getMaterialRestDensity(); m_pressure = _particle.getPressure(); m_viscosityConstant = _particle.getViscosityConstant(); m_gasConstant = _particle.getGasConstant(); m_surfaceTensionCoefficient = _particle.getSurfaceTensionCoefficient(); m_surfaceTensionThreshold = _particle.getSurfaceTensionThreshold(); m_surfaceColorCoefficient = _particle.getSurfaceColorCoefficient(); m_interfaceTensionCoefficient = _particle.getInterfaceTensionCoefficient(); m_interfaceTensionThreshold = _particle.getInterfaceTensionThreshold(); m_interfaceColorCoefficient = _particle.getInterfaceColorCoefficient(); m_hasHitEnvironmentYet = _particle.m_hasHitEnvironmentYet; m_waitUntilFirstHitBoundary = _particle.m_waitUntilFirstHitBoundary; m_waitUntilFirstHitRBD = _particle.m_waitUntilFirstHitRBD; }
FluidParticle::FluidParticle | ( | const int | _id, |
const ngl::Real | _mass = 0 , |
||
const ngl::Real | _density = 0 , |
||
const ngl::Vector | _position = 0 , |
||
const ngl::Vector | _velocity = 0 , |
||
const ngl::Real | _viscosityConstant = 0 , |
||
const ngl::Real | _gasConstant = 0 , |
||
const ngl::Real | _surfaceTensionCoefficient = 0 , |
||
const ngl::Real | _surfaceTensionThreshold = 0 , |
||
const ngl::Real | _surfaceColorCoefficient = 0 , |
||
const ngl::Real | _interfaceTensionCoefficient = 0 , |
||
const ngl::Real | _interfaceTensionThreshold = 0 , |
||
const ngl::Real | _interfaceColorCoefficient = 0 , |
||
const ngl::Colour | _colour = 0 , |
||
const ngl::Real | _radius = 0 , |
||
const std::string | _name = "na" , |
||
const bool | _waitUntilFirstHitBoundary = false , |
||
const bool | _waitUntilFirstHitRBD = false |
||
) |
ctor
[in] | _id | the id |
[in] | _mass | the mass |
[in] | _density | the density |
[in] | _position | the position |
[in] | _velocity | the velocity |
[in] | _viscosityConstant | the viscosity constant |
[in] | _gasConstant | the gas constant |
[in] | _surfaceTensionCoefficient | the surface tension coefficient |
[in] | _surfaceTensionThreshold | the surface tension threshold |
[in] | _surfaceColorCoefficient | the surface tension color |
[in] | _interfaceTensionCoefficient | the interface tension coefficient |
[in] | _interfaceTensionThreshold | the interface tension threshold |
[in] | _interfaceColorCoefficient | the interface tension color |
[in] | _colour | the visual colour of the particle |
[in] | _radius | the radius |
[in] | _name | the name of the fluid to which this particle belongs |
[in] | _waitUntilFirstHitBoundary | flag to determine whether the particle hits boundary first before behaving as a fluid |
[in] | _waitUntilFirstHitRBD | flag to determine whether the particle hits rbd first before behaving as a fluid |
Definition at line 52 of file FluidParticle.cpp.
: Particle(_id, _mass, _position, _colour, _radius, true, _velocity) { //init params m_name = _name; m_density = _density; m_materialRestDensity = _density; m_pressure = 0; m_viscosityConstant = _viscosityConstant; m_gasConstant = _gasConstant; m_surfaceTensionCoefficient = _surfaceTensionCoefficient; m_surfaceTensionThreshold = _surfaceTensionThreshold; m_surfaceColorCoefficient = _surfaceColorCoefficient; m_interfaceTensionCoefficient = _interfaceTensionCoefficient; m_interfaceTensionThreshold = _interfaceTensionThreshold; m_interfaceColorCoefficient = _interfaceColorCoefficient; m_hasHitEnvironmentYet = false; m_waitUntilFirstHitBoundary = _waitUntilFirstHitBoundary; m_waitUntilFirstHitRBD = _waitUntilFirstHitRBD; }
FluidParticle::~FluidParticle | ( | ) |
void FluidParticle::calculatePressure | ( | ) |
calculate the scalar pressure
Definition at line 102 of file FluidParticle.cpp.
References m_density, m_gasConstant, m_materialRestDensity, and m_pressure.
{ //modified ideal gas state equation m_pressure = m_gasConstant * (m_density - m_materialRestDensity); }
bool FluidParticle::fluidRulesEnabled | ( | ) | const [inline] |
check if particle can act as a fluid
Definition at line 196 of file FluidParticle.h.
References m_hasHitEnvironmentYet, m_waitUntilFirstHitBoundary, and m_waitUntilFirstHitRBD.
{ return (m_waitUntilFirstHitBoundary || m_waitUntilFirstHitRBD) ? m_hasHitEnvironmentYet : true; }
ngl::Real FluidParticle::getDensity | ( | ) | const [inline] |
get the density
Definition at line 117 of file FluidParticle.h.
References m_density.
{ return m_density; }
ngl::Real FluidParticle::getGasConstant | ( | ) | const [inline] |
get the gas constant
Definition at line 131 of file FluidParticle.h.
References m_gasConstant.
{ return m_gasConstant; }
ngl::Vector FluidParticle::getGravityForce | ( | ) | const [inline] |
get the gravitational force
Definition at line 107 of file FluidParticle.h.
References m_gravityForce.
{ return m_gravityForce; }
ngl::Real FluidParticle::getInterfaceColorCoefficient | ( | ) | const [inline] |
get the interface tension color
Definition at line 180 of file FluidParticle.h.
References m_interfaceColorCoefficient.
{ return m_interfaceColorCoefficient; }
ngl::Real FluidParticle::getInterfaceTensionCoefficient | ( | ) | const [inline] |
get the interface tension coefficient
Definition at line 166 of file FluidParticle.h.
References m_interfaceTensionCoefficient.
{ return m_interfaceTensionCoefficient; }
ngl::Vector FluidParticle::getInterfaceTensionForce | ( | ) | const [inline] |
get the interface tension force
Definition at line 100 of file FluidParticle.h.
References m_interfaceTensionForce.
{ return m_interfaceTensionForce; }
ngl::Real FluidParticle::getInterfaceTensionThreshold | ( | ) | const [inline] |
get the interface tension threshold
Definition at line 173 of file FluidParticle.h.
References m_interfaceTensionThreshold.
{ return m_interfaceTensionThreshold; }
ngl::Real FluidParticle::getMaterialRestDensity | ( | ) | const [inline] |
get the rest density
Definition at line 124 of file FluidParticle.h.
References m_materialRestDensity.
{ return m_materialRestDensity; }
std::string FluidParticle::getName | ( | ) | const [inline] |
get the name of the fluid to which this particle belongs to
Definition at line 76 of file FluidParticle.h.
References m_name.
{ return m_name; }
ngl::Real FluidParticle::getPressure | ( | ) | const [inline] |
get the pressure
Definition at line 114 of file FluidParticle.h.
References m_pressure.
{ return m_pressure; }
ngl::Vector FluidParticle::getPressureForce | ( | ) | const [inline] |
get the pressure force
Definition at line 79 of file FluidParticle.h.
References m_pressureForce.
{ return m_pressureForce; }
ngl::Real FluidParticle::getSurfaceColorCoefficient | ( | ) | const [inline] |
get the surface tension color
Definition at line 159 of file FluidParticle.h.
References m_surfaceColorCoefficient.
{ return m_surfaceColorCoefficient; }
ngl::Real FluidParticle::getSurfaceTensionCoefficient | ( | ) | const [inline] |
get the surface tension coefficient
Definition at line 145 of file FluidParticle.h.
References m_surfaceTensionCoefficient.
{ return m_surfaceTensionCoefficient; }
ngl::Vector FluidParticle::getSurfaceTensionForce | ( | ) | const [inline] |
get the surface tension force
Definition at line 93 of file FluidParticle.h.
References m_surfaceTensionForce.
{ return m_surfaceTensionForce; }
ngl::Real FluidParticle::getSurfaceTensionThreshold | ( | ) | const [inline] |
get the surface tension threshold
Definition at line 152 of file FluidParticle.h.
References m_surfaceTensionThreshold.
{ return m_surfaceTensionThreshold; }
ngl::Real FluidParticle::getViscosityConstant | ( | ) | const [inline] |
get the viscosity constant
Definition at line 138 of file FluidParticle.h.
References m_viscosityConstant.
{ return m_viscosityConstant; }
ngl::Vector FluidParticle::getViscosityForce | ( | ) | const [inline] |
get the viscosity force
Definition at line 86 of file FluidParticle.h.
References m_viscosityForce.
{ return m_viscosityForce; }
void FluidParticle::resetForce | ( | ) |
reset the accumulated force
Reimplemented from Particle.
Definition at line 108 of file FluidParticle.cpp.
References m_gravityForce, m_pressureForce, m_surfaceTensionForce, and m_viscosityForce.
{ Particle::resetForce(); m_pressureForce = 0; m_viscosityForce = 0; m_surfaceTensionForce = 0; m_gravityForce = 0; }
void FluidParticle::setDensity | ( | const ngl::Real | _d | ) | [inline] |
set the density
[in] | _d | density value |
Definition at line 121 of file FluidParticle.h.
References m_density.
{ m_density = _d; }
void FluidParticle::setGasConstant | ( | const ngl::Real | _c | ) | [inline] |
set the gas constant force
[in] | _c | value |
Definition at line 135 of file FluidParticle.h.
References m_gasConstant.
{ m_gasConstant = _c; }
void FluidParticle::setGravityForce | ( | const ngl::Vector | _f | ) | [inline] |
set the gravitational force
[in] | _f | force value |
Definition at line 111 of file FluidParticle.h.
References m_gravityForce.
{ m_gravityForce = _f; }
void FluidParticle::setInterfaceColorCoefficient | ( | const ngl::Real | _c | ) | [inline] |
set the interface color
[in] | _c | color value |
Definition at line 184 of file FluidParticle.h.
References m_interfaceColorCoefficient.
{ m_interfaceColorCoefficient = _c; }
void FluidParticle::setInterfaceTensionCoefficient | ( | const ngl::Real | _c | ) | [inline] |
set the surface tension coefficient
[in] | _c | coefficient value |
Definition at line 170 of file FluidParticle.h.
References m_interfaceTensionCoefficient.
{ m_interfaceTensionCoefficient = _c; }
void FluidParticle::setInterfaceTensionForce | ( | const ngl::Vector | _f | ) | [inline] |
set the interface tension force
[in] | _f | force value |
Definition at line 104 of file FluidParticle.h.
References m_interfaceTensionForce.
{ m_interfaceTensionForce = _f; }
void FluidParticle::setInterfaceTensionThreshold | ( | const ngl::Real | _c | ) | [inline] |
set the interface tension threshold
[in] | _c | threshold value |
Definition at line 177 of file FluidParticle.h.
References m_interfaceTensionThreshold.
{ m_interfaceTensionThreshold = _c; }
void FluidParticle::setMaterialRestDensity | ( | const ngl::Real | _v | ) | [inline] |
set the rest density
[in] | _v | density value |
Definition at line 128 of file FluidParticle.h.
References m_materialRestDensity.
{ m_materialRestDensity = _v; }
void FluidParticle::setPressureForce | ( | const ngl::Vector | _f | ) | [inline] |
set the pressure force
[in] | _f | force value |
Definition at line 83 of file FluidParticle.h.
References m_pressureForce.
{ m_pressureForce = _f; }
void FluidParticle::setSurfaceColorCoefficient | ( | const ngl::Real | _c | ) | [inline] |
set the surface color
[in] | _c | color value |
Definition at line 163 of file FluidParticle.h.
References m_surfaceColorCoefficient.
{ m_surfaceColorCoefficient = _c; }
void FluidParticle::setSurfaceTensionCoefficient | ( | const ngl::Real | _c | ) | [inline] |
set the surface interface coefficient
[in] | _c | coefficient value |
Definition at line 149 of file FluidParticle.h.
References m_surfaceTensionCoefficient.
{ m_surfaceTensionCoefficient = _c; }
void FluidParticle::setSurfaceTensionForce | ( | const ngl::Vector | _f | ) | [inline] |
set the surface tension force
[in] | _f | force value |
Definition at line 97 of file FluidParticle.h.
References m_surfaceTensionForce.
{ m_surfaceTensionForce = _f; }
void FluidParticle::setSurfaceTensionThreshold | ( | const ngl::Real | _c | ) | [inline] |
set the surface tension threshold
[in] | _c | threshold value |
Definition at line 156 of file FluidParticle.h.
References m_surfaceTensionThreshold.
{ m_surfaceTensionThreshold = _c; }
void FluidParticle::setViscosityConstant | ( | const ngl::Real | _c | ) | [inline] |
set the viscosity constant
[in] | _c | value |
Definition at line 142 of file FluidParticle.h.
References m_viscosityConstant.
{ m_viscosityConstant = _c; }
void FluidParticle::setViscosityForce | ( | const ngl::Vector | _f | ) | [inline] |
set the viscosity force
[in] | _f | force value |
Definition at line 90 of file FluidParticle.h.
References m_viscosityForce.
{ m_viscosityForce = _f; }
void FluidParticle::setWaitUntilFirstHitBoundary | ( | const bool | _v | ) | [inline] |
set flag to determine if object can behave as a fluid when first hit the boundary
[in] | _v | flag value |
Definition at line 200 of file FluidParticle.h.
References m_waitUntilFirstHitBoundary.
{ m_waitUntilFirstHitBoundary = _v; }
void FluidParticle::setWaitUntilFirstHitRBD | ( | const bool | _v | ) | [inline] |
set flag to determine if object can behave as a fluid when first hit the rbds
[in] | _v | flag value |
Definition at line 204 of file FluidParticle.h.
References m_waitUntilFirstHitRBD.
{ m_waitUntilFirstHitRBD = _v; }
void FluidParticle::updateHitForTheFirstTime | ( | const bool | _hitBoundary, |
const bool | _hitRBD | ||
) |
update the properties of the particle to check when it can start behaving as a fluid
[in] | _hitBoundary | flag to determine if object hit boundary |
[in] | _hitRBD | flag to determine if object hit rbd |
Definition at line 119 of file FluidParticle.cpp.
{ //assume no hit for the first time bool hit1 = false; bool hit2 = false; //access hit status for both boundary and rbd if (m_waitUntilFirstHitBoundary && _hitBoundary )hit1 = true; if (m_waitUntilFirstHitRBD && _hitRBD )hit2 = true; //either boundary hit or rbd hit implies hit for the first time has occured m_hasHitEnvironmentYet = hit1 || hit2; }
ngl::Real FluidParticle::m_density [private] |
density at particle
Definition at line 226 of file FluidParticle.h.
ngl::Real FluidParticle::m_gasConstant [private] |
gas constant
Definition at line 238 of file FluidParticle.h.
ngl::Vector FluidParticle::m_gravityForce [private] |
gravity force
Definition at line 223 of file FluidParticle.h.
bool FluidParticle::m_hasHitEnvironmentYet [private] |
flag to show whether the particle has hit the environment yet
Definition at line 259 of file FluidParticle.h.
ngl::Real FluidParticle::m_interfaceColorCoefficient [private] |
interface color coefficient
Definition at line 256 of file FluidParticle.h.
ngl::Real FluidParticle::m_interfaceTensionCoefficient [private] |
interface tension coefficient
Definition at line 250 of file FluidParticle.h.
ngl::Vector FluidParticle::m_interfaceTensionForce [private] |
interface tension force
Definition at line 220 of file FluidParticle.h.
ngl::Real FluidParticle::m_interfaceTensionThreshold [private] |
interface tension threshold
Definition at line 253 of file FluidParticle.h.
ngl::Real FluidParticle::m_materialRestDensity [private] |
rest density at particle
Definition at line 229 of file FluidParticle.h.
std::string FluidParticle::m_name [private] |
name of fluid for identification by user later on
Definition at line 208 of file FluidParticle.h.
ngl::Real FluidParticle::m_pressure [private] |
pressure at particle
Definition at line 232 of file FluidParticle.h.
ngl::Vector FluidParticle::m_pressureForce [private] |
pressure force
Definition at line 211 of file FluidParticle.h.
ngl::Real FluidParticle::m_surfaceColorCoefficient [private] |
surface color coefficient
Definition at line 247 of file FluidParticle.h.
ngl::Real FluidParticle::m_surfaceTensionCoefficient [private] |
surface tension coefficient
Definition at line 241 of file FluidParticle.h.
ngl::Vector FluidParticle::m_surfaceTensionForce [private] |
surface tension force
Definition at line 217 of file FluidParticle.h.
ngl::Real FluidParticle::m_surfaceTensionThreshold [private] |
surface tension threshold
Definition at line 244 of file FluidParticle.h.
ngl::Real FluidParticle::m_viscosityConstant [private] |
viscosity constant
Definition at line 235 of file FluidParticle.h.
ngl::Vector FluidParticle::m_viscosityForce [private] |
viscosity force
Definition at line 214 of file FluidParticle.h.
bool FluidParticle::m_waitUntilFirstHitBoundary [private] |
flag to set whether particle wait until first hit the boundary before behaving as a fluid
Definition at line 262 of file FluidParticle.h.
bool FluidParticle::m_waitUntilFirstHitRBD [private] |
flag to set whether particle wait until first hit the rbd before behaving as a fluid
Definition at line 265 of file FluidParticle.h.