model

package
v0.0.0-...-ddc071b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2023 License: GPL-3.0 Imports: 3 Imported by: 1

README

SPH FLuid Model

Overview

dslfluid/model package provides interfaces and functional patterns for working with fluid libraries. Also provides a special interface to the GPU

Notes
  • Density field kernel methods will utilize a new correction method for Smoothed Particle fields known as the Spatial Corrective Variance Procedure. Step 1: Calculated Per Particle Guassian Neighbor Models. Guassian Mean + Variance should determine stability of the density field estimator. For the corrective procedure we estimate the density valence of each position and initialize a ML error correction algorithm based on MLP which generates target variance augmentation of the estimated neighborhood means.

  • For the Smoothed Particle Method the EOS function and weighted calculations for the density field estimator will be based on a sampled neighbor space for x[N] parameter particles. The distribution of neighbor distances will be sampled and incorporated into a guassian distribution with variance o and mean u. The Density field distributions will then estimate a corrective variance bias for adjusting and smoothing high density fields. These will be corrective variance distributions and accumulate throughout the initialization and correction procedure for a Spatial Corrective Variance Procedure.

Documentation

Index

Constants

View Source
const FLUID_DENSITY = 87.0
View Source
const FLUID_KERN_RAD = 0.2
View Source
const FLUID_MASS = 0.1

Water Model

View Source
const FLUID_SOS = float32(1480.0)
View Source
const FLUID_STIFF = 6.1
View Source
const FLUID_WATER = 0
View Source
const PARTICLE_BOUND = 1
View Source
const PARTICLE_GHOST = 2
View Source
const PARTICLE_SPH = 0

Particle Const Enum Defs

View Source
const SAMPLER_ALL_NEIGHBORS = 3
View Source
const SAMPLER_HEURISTIC_NEIGHBORS = 2
View Source
const SPH_EOS_INF = -1
View Source
const SPH_MESH_COLLIS = 1

Collision Handling

View Source
const SPH_PARTICLE_COLLIS = 2
View Source
const SPH_THREAD_WAITING = 104
View Source
const SPH_VALID = 0

SPH Method Return Values

View Source
const THREAD_DONE = 103
View Source
const THREAD_ERR = 102
View Source
const THREAD_GO = 101
View Source
const THREAD_WAIT = 100

Go Routine Enums:

View Source
const USE_DFSPH = 3
View Source
const USE_FLIP = 5
View Source
const USE_GRID = 4
View Source
const USE_PCISPH = 2
View Source
const USE_STD = 0

SPH IMPLEMENTATION

View Source
const USE_WCSPH = 1
View Source
const VOXEL_CACHE_SAMPLER = 1
View Source
const VOXEL_SAMPLER = 0

SAMPLER Enums

Variables

This section is empty.

Functions

func EosGamma

func EosGamma(x float32, c0 float32, d0 float32, gamma float32, p0 float32) float32

func Float3_buffer_set

func Float3_buffer_set(x int, buffer []float32, b *[3]float32)

Set the a buffer size >= 3 with the size 3 b float32 array

func Float3_set

func Float3_set(x int, a *[3]float32, buffer []float32)

func TaitEos

func TaitEos(x float32, d0 float32, p0 float32) float32

EOS() - Tait Equation of State for Water like incrompressible fluids where gamma maps the stiffess parameter of the fluid with suggested values in the 6.0-7.0 range @param x - density input @param c0 - Speed of sound & reference pressure relation (2.15)gpa @param d0 - Reference density (1000)kg/m^3 or (1.0g/cm^3) @param gamma - Stifness parameter @param p0 - reference pressure for the system (101325 pa) or 1013.25hPA @notes The reference speed of sound c0 is taken to be approximately 10 times the maximum expected velocity for the system if

Types

type Particle

type Particle struct {
	Position [3]float32
	Velocity [3]float32
	Force    [3]float32
	Density  float32
	Press    float32
}

Fixed Particle structure array

func (*Particle) AddForce

func (p *Particle) AddForce(x [3]float32)

func (*Particle) AddPosition

func (p *Particle) AddPosition(x [3]float32)

func (*Particle) AddVelocity

func (p *Particle) AddVelocity(x [3]float32)

func (*Particle) Pressure

func (p *Particle) Pressure(d0 float32, p0 float32) float32

func (*Particle) SetForce

func (p *Particle) SetForce(x []float32)

func (*Particle) SetPosition

func (p *Particle) SetPosition(x []float32)

