'use strict'

const CELL_SIZE = 10 // the graphics size of the cell
const COLS = 60 // the number of cells in the x-axis
const ROWS = 20 // the number of cells in the y-axis

const params = {
  gamma: 0.02, // interface diffusion
  size: 0.01, // 10mm face area
  rho: 998.2, // 998.2kg/m^3 density
  mu: 0.001002, // dynamic viscosity
  nu: 0.000001004, // kinematic viscosity
  input: {
    x: 0.0005, // inlet velocity in the x-axis
    y: 0.0 // inlet velocity in the y-axis
  },
  plant: [
    { diameter: 1.000, phi: 0.000, state: 10 }, // water
    { diameter: 0.010, phi: 0.013, state: 11 }, // winter plants
    { diameter: 0.019, phi: 0.047, state: 12 } // summer plants
  ]
}

const values = {
  density: params.rho / 2,
  diffuse: params.gamma / params.size
}

const plants = []

// initialises plant constants
for (let n = 0; n < params.plant.length; n++) {
  plants.push([
    params.plant[n].diameter, // diameter
    params.plant[n].phi, // phi
    params.plant[n].state, // state
    0, // a0
    0 // a1
  ])

  plants[n][3] = 7276.43 * plants[n][0] + 23.55 // a0 value
  plants[n][4] = 32.7 * plants[n][0] + 3.01 * plants[n][1] + 0.42 // a1 value
}

module.exports = {
  CELL_SIZE,
  COLS,
  ROWS,
  params,
  values,
  plants
}

@@ -11,169 +11,8 @@
 t'%0A%0A
-const CELL_SIZE = 10 // the graphics size of the cell%0Aconst COLS = 60 // the number of cells in the x-axis%0Aconst ROWS = 20 // the number of cells in the y-axis%0A%0A
 cons
@@ -346,18 +346,16 @@
 ter: 1.0
-00
 , phi: 0
@@ -356,18 +356,16 @@
 phi: 0.0
-00
 , state:
@@ -400,17 +400,16 @@
 er: 0.01
-0
 , phi: 0
@@ -525,220 +525,65 @@
 nst 
-values = %7B%0A  density: params.rho / 2,%0A  diffuse: params.gamma / params.size%0A%7D%0A%0Aconst 
+plants = params.plant.map(
 plant
-s
  =
- %5B%5D%0A%0A// initialises plant constants%0Afor (let n = 0; n %3C params.plant.length; n++) %7B%0A  plants.push(%5B%0A    params.
+%3E %7B%0A  return %5B%0A    
 plant
-%5Bn%5D
 .dia
@@ -605,31 +605,21 @@
 ter%0A    
-params.
 plant
-%5Bn%5D
 .phi, //
@@ -631,23 +631,13 @@
     
-params.
 plant
-%5Bn%5D
 .sta
@@ -656,52 +656,8 @@
 %0A   
- 0, // a0%0A    0 // a1%0A  %5D)%0A%0A  plants%5Bn%5D%5B3%5D =
  727
@@ -672,23 +672,25 @@
 lant
-s%5Bn%5D%5B0%5D
+.diameter
  + 23.55
  // 
@@ -685,16 +685,17 @@
  + 23.55
+,
  // a0 v
@@ -705,22 +705,9 @@
 e%0A  
-plants%5Bn%5D%5B4%5D =
+ 
  32.
@@ -719,15 +719,17 @@
 lant
-s%5Bn%5D%5B0%5D
+.diameter
  + 3
@@ -743,15 +743,12 @@
 lant
-s%5Bn%5D%5B1%5D
+.phi
  + 0
@@ -760,16 +760,15 @@
 / a1
- value
+%0A  %5D
 %0A%7D
+)
 %0A%0Amo
@@ -790,53 +790,140 @@
 %7B%0A  
-CELL_SIZE,%0A  COLS,%0A  ROWS,%0A  params,%0A  values
+cellSize: 10,%0A  cols: 10,%0A  rows: 10,%0A  params,%0A  values: %7B%0A    density: params.rho / 2,%0A    diffuse: params.gamma / params.size%0A  %7D
 ,%0A  

improve config portability