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

constInjectionRate

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

Parameters: C r tex2html_wrap_inline2388

C is the field containing the remaining source quantity

r is a variable containing the maximum constant rate of injection

tex2html_wrap_inline2388 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.

# 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 sum \
        -parameters [list $Icluster one $IReduction minusOne] ]

# Call this -atEndOfEachTimeStepScript in the model to deplete
# the finite source.
# The intermediate field is an unfortunate necessity
proc updateIcluster {} {
   global Icluster
   global Icluster2
   global NextIcluster
   global SOLVE_TIME

   field $Icluster2 -setValue $NextIcluster
   field $Icluster -setValue $Icluster2
}



Dan Yergeau
Thu Nov 7 17:12:57 PST 1996