func (*Particle) SetVelocity

func (p *Particle) SetVelocity(x []float32)

type ParticleArray

type ParticleArray struct {
	ReferenceDensity float32
	// contains filtered or unexported fields
}

func NewParticleArray

func NewParticleArray(n_particles int, n_boundary int, kernel float32, density float32, mass float32) ParticleArray

Returns the particle array given n particles and n_boundary particles

func (*ParticleArray) AddBoundaryParticles

func (p *ParticleArray) AddBoundaryParticles(positions []float32) []float32

Adds in boundary particle buffer of positions

func (*ParticleArray) D0

func (p *ParticleArray) D0() float32

func (*ParticleArray) Densities

func (p *ParticleArray) Densities() []float32

func (*ParticleArray) Density

func (p *ParticleArray) Density(index int) float32

func (*ParticleArray) Force

func (p *ParticleArray) Force(index int) []float32

func (*ParticleArray) Forces

func (p *ParticleArray) Forces() []float32

func (*ParticleArray) Get

func (p *ParticleArray) Get(index int) Particle

func (*ParticleArray) Mass

func (p *ParticleArray) Mass() float32

func (*ParticleArray) N

func (p *ParticleArray) N() int

func (*ParticleArray) Position

func (p *ParticleArray) Position(index int) []float32

func (*ParticleArray) Positions

func (p *ParticleArray) Positions() []float32

func (*ParticleArray) Pressure

func (p *ParticleArray) Pressure(index int, d0 float32, p0 float32) float32

func (*ParticleArray) Pressures

func (p *ParticleArray) Pressures() []float32

func (*ParticleArray) Set

func (p *ParticleArray) Set(index int, particle Particle)

func (*ParticleArray) SetReferenceDensity

func (p *ParticleArray) SetReferenceDensity(d float32)

func (*ParticleArray) Total

func (p *ParticleArray) Total() int

func (*ParticleArray) Velocities

func (p *ParticleArray) Velocities() []float32

func (*ParticleArray) Velocity

func (p *ParticleArray) Velocity(index int) []float32

type ParticleField

type ParticleField interface {
	Positions() []float32
	Velocities() []float32
	Densities() []float32
	Forces() []float32
	Pressure(x int, d0 float32, p0 float32) float32
	Pressures() []float32
	Density(x int) float32
	Position(x int) []float32
	Velocity(x int) []float32
	Force(x int) []float32
	Mass() float32
	Set(x int, particle Particle)
	Get(x int) Particle
	D0() float32
	AddBoundaryParticles([]float32) []float32
	N() int
	Total() int //Total particles
	SetReferenceDensity(d float32)
}

Particle Field Interface for interacting with both buffer based and struct based particle fields

type ParticleStructField

type ParticleStructField struct {
	Particles []Particle
	Boundary  []float32

	ReferenceDensity float32
	// contains filtered or unexported fields
}

func NewParticleStructField

func NewParticleStructField(n int, kernel float32, density float32, mass float32) ParticleStructField

func (ParticleStructField) AddBoundaryParticles

func (p ParticleStructField) AddBoundaryParticles([]float32)

func (ParticleStructField) D0

func (ParticleStructField) Densities

func (p ParticleStructField) Densities() []float32

func (ParticleStructField) Density

func (p ParticleStructField) Density(x int) float32

func (ParticleStructField) Force

func (p ParticleStructField) Force(x int) []float32

func (ParticleStructField) Forces

func (p ParticleStructField) Forces() []float32

func (ParticleStructField) Get

func (p ParticleStructField) Get(x int) Particle

func (ParticleStructField) Mass

func (p ParticleStructField) Mass() float32

func (ParticleStructField) N

func (p ParticleStructField) N() int

func (ParticleStructField) Position

func (p ParticleStructField) Position(x int) []float32

func (ParticleStructField) Positions

func (p ParticleStructField) Positions() []float32

func (ParticleStructField) Pressure

func (p ParticleStructField) Pressure(x int, d0 float32, p0 float32) float32

func (ParticleStructField) Pressures

func (p ParticleStructField) Pressures() []float32

func (ParticleStructField) Set

func (p ParticleStructField) Set(x int, particle Particle)

func (ParticleStructField) Total

func (p ParticleStructField) Total() int

func (ParticleStructField) Velocities

func (p ParticleStructField) Velocities() []float32

func (ParticleStructField) Velocity

func (p ParticleStructField) Velocity(x int) []float32

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL