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