fluid_problem.h 5.73 KB
Newer Older
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
1
/*
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
2
 * MigFlow - Copyright (C) <2010-2020>
3
4
 * <Universite catholique de Louvain (UCL), Belgium
 *  Universite de Montpellier, France>
Michel Henry's avatar
Michel Henry committed
5
 *
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
6
 * List of the contributors to the development of MigFlow: see AUTHORS file.
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
7
 * Description and complete License: see LICENSE file.
Michel Henry's avatar
Michel Henry committed
8
9
10
 *
 * This program (MigFlow) is free software:
 * you can redistribute it and/or modify it under the terms of the GNU Lesser General
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
11
12
 * Public License as published by the Free Software Foundation, either version
 * 3 of the License, or (at your option) any later version.
Michel Henry's avatar
Michel Henry committed
13
 *
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
14
15
16
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU Lesser General Public License for more details.
Michel Henry's avatar
Michel Henry committed
18
 *
19
 * You should have received a copy of the GNU Lesser General Public License
Michel Henry's avatar
Michel Henry committed
20
 * along with this program (see COPYING and COPYING.LESSER files).  If not,
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
21
22
23
 * see <http://www.gnu.org/licenses/>.
 */

24
25
26
27
#ifndef FLUID_PROBLEM_H
#define FLUID_PROBLEM_H

#include "mesh.h"
28
#include "mesh_find.h"
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
29

Matthieu Constant's avatar
Matthieu Constant committed
30
31
32
33
34
35
#if DIMENSION==2
#define N_N 3
#else
#define N_N 4
#endif

36
typedef void BoundaryCallback(int n, const double *x, double *bnd);
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
37
38


Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
39
40
typedef struct {
  char *tag;
Jonathan Lambrechts's avatar
weak bc    
Jonathan Lambrechts committed
41
  int row;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
42
  int field;
43
  BoundaryCallback *apply;
44
} StrongBoundary;
45

Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
46
typedef struct FluidProblem FluidProblem;
47
typedef enum {BND_WALL=0,BND_OPEN=1} BoundaryType;
48
typedef struct {
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
49
  char *tag;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
50
  BoundaryType type;
51
  BoundaryCallback *field_cb;
Michel Henry's avatar
Michel Henry committed
52
  int vid,pid,cid,aid,compute_viscous_term;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
53
54
55
56
} WeakBoundary;


struct FluidProblem {
57
58
  double *rho;
  double *mu;
Nathan Coppin's avatar
Nathan Coppin committed
59
  double *g;
60
  double coeffStab;
61
  double drag_coeff_factor;
Matthieu Constant's avatar
Matthieu Constant committed
62
  double ip_factor;
63
  double sigma;
Matthieu Constant's avatar
Matthieu Constant committed
64
  double kinetic_energy;
65
  Mesh *mesh;
66
  MeshTree *mesh_tree;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
67
  MeshBoundary *boundaries;
Matthieu Constant's avatar
Matthieu Constant committed
68
69
  double *porosity;
  double *oldporosity;
Jonathan Lambrechts's avatar
broken    
Jonathan Lambrechts committed
70
  double *concentration;
71
  double *solution;
Michel Henry's avatar
ALE    
Michel Henry committed
72
  double *mesh_velocity;
Matthieu Constant's avatar
Matthieu Constant committed
73
  double *node_volume;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
74
  double *element_size;
75
  double volume_drag;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
76
  double quadratic_drag;
77
78
  int n_strong_boundaries;
  StrongBoundary *strong_boundaries;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
79
80
  int n_weak_boundaries;
  WeakBoundary *weak_boundaries;
81
  double *boundary_force;
82
83
84
85
86
  int n_particles;
  double *particle_uvw;
  double *particle_position;
  double *particle_volume;
  double *particle_velocity;
87
  double *particle_contact;
88
  double *particle_mass;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
89
  double *particle_force;
Matthieu Constant's avatar
Matthieu Constant committed
90
  double *grad_a_cg;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
91
  double *bulk_force;
92
  double *all_kappa;
93
  int n_fluids;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
94
  //stabilisation coefficients
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
95
96
  double *taup;
  double *tauc;
97
  int *particle_element_id;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
98
99
100
  //parameters
  int reduced_gravity;
  double stab_param;
Nathan Coppin's avatar
Nathan Coppin committed
101
  int advection;
Jonathan Lambrechts's avatar
usolid    
Jonathan Lambrechts committed
102
  int usolid;
Nathan Coppin's avatar
Nathan Coppin committed
103
  int temporal;
104
  int drag_in_stab;
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
105
};
106

Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
107
108
// complete force on the particle (including gravity)
void fluid_problem_compute_node_particle_force(FluidProblem *problem, double dt, double *particle_force);
Jonathan Lambrechts's avatar
wip    
Jonathan Lambrechts committed
109
110
void fluid_problem_set_particles(FluidProblem *problem, int n, double *mass, double *volume, double *position, double *velocity, double *contact);
void fluid_problem_move_particles(FluidProblem *problem, int n, double *position, double *velocity, double *contact);
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
111
void fluid_problem_set_bulk_force(FluidProblem *problem, double *force);
Jonathan Lambrechts's avatar
broken    
Jonathan Lambrechts committed
112
void fluid_problem_set_concentration_cg(FluidProblem *problem, double *concentration);
113
void fluid_problem_free(FluidProblem *problem);
Jonathan Lambrechts's avatar
usolid    
Jonathan Lambrechts committed
114
FluidProblem *fluid_problem_new(double *g, int n_fluids, double *mu, double *rho, double sigma, double coeffStab, double volume_drag, double quadratic_drag, int drag_in_stab, double drag_coeff_factor, double ip_factor,int temporal, int advection, int usolid);
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
115
116
void fluid_problem_adapt_mesh(FluidProblem *problem, Mesh *new_mesh, int old_n_particles, double *old_particle_position, double *old_particle_volume);
void fluid_problem_set_mesh(FluidProblem *problem, Mesh *mesh);
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
117
118
int *fluid_problem_particle_element_id(FluidProblem *problem);
int fluid_problem_n_particles(FluidProblem *problem);
Matthieu Constant's avatar
Matthieu Constant committed
119
void fluid_problem_after_import(FluidProblem *problem);
Jonathan Lambrechts's avatar
broken    
Jonathan Lambrechts committed
120
int fluid_problem_n_fields(const FluidProblem *p);
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
121
double *fluid_problem_solution(const FluidProblem *p);
Michel Henry's avatar
ALE    
Michel Henry committed
122
double *fluid_problem_mesh_velocity(const FluidProblem *p);
Michel Henry's avatar
Michel Henry committed
123
void fluid_problem_set_weak_boundary(FluidProblem *p, const char *tag, BoundaryType type, BoundaryCallback *cb, int vid, int pid, int cid, int aid, int compute_viscous_term);
124
void fluid_problem_set_strong_boundary(FluidProblem *p, const char *tag, int field, int row, BoundaryCallback *apply);
125
126
double *fluid_problem_old_porosity(const FluidProblem *p);
double *fluid_problem_porosity(const FluidProblem *p);
Jonathan Lambrechts's avatar
broken    
Jonathan Lambrechts committed
127
double *fluid_problem_concentration_dg(const FluidProblem *p);
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
128
double *fluid_problem_element_size(const FluidProblem *p);
Jonathan Lambrechts's avatar
broken    
Jonathan Lambrechts committed
129
void fluid_problem_advance_concentration(FluidProblem *problem, double dt);
130

Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
131

Michel Henry's avatar
Michel Henry committed
132

Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
133
134
135
136
137
// mesh data (for i/o)
int fluid_problem_n_nodes(const FluidProblem *p);
double *fluid_problem_coordinates(const FluidProblem *p);
int fluid_problem_n_elements(const FluidProblem *p);
int *fluid_problem_elements(const FluidProblem *p);
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
138
void fluid_problem_set_elements(FluidProblem *p, int n_nodes, double *x, int n_elements, int *elements, int n_boundaries, int *boundaries, int *boundary_tags,int n_physicals, char **physicals, const int *periodic);
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
139
140
141
142
143
int fluid_problem_n_mesh_boundaries(const FluidProblem *p);
void fluid_problem_mesh_boundary_info(const FluidProblem *p, int bid, char **bname, int *bsize);
void fluid_problem_mesh_boundary_interfaces(const FluidProblem *p, int bid, int *binterfaces);


Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
144
145
146
void fluid_problem_set_stab_param(FluidProblem *p, double  stab_param);
void fluid_problem_set_reduced_gravity(FluidProblem *p, int reduced_gravity);

147
int weak_boundary_n_values(const WeakBoundary *wbnd);
Matthieu Constant's avatar
Matthieu Constant committed
148
149
double fluid_problem_a_integ_volume(FluidProblem *problem);
double fluid_problem_a_integ_bnd(FluidProblem *problem, double dt);
150
void weak_boundary_values(const Mesh *mesh, const MeshBoundary *bnd, const WeakBoundary *wbnd, double *data);
151
#endif