next up previous contents
Next: constInjectionLoss Up: Functions Previous: ssactive

constInjectionRate

This function provides a constant rate injection from a finite source. It is used in conjunction with constInjectionLoss.

Parameters: C r tex2html_wrap_inline2726

C is the field containing the remaining source quantity

r is a variable containing the maximum constant rate of injection

tex2html_wrap_inline2726 should be the TIME_STEP variable

The actual rate injected depends on rate, the quantity remaining, and the time step. If the quantity remaining is non-zero then the rate of injection is the minimum of the maximum constant rate of injection and the rate to inject the remaining source quantity over the time step.

The following fragment demonstrates the use of these functions.

set one 1.0

# Icluster is the finite source field
# rate is the constant rate of injection
set IRate [function constInjectionRate \
        -parameters [list $Icluster rate TIME_STEP] ]

# IReduction and NextIcluster are used to compute and
# update the quantity decreased at a constant rate
set IReduction [function constInjectionLoss \
        -parameters [list $Icluster rate TIME_STEP] ]
set NextIcluster [function difference \
        -parameters [list one $Icluster one $IReduction] ]

# Call this -atEndOfEachTimeStepScript in the model to deplete
# the finite source.
proc updateIcluster {} {
   global Icluster
   global NextIcluster
   global SOLVE_TIME

   field $Icluster -setValue $NextIcluster
}



Dan Yergeau
Wed Aug 20 14:01:54 PDT 1997