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

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

#include <refvalues.hpp>

Collaboration diagram for RefValues:

Public Member Functions

 RefValues ()=default
 
 RefValues (int dim, double particleDistance, double re, WeightType weightType)
 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
 

Private Attributes

Weight weight
 weight function instance
 

Detailed Description

Struct for reference values of MPS method.

Definition at line 9 of file refvalues.hpp.

Constructor & Destructor Documentation

◆ RefValues() [1/2]

RefValues::RefValues ( )
default

◆ RefValues() [2/2]

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

calculate reference values for MPS method

Parameters
dimdimension of the simulation
particleDistanceinitial particle distance
reeffective radius
weightTypeweight function type

Definition at line 9 of file refvalues.cpp.

9 {
10 assert(dim == 2 || dim == 3);
11 assert(particleDistance < re);
12
13 this->weight = Weight(weightType);
14
15 int iZ_start = -4;
16 int iZ_end = 5;
17 if (dim == 2) {
18 iZ_start = 0;
19 iZ_end = 1;
20 }
21
22 this->n0 = 0.0;
23 this->lambda = 0.0;
24 for (int iX = -4; iX < 5; iX++) {
25 for (int iY = -4; iY < 5; iY++) {
26 for (int iZ = iZ_start; iZ < iZ_end; iZ++) {
27 if (((iX == 0) && (iY == 0)) && (iZ == 0))
28 continue;
29
30 double xj = particleDistance * (double) (iX);
31 double yj = particleDistance * (double) (iY);
32 double zj = particleDistance * (double) (iZ);
33 double dis2 = xj * xj + yj * yj + zj * zj;
34 double dis = sqrt(dis2);
35 n0 += weight.weightFn(dis, re);
36 lambda += dis2 * weight.weightFn(dis, re);
37 }
38 }
39 }
40 this->lambda /= this->n0;
41}
Weight weight
weight function instance
Definition refvalues.hpp:26
double n0
reference value of number density for source term of pressure Poisson equation
Definition refvalues.hpp:11
double lambda
coefficient for laplacian
Definition refvalues.hpp:12
Provides a weight function.
Definition weight.hpp:15
double weightFn(double dis, double re)
Weight function for MPS method.
Definition weight.cpp:10
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 11 of file refvalues.hpp.

◆ lambda

double RefValues::lambda = 0

coefficient for laplacian

Definition at line 12 of file refvalues.hpp.

◆ weight

Weight RefValues::weight
private

weight function instance

Definition at line 26 of file refvalues.hpp.


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