-
Notifications
You must be signed in to change notification settings - Fork 3
/
fluid.h
76 lines (66 loc) · 2.43 KB
/
fluid.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef fluid_fluid_h
#define fluid_fluid_h
typedef struct DOUBLE3 double3;
typedef struct BOUNDARY_PARTICLE boundary_particle;
typedef struct FLUID_PARTICLE fluid_particle;
typedef struct NEIGHBOR neighbor;
typedef struct PARAM param;
#include <stdbool.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include "fileio.h"
#include "geometry.h"
////////////////////////////////////////////////
// Structures
////////////////////////////////////////////////
struct DOUBLE3 {
double x;
double y;
double z;
};
struct BOUNDARY_PARTICLE {
double3 pos; // position
double3 n; // position
};
struct FLUID_PARTICLE {
double density;
double pressure;
double3 pos; // position
double3 v; // velocity
double3 v_half; // half step velocity
double3 a; // acceleration
};
struct PARAM {
double rest_density;
double mass_particle;
double spacing_particle;
double smoothing_radius;
double g;
double time_step;
double alpha;
double surface_tension;
double speed_sound;
int number_particles;
int number_fluid_particles;
int number_boundary_particles;
int number_steps;
}; // Simulation paramaters
////////////////////////////////////////////////
// Function prototypes
////////////////////////////////////////////////
//double W(fluid_particle *p, fluid_particle *q, double h);
//double del_W(fluid_particle *p, fluid_particle *q, double h);
//double computePressure(fluid_particle *p, param *params);
//void updatePressures(fluid_particle *fluid_particles, param *params);
//void computeAcceleration(fluid_particle *p, fluid_particle *q, param *params);
//void computeBoundaryAcceleration(fluid_particle *p, boundary_particle *q, param *params);
//void updateParticle(fluid_particle *p, param *params);
//void updatePositions(fluid_particle *fluid_particles, param *params);
void updatePositions(fluid_particle *fluid_particles, param *params);
void updatePressures(fluid_particle *fluid_particles, param *params);
void updateAccelerations(fluid_particle *fluid_particles, boundary_particle *boundary_particles, param *params);
double computeDensity(double3 p_pos, double3 p_v, double3 q_pos, double3 q_v, param *params);
void eulerStart(fluid_particle* fluid_particles, boundary_particle *boundary_particles, param *params);
void initParticles(fluid_particle* fluid_particles, boundary_particle* boundary_particles, AABB* water, AABB* boundary, param* params);
#endif