Lagrangian Liquid Simulation
Master Thesis project on simulation of liquids using Lagrangian approach and SPH
FluidParticle Class Reference

stores all attributes for a fluid for use with SPH More...

#include <FluidParticle.h>

Inheritance diagram for FluidParticle:
Collaboration diagram for FluidParticle:

List of all members.

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

Detailed Description

stores all attributes for a fluid for use with SPH

Definition at line 16 of file FluidParticle.h.


Constructor & Destructor Documentation

FluidParticle::FluidParticle ( )

ctor

Definition at line 6 of file FluidParticle.cpp.

                             : Particle()
{
    FluidParticle(0);
}
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;
}

Here is the call graph for this function:

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

Parameters:
[in]_idthe id
[in]_massthe mass
[in]_densitythe density
[in]_positionthe position
[in]_velocitythe velocity
[in]_viscosityConstantthe viscosity constant
[in]_gasConstantthe gas constant
[in]_surfaceTensionCoefficientthe surface tension coefficient
[in]_surfaceTensionThresholdthe surface tension threshold
[in]_surfaceColorCoefficientthe surface tension color
[in]_interfaceTensionCoefficientthe interface tension coefficient
[in]_interfaceTensionThresholdthe interface tension threshold
[in]_interfaceColorCoefficientthe interface tension color
[in]_colourthe visual colour of the particle
[in]_radiusthe radius
[in]_namethe name of the fluid to which this particle belongs
[in]_waitUntilFirstHitBoundaryflag to determine whether the particle hits boundary first before behaving as a fluid
[in]_waitUntilFirstHitRBDflag 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 ( )

dtor

Definition at line 98 of file FluidParticle.cpp.

{
}

Member Function Documentation

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.

ngl::Real FluidParticle::getDensity ( ) const [inline]

get the density

Definition at line 117 of file FluidParticle.h.

References m_density.

{ return m_density; }

Here is the caller graph for this function:

ngl::Real FluidParticle::getGasConstant ( ) const [inline]

get the gas constant

Definition at line 131 of file FluidParticle.h.

References m_gasConstant.

{ return m_gasConstant; }

Here is the caller graph for this function:

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.

Here is the caller graph for this function:

ngl::Real FluidParticle::getInterfaceTensionCoefficient ( ) const [inline]

get the interface tension coefficient

Definition at line 166 of file FluidParticle.h.

References m_interfaceTensionCoefficient.

Here is the caller graph for this function:

ngl::Vector FluidParticle::getInterfaceTensionForce ( ) const [inline]

get the interface tension force

Definition at line 100 of file FluidParticle.h.

References m_interfaceTensionForce.

ngl::Real FluidParticle::getInterfaceTensionThreshold ( ) const [inline]

get the interface tension threshold

Definition at line 173 of file FluidParticle.h.

References m_interfaceTensionThreshold.

Here is the caller graph for this function:

ngl::Real FluidParticle::getMaterialRestDensity ( ) const [inline]

get the rest density

Definition at line 124 of file FluidParticle.h.

References m_materialRestDensity.

Here is the caller graph for this function:

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; }

Here is the caller graph for this function:

ngl::Real FluidParticle::getPressure ( ) const [inline]

get the pressure

Definition at line 114 of file FluidParticle.h.

References m_pressure.

{ return m_pressure; }

Here is the caller graph for this function:

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.

Here is the caller graph for this function:

ngl::Real FluidParticle::getSurfaceTensionCoefficient ( ) const [inline]

get the surface tension coefficient

Definition at line 145 of file FluidParticle.h.

References m_surfaceTensionCoefficient.

Here is the caller graph for this function:

ngl::Vector FluidParticle::getSurfaceTensionForce ( ) const [inline]

get the surface tension force

Definition at line 93 of file FluidParticle.h.

References m_surfaceTensionForce.

ngl::Real FluidParticle::getSurfaceTensionThreshold ( ) const [inline]

get the surface tension threshold

Definition at line 152 of file FluidParticle.h.

References m_surfaceTensionThreshold.

Here is the caller graph for this function:

ngl::Real FluidParticle::getViscosityConstant ( ) const [inline]

get the viscosity constant

Definition at line 138 of file FluidParticle.h.

References m_viscosityConstant.

{ return m_viscosityConstant; }

Here is the caller graph for this function:

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.

void FluidParticle::setDensity ( const ngl::Real  _d) [inline]

set the density

Parameters:
[in]_ddensity 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

Parameters:
[in]_cvalue

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

Parameters:
[in]_fforce 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

Parameters:
[in]_ccolor value

Definition at line 184 of file FluidParticle.h.

References m_interfaceColorCoefficient.

void FluidParticle::setInterfaceTensionCoefficient ( const ngl::Real  _c) [inline]

set the surface tension coefficient

Parameters:
[in]_ccoefficient value

Definition at line 170 of file FluidParticle.h.

References m_interfaceTensionCoefficient.

void FluidParticle::setInterfaceTensionForce ( const ngl::Vector  _f) [inline]

set the interface tension force

Parameters:
[in]_fforce value

Definition at line 104 of file FluidParticle.h.

References m_interfaceTensionForce.

void FluidParticle::setInterfaceTensionThreshold ( const ngl::Real  _c) [inline]

set the interface tension threshold

Parameters:
[in]_cthreshold value

Definition at line 177 of file FluidParticle.h.

References m_interfaceTensionThreshold.

void FluidParticle::setMaterialRestDensity ( const ngl::Real  _v) [inline]

set the rest density

Parameters:
[in]_vdensity value

Definition at line 128 of file FluidParticle.h.

References m_materialRestDensity.

void FluidParticle::setPressureForce ( const ngl::Vector  _f) [inline]

set the pressure force

Parameters:
[in]_fforce 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

Parameters:
[in]_ccolor value

Definition at line 163 of file FluidParticle.h.

References m_surfaceColorCoefficient.

void FluidParticle::setSurfaceTensionCoefficient ( const ngl::Real  _c) [inline]

set the surface interface coefficient

Parameters:
[in]_ccoefficient value

Definition at line 149 of file FluidParticle.h.

References m_surfaceTensionCoefficient.

void FluidParticle::setSurfaceTensionForce ( const ngl::Vector  _f) [inline]

set the surface tension force

Parameters:
[in]_fforce value

Definition at line 97 of file FluidParticle.h.

References m_surfaceTensionForce.

void FluidParticle::setSurfaceTensionThreshold ( const ngl::Real  _c) [inline]

set the surface tension threshold

Parameters:
[in]_cthreshold value

Definition at line 156 of file FluidParticle.h.

References m_surfaceTensionThreshold.

void FluidParticle::setViscosityConstant ( const ngl::Real  _c) [inline]

set the viscosity constant

Parameters:
[in]_cvalue

Definition at line 142 of file FluidParticle.h.

References m_viscosityConstant.

void FluidParticle::setViscosityForce ( const ngl::Vector  _f) [inline]

set the viscosity force

Parameters:
[in]_fforce 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

Parameters:
[in]_vflag value

Definition at line 200 of file FluidParticle.h.

References m_waitUntilFirstHitBoundary.

Here is the caller graph for this function:

void FluidParticle::setWaitUntilFirstHitRBD ( const bool  _v) [inline]

set flag to determine if object can behave as a fluid when first hit the rbds

Parameters:
[in]_vflag value

Definition at line 204 of file FluidParticle.h.

References m_waitUntilFirstHitRBD.

Here is the caller graph for this function:

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

Parameters:
[in]_hitBoundaryflag to determine if object hit boundary
[in]_hitRBDflag 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;
}

Member Data Documentation

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.

flag to show whether the particle has hit the environment yet

Definition at line 259 of file FluidParticle.h.

interface color coefficient

Definition at line 256 of file FluidParticle.h.

interface tension coefficient

Definition at line 250 of file FluidParticle.h.

interface tension force

Definition at line 220 of file FluidParticle.h.

interface tension threshold

Definition at line 253 of file FluidParticle.h.

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.

surface color coefficient

Definition at line 247 of file FluidParticle.h.

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.

surface tension threshold

Definition at line 244 of file FluidParticle.h.

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.

flag to set whether particle wait until first hit the boundary before behaving as a fluid

Definition at line 262 of file FluidParticle.h.

flag to set whether particle wait until first hit the rbd before behaving as a fluid

Definition at line 265 of file FluidParticle.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator