Link

Class definition of the HLM model that is BMI-compliant.

Parameters:
NameTypeDescription
paramArrayArray.<object>

An array of link parameters

parentsArray.<object>

An array of link ids that drain to current link

forcingsArray.<object>

An object of forcings at the link (e.g. evap & precip)

initialConditionArray.<object>

An array of initial states of the link

Returns:

creates a new instance of an HLM model

Type: 
Object

Methods

(static) firstStep(manual)

Equates the length of the first step per Hairer 1987, "Starting Step Size" Routine (page 182) a) eval f(x_0, y_0) b) calc den = [frac{1}{max(x_0, x_end)}]^{1+p} + \norm{f}^{p+1} c) calc h = [/frac{tol}{den}]^{1/(p+1)} d) do one euler step with h e) repeat a) - c) with new initial value f) set initial step size, h, to be h = min(h1, h2) // h1 from the 1st cycle, h2 from 2nd

Parameters:
NameTypeDescription
manualnumber

(static) getPrecip(tUnix) → {Array.<object>}

Get precip forcing at given time and the time the forcing changes

Parameters:
NameTypeDescription
tUnixnumber

time in seconds from the beginning of the model

Returns:
  • [ pVal : precip forcing val at linkTime, tEnd : unix time of end of continuous p forcing ]
Type: 
Array.<object>

(static) getY(tUnix, memKey) → {number}

Given tUnix, return q for link Use dense method

Parameters:
NameTypeDescription
tUnixnumber

time where value is wanted

memKeynumber

key in memory object of the save state var

Returns:
  • value of the state at the tUnix
Type: 
number

(static) initialize(paramArray, parents, forcings, ic)

Make Link object

Parameters:
NameTypeDescription
paramArrayArray.<object>

An array of link parameters

parentsArray.<object>

An array of link ids that drain to current link

forcingsArray.<object>

An object of forcings at the link (e.g. evap & precip)

icArray.<object>

An array of initial states of the link

(static) initModel(ic)

Add mathematical model functions needed Then initialize state vars and some parameters

Parameters:
NameTypeDescription
icArray.<object>

initial conditions

(static) processForces(forcings)

Attach forcings from inputs

Parameters:
NameTypeDescription
forcingsObject

(static) searchInsert(nums, target) → {number}

Returns the index in an array that the target number should be inserted at.

Parameters:
NameTypeDescription
numsArray.<object>

an array of numbers in ascending order

targetnumber

number that you want to insert into nums array

Returns:
  • index where target should be inserted
Type: 
number

(static) step(tGoal)

Use integrator with multiple timesteps to determine error and then update appropriate step size. this.hstep is the largest possible step the solver will take. IF the forcings at this.linkTime and += this.hstep are the same, there will not be any discontinuities from the stepwise forcing functions in the integration approximation, even if hstep is changed because of error limits (hstep will get smaller.)

Parameters:
NameTypeDescription
tGoalnumber

time in seconds from the beginning of the model

(static) yFromParents(tUnix, memKey) → {Number}

Returns a single numeric value at time t at the Link Object this. Iterate over all of the link's parents to sum their flow at time t provided. Used 'y' as a generic dependent var specify memKey to tell which var to search over

Parameters:
NameTypeDescription
tUnixnumber

time in seconds from the beginning of the model

memKeynumber

key in memory object of the save state var

Returns:
Type: 
Number