MP-Gadget  5.0.1.dev1-76bc7d4726-dirty
Classes | Macros | Enumerations | Functions
densitykernel.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  DensityKernel
 

Macros

#define NUMDIMS   3
 
#define NORM_COEFF   4.188790204786
 

Enumerations

enum  DensityKernelType { DENSITY_KERNEL_CUBIC_SPLINE = 1 , DENSITY_KERNEL_QUINTIC_SPLINE = 2 , DENSITY_KERNEL_QUARTIC_SPLINE = 4 }
 

Functions

double density_kernel_desnumngb (DensityKernel *kernel, double eta)
 
void density_kernel_init (DensityKernel *kernel, double H, enum DensityKernelType type)
 
double density_kernel_wk (DensityKernel *kernel, double u)
 
double density_kernel_dwk (DensityKernel *kernel, double u)
 
double density_kernel_volume (DensityKernel *kernel)
 
static double density_kernel_dW (DensityKernel *kernel, double u, double wk, double dwk)
 
static double dotproduct (const double v1[3], const double v2[3])
 
static void crossproduct (const double v1[3], const double v2[3], double out[3])
 

Macro Definition Documentation

◆ NORM_COEFF

#define NORM_COEFF   4.188790204786

Coefficient for kernel normalization. Note: 4.0/3 * PI = 4.188790204786

Definition at line 6 of file densitykernel.h.

◆ NUMDIMS

#define NUMDIMS   3

For 3D-normalized kernel

Definition at line 5 of file densitykernel.h.

Enumeration Type Documentation

◆ DensityKernelType

Enumerator
DENSITY_KERNEL_CUBIC_SPLINE 
DENSITY_KERNEL_QUINTIC_SPLINE 
DENSITY_KERNEL_QUARTIC_SPLINE 

Definition at line 17 of file densitykernel.h.

17  {
21 };
@ DENSITY_KERNEL_CUBIC_SPLINE
Definition: densitykernel.h:18
@ DENSITY_KERNEL_QUINTIC_SPLINE
Definition: densitykernel.h:19
@ DENSITY_KERNEL_QUARTIC_SPLINE
Definition: densitykernel.h:20

Function Documentation

◆ crossproduct()

static void crossproduct ( const double  v1[3],
const double  v2[3],
double  out[3] 
)
inlinestatic

Definition at line 63 of file densitykernel.h.

64 {
65  static const int D2[3] = {1, 2, 0};
66  static const int D3[3] = {2, 0, 1};
67 
68  int d1;
69  for(d1 = 0; d1 < 3; d1++)
70  {
71  const int d2 = D2[d1];
72  const int d3 = D3[d1];
73  out[d1] = (v1[d2] * v2[d3] - v2[d2] * v1[d3]);
74  }
75 }

Referenced by add_particle_to_group(), density_ngbiter(), and fof_finish_group_properties().

Here is the caller graph for this function:

◆ density_kernel_desnumngb()

double density_kernel_desnumngb ( DensityKernel kernel,
double  eta 
)

Definition at line 124 of file densitykernel.c.

125 {
126  /* this returns the expected number of ngb in for given sph resolution
127  * deseta */
128  /* See Price: arxiv 1012.1885. eq 12 */
129  double support = kernel->support;
130  return NORM_COEFF * pow(support * eta, NUMDIMS);
131 }
double support
Definition: densitykernel.c:96
#define NORM_COEFF
Definition: densitykernel.h:6
#define NUMDIMS
Definition: densitykernel.h:5
static double kernel(double loga, void *params)
Definition: lightcone.c:59

References kernel(), NORM_COEFF, NUMDIMS, and support.

Referenced by GetDensityKernelType().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ density_kernel_dW()

static double density_kernel_dW ( DensityKernel kernel,
double  u,
double  wk,
double  dwk 
)
inlinestatic

Definition at line 47 of file densitykernel.h.

48 {
49  return - (NUMDIMS * kernel->Hinv * wk + u * dwk);
50 }
double(* wk)(DensityKernel *kernel, double q)
Definition: densitykernel.c:94
double(* dwk)(DensityKernel *kernel, double q)
Definition: densitykernel.c:95

References dwk, kernel(), NUMDIMS, and wk.

Referenced by density_ngbiter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ density_kernel_dwk()

double density_kernel_dwk ( DensityKernel kernel,
double  u 
)

Definition at line 108 of file densitykernel.c.

109 {
110  double support = KERNELS[kernel->type].support;
111  return kernel->dWknorm *
112  KERNELS[kernel->type].dwk(kernel, u * support);
113 }
static struct @3 KERNELS[]

References kernel(), KERNELS, and support.

Referenced by density_ngbiter(), and hydro_ngbiter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ density_kernel_init()

void density_kernel_init ( DensityKernel kernel,
double  H,
enum DensityKernelType  type 
)

Definition at line 157 of file densitykernel.c.

158 {
159  int t = -1;
160  if(type == DENSITY_KERNEL_CUBIC_SPLINE) {
161  t = 0;
162  } else
163  if(type == DENSITY_KERNEL_QUINTIC_SPLINE) {
164  t = 1;
165  } else
166  if(type == DENSITY_KERNEL_QUARTIC_SPLINE) {
167  t = 2;
168  } else {
169  endrun(1, "Density Kernel type is unknown\n");
170  }
172 }
static void density_kernel_init_with_type(DensityKernel *kernel, int type, double H)
void endrun(int where, const char *fmt,...)
Definition: endrun.c:147

References DENSITY_KERNEL_CUBIC_SPLINE, density_kernel_init_with_type(), DENSITY_KERNEL_QUARTIC_SPLINE, DENSITY_KERNEL_QUINTIC_SPLINE, endrun(), and kernel().

Referenced by blackhole_accretion_ngbiter(), blackhole_dynfric_ngbiter(), blackhole_feedback_ngbiter(), density_ngbiter(), GetDensityKernelType(), hydro_ngbiter(), metal_return_ngbiter(), set_density_params(), and stellar_density_ngbiter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ density_kernel_volume()

double density_kernel_volume ( DensityKernel kernel)

Definition at line 134 of file densitykernel.c.

135 {
136  return NORM_COEFF * pow(kernel->H, NUMDIMS);
137 }

References kernel(), NORM_COEFF, and NUMDIMS.

Referenced by density_ngbiter(), and stellar_density_ngbiter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ density_kernel_wk()

double density_kernel_wk ( DensityKernel kernel,
double  u 
)

Definition at line 116 of file densitykernel.c.

117 {
118  double support = KERNELS[kernel->type].support;
119  return kernel->Wknorm *
120  KERNELS[kernel->type].wk(kernel, u * support);
121 }

References kernel(), KERNELS, and support.

Referenced by blackhole_accretion_ngbiter(), blackhole_dynfric_ngbiter(), blackhole_feedback_ngbiter(), density_ngbiter(), metal_return_ngbiter(), and stellar_density_ngbiter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dotproduct()

static double dotproduct ( const double  v1[3],
const double  v2[3] 
)
inlinestatic

Definition at line 53 of file densitykernel.h.

54 {
55  double r =0;
56  int d;
57  for(d = 0; d < 3; d ++) {
58  r += v1[d] * v2[d];
59  }
60  return r;
61 }

Referenced by density_ngbiter(), and hydro_ngbiter().

Here is the caller graph for this function: