fluid_problem.h 1.75 KB
Newer Older
1
2
3
4
#ifndef FLUID_PROBLEM_H
#define FLUID_PROBLEM_H

#include "mesh.h"
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
5
#include "hxt_linear_system.h"
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
6
7
8
9

typedef struct {
  char *tag;
  int field;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
10
  void (*apply)(int n, const double *x, double *bnd);
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
11
}StrongBoundary;
12
13

typedef struct {
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
14
  double epsilon;
15
16
  double rho;
  double mu;
17
  double alpha;
18
  double g;
19
20
  Mesh *mesh;
  double *porosity;
21
  double *old_porosity;
22
  double *solution;
Matthieu Constant's avatar
Matthieu Constant committed
23
  double *node_volume;
24
25
  int n_strong_boundaries;
  StrongBoundary *strong_boundaries;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
26
  HXTLinearSystem *linear_system;
27
28
29
30
31
32
33

  int n_particles;
  double *particle_uvw;
  double *particle_position;
  double *particle_volume;
  double *particle_velocity;
  double *particle_mass;
Matthieu Constant's avatar
Matthieu Constant committed
34
  double *node_force;
35
  int *particle_element_id;
36
37
} FluidProblem;

Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
38
int fluid_problem_export(const FluidProblem *problem, const char *output_dir, double t, int iter);
39
int fluid_problem_export_vtk(const FluidProblem *problem, const char *output_dir, double t, int iter);
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
40
41
// complete force on the particle (including gravity)
void fluid_problem_compute_node_particle_force(FluidProblem *problem, double dt, double *particle_force);
42
int fluid_problem_implicit_euler(FluidProblem *problem, double dt);
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
43
void fluid_problem_set_particles(FluidProblem *problem, int n, double *mass, double *volume, double *position, double *velocity, long int *elid);
44
void fluid_problem_free(FluidProblem *problem);
45
FluidProblem *fluid_problem_new(const char *mesh_file_name, double g, double mu, double rho, double epsilon, int n_strong_boundaries, StrongBoundary *strong_boundaries);
Matthieu Constant's avatar
Matthieu Constant committed
46
void fluid_problem_adapt_mesh(FluidProblem *problem, double gradmin, double gradmax, double gradPmin, double gradPmax, double lcmin, double n_el);
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
47
48
int *fluid_problem_particle_element_id(FluidProblem *problem);
int fluid_problem_n_particles(FluidProblem *problem);
49
#endif