Statistics
| Revision:

root / src / growth_and_chemistry.cpp

History | View | Annotate | Download (2.2 kB)

1
#include "constants.h"
2
#include "growth_and_chemistry.h"
3
#include <gsl/gsl_errno.h>
4
#include <math.h>
5
#include <algorithm>
6

    
7

    
8
/* this function computes the equations of chemistry and growth */
9

    
10
int growth_and_chemistry(double t, const double x[], double dx[], void *parameters){
11

    
12
struct parameters_list2 {int edge_number; double *lengths; double *edges_width;};
13

    
14
double tension[(((parameters_list2*)parameters)->edge_number)];
15
for (int i=0;i<(((parameters_list2*)parameters)->edge_number);i++){
16
    tension[i]=youngs_modulus*((((parameters_list2*)parameters)->edges_width)[i])*
17
    ((((parameters_list2*)parameters)->lengths)[i]/x[i]-1.);
18
}
19

    
20
/// linear relation between growth and tension (ie constant viscosity)
21
if (growth==0){
22
for (int i=0;i<(((parameters_list2*)parameters)->edge_number);i++){
23
    dx[i]=(x[i]/((((parameters_list2*)parameters)->edges_width)[i]))*tension[i];
24
}}
25

    
26
/// linear increase then saturation (ie viscosity = 1 + T)
27
if (growth==1){
28
for (int i=0;i<(((parameters_list2*)parameters)->edge_number);i++){
29
    dx[i]=(x[i]/((((parameters_list2*)parameters)->edges_width)[i]))*tension[i]/
30
            (1.+tension[i]/(((((parameters_list2*)parameters)->edges_width)[i])*growth_threshold));
31
}}
32

    
33
/// linear with threshold (ie viscosity infinite then constant)
34
if (growth==2){
35
for (int i=0;i<(((parameters_list2*)parameters)->edge_number);i++){
36
    dx[i]=(x[i]/((((parameters_list2*)parameters)->edges_width)[i]))*
37
          std::max(tension[i]-((((parameters_list2*)parameters)->edges_width)[i])*growth_threshold,0.);
38
}}
39

    
40
/// increase more than linear (viscosity = 1 / (1+T) )
41
if (growth==3){
42
for (int i=0;i<(((parameters_list2*)parameters)->edge_number);i++){
43
    dx[i]=(x[i]/((((parameters_list2*)parameters)->edges_width)[i]))*tension[i]*
44
            (1.+tension[i]/(((((parameters_list2*)parameters)->edges_width)[i])*growth_threshold));
45
}}
46

    
47
/// linear increase, maximum then decrease to 0. (ie viscosity = 1 + T²)
48
if (growth==4){
49
for (int i=0;i<(((parameters_list2*)parameters)->edge_number);i++){
50
    dx[i]=(x[i]/((((parameters_list2*)parameters)->edges_width)[i]))*tension[i]/
51
            (1.+pow(tension[i]/(((((parameters_list2*)parameters)->edges_width)[i])*growth_threshold),2.));
52
}}
53

    
54
return GSL_SUCCESS;
55
}