new Link(paramArray, parents, forcings, initialCondition) → {Object}
Class definition of the HLM model that is BMI-compliant.
Name | Type | Description |
---|---|---|
paramArray | Array. | An array of link parameters |
parents | Array. | An array of link ids that drain to current link |
forcings | Array. | An object of forcings at the link (e.g. evap & precip) |
initialCondition | Array. | An array of initial states of the link |
- Source
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
Name | Type | Description |
---|---|---|
manual | number |
- Source
(static) getPrecip(tUnix) → {Array.<object>}
Get precip forcing at given time and the time the forcing changes
Name | Type | Description |
---|---|---|
tUnix | number | time in seconds from the beginning of the model |
- Source
- [ 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
Name | Type | Description |
---|---|---|
tUnix | number | time where value is wanted |
memKey | number | key in memory object of the save state var |
- Source
- value of the state at the tUnix
- Type:
- number
(static) initialize(paramArray, parents, forcings, ic)
Make Link object
Name | Type | Description |
---|---|---|
paramArray | Array. | An array of link parameters |
parents | Array. | An array of link ids that drain to current link |
forcings | Array. | An object of forcings at the link (e.g. evap & precip) |
ic | Array. | An array of initial states of the link |
- Source
(static) initModel(ic)
Add mathematical model functions needed Then initialize state vars and some parameters
Name | Type | Description |
---|---|---|
ic | Array. | initial conditions |
- Source
(static) processForces(forcings)
Attach forcings from inputs
Name | Type | Description |
---|---|---|
forcings | Object |
- Source
(static) searchInsert(nums, target) → {number}
Returns the index in an array that the target number should be inserted at.
Name | Type | Description |
---|---|---|
nums | Array. | an array of numbers in ascending order |
target | number | number that you want to insert into nums array |
- Source
- 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.)
Name | Type | Description |
---|---|---|
tGoal | number | time in seconds from the beginning of the model |
- Source
(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
Name | Type | Description |
---|---|---|
tUnix | number | time in seconds from the beginning of the model |
memKey | number | key in memory object of the save state var |
- Source
- Type:
- Number