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

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

Matthieu Constant's avatar
Matthieu Constant committed
8
9
10
11
12
13
#if DIMENSION==2
#define N_N 3
#else
#define N_N 4
#endif

Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
14
15
16
typedef struct {
  char *tag;
  int field;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
17
  void (*apply)(int n, const double *x, double *bnd);
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
18
}StrongBoundary;
19
20

typedef struct {
Matthieu Constant's avatar
Matthieu Constant committed
21
  double epsilon;
22
23
  double rho;
  double mu;
24
  double alpha;
25
  double g;
26
  Mesh *mesh;
27
  MeshTree *mesh_tree;
28
  double *porosity;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
29
  double *new_porosity;
30
  double *solution;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
31
  double *solution_explicit;
Matthieu Constant's avatar
Matthieu Constant committed
32
  double *node_volume;
33
34
  int n_strong_boundaries;
  StrongBoundary *strong_boundaries;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
35
  HXTLinearSystem *linear_system;
36
37
38
39
40
41

  int n_particles;
  double *particle_uvw;
  double *particle_position;
  double *particle_volume;
  double *particle_velocity;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
42
43
  double *particle_new_velocity;
  double *particle_drag;
44
  double *particle_mass;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
45
  double *particle_force;
46
  int *particle_element_id;
47
48
} FluidProblem;

Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
49
int fluid_problem_export(const FluidProblem *problem, const char *output_dir, double t, int iter);
50
int fluid_problem_export_vtk(const FluidProblem *problem, const char *output_dir, double t, int iter);
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
51
int fluid_problem_import_vtk(FluidProblem *problem, const char *filename);
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
52
53
// complete force on the particle (including gravity)
void fluid_problem_compute_node_particle_force(FluidProblem *problem, double dt, double *particle_force);
54
int fluid_problem_implicit_euler(FluidProblem *problem, double dt);
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
55
void fluid_problem_set_particles(FluidProblem *problem, int n, double *mass, double *volume, double *position, double *velocity, long int *elid);
56
void fluid_problem_free(FluidProblem *problem);
Matthieu Constant's avatar
Matthieu Constant committed
57
58
FluidProblem *fluid_problem_new(const char *mesh_file_name, double g, double mu, double rho, double epsilon, int n_strong_boundaries, StrongBoundary *strong_boundaries);
void fluid_problem_adapt_mesh(FluidProblem *problem, double lcmax, double lcmin, double n_el);
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
59
60
int *fluid_problem_particle_element_id(FluidProblem *problem);
int fluid_problem_n_particles(FluidProblem *problem);
Matthieu Constant's avatar
Matthieu Constant committed
61
void fluid_problem_after_import(FluidProblem *problem);
62
#endif