MPS-Basic
Loading...
Searching...
No Matches
RefValues Class Reference

Struct for reference values of MPS method. More...

#include <refvalues.hpp>

Public Member Functions

 RefValues ()=default
 
 RefValues (int dim, double particleDistance, double re)
 calculate reference values for MPS method
 

Public Attributes

double n0 = 0
 reference value of number density for source term of pressure Poisson equation
 
double lambda = 0
 coefficient for laplacian
 

Detailed Description

Struct for reference values of MPS method.

Definition at line 8 of file refvalues.hpp.

Constructor & Destructor Documentation

◆ RefValues() [1/2]

RefValues::RefValues ( )
default

◆ RefValues() [2/2]

RefValues::RefValues ( int dim,
double particleDistance,
double re )

calculate reference values for MPS method

Parameters
dimdimension of the simulation
particleDistanceinitial particle distance
reeffective radius

Definition at line 9 of file refvalues.cpp.

9 {
10 assert(dim == 2 || dim == 3);
11 assert(particleDistance < re);
12 int iZ_start = -4;
13 int iZ_end = 5;
14 if (dim == 2) {
15 iZ_start = 0;
16 iZ_end = 1;
17 }
18
19 this->n0 = 0.0;
20 this->lambda = 0.0;
21 for (int iX = -4; iX < 5; iX++) {
22 for (int iY = -4; iY < 5; iY++) {
23 for (int iZ = iZ_start; iZ < iZ_end; iZ++) {
24 if (((iX == 0) && (iY == 0)) && (iZ == 0))
25 continue;
26
27 double xj = particleDistance * (double) (iX);
28 double yj = particleDistance * (double) (iY);
29 double zj = particleDistance * (double) (iZ);
30 double dis2 = xj * xj + yj * yj + zj * zj;
31 double dis = sqrt(dis2);
32 n0 += weight(dis, re);
33 lambda += dis2 * weight(dis, re);
34 }
35 }
36 }
37 this->lambda /= this->n0;
38}
double n0
reference value of number density for source term of pressure Poisson equation
Definition refvalues.hpp:10
double lambda
coefficient for laplacian
Definition refvalues.hpp:11
double weight(double dis, double re)
Wight function for MPS method presented by Koshizuka and Oka, 1996
Definition weight.cpp:5
Here is the call graph for this function:

Member Data Documentation

◆ n0

double RefValues::n0 = 0

reference value of number density for source term of pressure Poisson equation

Definition at line 10 of file refvalues.hpp.

◆ lambda

double RefValues::lambda = 0

coefficient for laplacian

Definition at line 11 of file refvalues.hpp.


The documentation for this class was generated from the following files: