MoDeNa  1.0
Software framework facilitating sequential multi-scale modelling
growthSource.H
Go to the documentation of this file.
1 
20 void growthSource(double *, double *, double *, double *, int &, int *, double &, double &, double &, double &, double &, double &, double *, double *);
21 
22 void growthSource
23 (
24  double *sgBA, double *sgCO2, double *we, double *vi, int &nNodes, int *mOrder,
25  double &CO2_l_val, double &L_l_val, double &tmp_val, double &wCO2_Max,
26  double &cc1_val, double &LMAX,
27  double *volumeGrowthBA, double *volumeGrowthCO2
28 )
29 {
30  int i;
31  int counter = 0;
32  double k;
33 
34  if (L_l_val > LMAX)
35  {
36  cc1_val = 1.0;
37  }
38  else
39  {
40  cc1_val = 0.0;
41  }
42 
43  while (counter < 2*nNodes)
44  {
45  sgBA[counter] = 0.0;
46  sgCO2[counter] = 0.0;
47 
48  // using static_cast to convert moment order from int to double
49  k = static_cast<double>(mOrder[counter]);
50 
51  if (counter == 0)
52  {
53  sgBA[counter] = 0.0;
54  sgCO2[counter] = 0.0;
55  }
56  else if (counter == 1)
57  {
58  for (i = 0; i < nNodes; i++)
59  {
60  if(vi[i] > 0.0)
61  {
62  sgBA[counter] += volumeGrowthBA[i]*we[i];
63  sgCO2[counter] += volumeGrowthCO2[i]*we[i];
64  }
65  else
66  {
67  sgBA[counter] = sgBA[counter];
68  sgCO2[counter] = sgCO2[counter];
69  }
70  }
71  }
72  else
73  {
74  for (i = 0; i < nNodes; i++)
75  {
76  if (vi[i] > 0.0)
77  {
78  sgBA[counter] += k*volumeGrowthBA[i]*we[i]*Foam::pow(vi[i], k - 1);
79  sgCO2[counter] += k*volumeGrowthCO2[i]*we[i]*Foam::pow(vi[i], k - 1);
80  }
81  else
82  {
83  sgBA[counter] = sgBA[counter];
84  sgCO2[counter] = sgCO2[counter];
85  }
86  }
87  }
88  counter++;
89  }
90 }
void growthSource(double *, double *, double *, double *, int &, int *, double &, double &, double &, double &, double &, double &, double *, double *)
Definition: growthSource.H:23