hydroScalingAPI.util.ordDiffEqSolver
Class RKF

java.lang.Object
  extended by hydroScalingAPI.util.ordDiffEqSolver.RKF

public class RKF
extends java.lang.Object

An implementation of the Runge-Kutta-Felberg algorithm for solving non-linear ordinary differential equations. It uses a time step control algorithm to avoid numerical errors while solving the equations

Author:
Ricardo Mantilla

Field Summary
 double[] finalCond
          An array containing the value of the function that was last calculated by the RKF algoritm
 
Constructor Summary
RKF(BasicFunction fu, double eps, double basTs)
          Creates new RKF
 
Method Summary
 double[] getMaximumAchieved()
          Returns an array with the maximum value calculated during the iteration process
 double[][][] jumpsRun(double iniTime, double finalTime, double incrementalTime, double[] IC)
          Returns the values of the function described by differential equations in the the intermidia steps requested to go from the Initial to the Final time
 void jumpsRunCompleteToAsciiFile(double iniTime, double finalTime, double incrementalTime, double[] IC, java.io.OutputStreamWriter outputStream, LinksAnalysis linksStructure, LinksInfo thisNetworkGeom, java.io.OutputStreamWriter outputStream1)
          Writes (in ascii format) to a specified file the values of the function described by differential equations in the the intermidia steps requested to go from the Initial to the Final time.
 void jumpsRunToAsciiFile_luciana(double iniTime, double finalTime, double incrementalTime, double[] IC, java.io.OutputStreamWriter outputStream, LinksAnalysis linksStructure, LinksInfo thisNetworkGeom)
           
 void jumpsRunToAsciiFile(double iniTime, double finalTime, double incrementalTime, double[] IC, java.io.OutputStreamWriter outputStream, LinksAnalysis linksStructure, LinksInfo thisNetworkGeom)
          Writes (in ascii format) to a specified file the values of the function described by differential equations in the the intermidia steps requested to go from the Initial to the Final time.
 void jumpsRunToAsciiFileTabs(double iniTime, double finalTime, double incrementalTime, double[] IC, java.io.OutputStreamWriter outputStream, LinksAnalysis linksStructure, LinksInfo thisNetworkGeom)
          Writes (in ascii format) to a specified file the values of the function described by differential equations in the the intermidia steps requested to go from the Initial to the Final time.
 void jumpsRunToFile(double iniTime, double finalTime, double incrementalTime, double[] IC, java.io.DataOutputStream outputStream)
          Writes (in binary format) to a specified file the values of the function described by differential equations in the the intermidia steps requested to go from the Initial to the Final time
 void jumpsRunToIncompleteAsciiFile(double iniTime, double finalTime, double incrementalTime, double[] IC, java.io.OutputStreamWriter outputStream, LinksAnalysis linksStructure, LinksInfo thisNetworkGeom)
          Writes (in ascii format) to a specified file the values of the function described by differential equations in the the intermidia steps requested to go from the Initial to the Final time.
 void jumpsRunToScreen(double iniTime, double finalTime, double incrementalTime, double[] IC)
          Writes to standard output the values of the function described by differential equations in the the intermidia steps requested to go from the Initial to the Final time
static void main(java.lang.String[] args)
          Tests for the class
 void setBasicTimeStep(double newBTS)
          Sets the valuo of the algorithm time step
 double[][][] simpleRun(double iniTime, double finalTime, double[] IC)
          Returns the values of the function described by differential equations in the the intermidia steps needed to go from the Initial to the Final time
 void simpleRunToFile(double iniTime, double finalTime, double[] IC, java.io.DataOutputStream outputStream)
          Writes (in binary format) to a specified file the values of the function described by differential equations in the the intermidia steps needed to go from the Initial to the Final time
 void simpleRunToScreen(double iniTime, double finalTime, double[] IC)
          Writes to standard output the values of the function described by differential equations in the the intermidia steps needed to go from the Initial to the Final time
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

finalCond

public double[] finalCond
An array containing the value of the function that was last calculated by the RKF algoritm

Constructor Detail

RKF

public RKF(BasicFunction fu,
           double eps,
           double basTs)
Creates new RKF

Parameters:
fu - The differential equation to solve described by a BasicFunction
eps - The value error allowed by the step forward algorithm
basTs - The step size
Method Detail

simpleRun

public double[][][] simpleRun(double iniTime,
                              double finalTime,
                              double[] IC)
Returns the values of the function described by differential equations in the the intermidia steps needed to go from the Initial to the Final time

Parameters:
iniTime - The initial time of the solution
finalTime - The final time of the solution
IC - The value of the initial condition
Returns:
The values of the multivatiate function at different times

jumpsRun

public double[][][] jumpsRun(double iniTime,
                             double finalTime,
                             double incrementalTime,
                             double[] IC)
Returns the values of the function described by differential equations in the the intermidia steps requested to go from the Initial to the Final time

Parameters:
iniTime - The initial time of the solution
finalTime - The final time of the solution
incrementalTime - How often the values are desired
IC - The value of the initial condition
Returns:
The values of the multivatiate function at different times

simpleRunToFile

public void simpleRunToFile(double iniTime,
                            double finalTime,
                            double[] IC,
                            java.io.DataOutputStream outputStream)
                     throws java.io.IOException
Writes (in binary format) to a specified file the values of the function described by differential equations in the the intermidia steps needed to go from the Initial to the Final time

Parameters:
iniTime - The initial time of the solution
finalTime - The final time of the solution
IC - The value of the initial condition
outputStream - The file to which the information will be writen
Throws:
java.io.IOException - Captures errors while writing to the file

jumpsRunToFile

public void jumpsRunToFile(double iniTime,
                           double finalTime,
                           double incrementalTime,
                           double[] IC,
                           java.io.DataOutputStream outputStream)
                    throws java.io.IOException
Writes (in binary format) to a specified file the values of the function described by differential equations in the the intermidia steps requested to go from the Initial to the Final time

Parameters:
iniTime - The initial time of the solution
finalTime - The final time of the solution
incrementalTime - How often the values are desired
IC - The value of the initial condition
outputStream - The file to which the information will be writen
Throws:
java.io.IOException - Captures errors while writing to the file

jumpsRunToAsciiFile

public void jumpsRunToAsciiFile(double iniTime,
                                double finalTime,
                                double incrementalTime,
                                double[] IC,
                                java.io.OutputStreamWriter outputStream,
                                LinksAnalysis linksStructure,
                                LinksInfo thisNetworkGeom)
                         throws java.io.IOException
Writes (in ascii format) to a specified file the values of the function described by differential equations in the the intermidia steps requested to go from the Initial to the Final time. This method is very specific for solving equations of flow in a network. It prints output for the flow component at all locations.

Parameters:
iniTime - The initial time of the solution
finalTime - The final time of the solution
incrementalTime - How often the values are desired
IC - The value of the initial condition
outputStream - The file to which the information will be writen
linksStructure - The structure describing the topology of the river network
thisNetworkGeom - The descripion the the hydraulic and geomorphic parameters of the links in the network
Throws:
java.io.IOException - Captures errors while writing to the file

jumpsRunToAsciiFileTabs

public void jumpsRunToAsciiFileTabs(double iniTime,
                                    double finalTime,
                                    double incrementalTime,
                                    double[] IC,
                                    java.io.OutputStreamWriter outputStream,
                                    LinksAnalysis linksStructure,
                                    LinksInfo thisNetworkGeom)
                             throws java.io.IOException
Writes (in ascii format) to a specified file the values of the function described by differential equations in the the intermidia steps requested to go from the Initial to the Final time. This method is very specific for solving equations of flow in a network. It prints output for the flow component at all locations.

Parameters:
iniTime - The initial time of the solution
finalTime - The final time of the solution
incrementalTime - How often the values are desired
IC - The value of the initial condition
outputStream - The file to which the information will be writen
linksStructure - The structure describing the topology of the river network
thisNetworkGeom - The descripion the the hydraulic and geomorphic parameters of the links in the network
Throws:
java.io.IOException - Captures errors while writing to the file

jumpsRunCompleteToAsciiFile

public void jumpsRunCompleteToAsciiFile(double iniTime,
                                        double finalTime,
                                        double incrementalTime,
                                        double[] IC,
                                        java.io.OutputStreamWriter outputStream,
                                        LinksAnalysis linksStructure,
                                        LinksInfo thisNetworkGeom,
                                        java.io.OutputStreamWriter outputStream1)
                                 throws java.io.IOException
Writes (in ascii format) to a specified file the values of the function described by differential equations in the the intermidia steps requested to go from the Initial to the Final time. This method is very specific for solving equations of flow in a network. It prints output for the flow component at all locations.

Parameters:
iniTime - The initial time of the solution
finalTime - The final time of the solution
incrementalTime - How often the values are desired
IC - The value of the initial condition
outputStream - The file to which the information will be writen
linksStructure - The structure describing the topology of the river network
thisNetworkGeom - The descripion the the hydraulic and geomorphic parameters of the links in the network
Throws:
java.io.IOException - Captures errors while writing to the file

jumpsRunToIncompleteAsciiFile

public void jumpsRunToIncompleteAsciiFile(double iniTime,
                                          double finalTime,
                                          double incrementalTime,
                                          double[] IC,
                                          java.io.OutputStreamWriter outputStream,
                                          LinksAnalysis linksStructure,
                                          LinksInfo thisNetworkGeom)
                                   throws java.io.IOException
Writes (in ascii format) to a specified file the values of the function described by differential equations in the the intermidia steps requested to go from the Initial to the Final time. This method is very specific for solving equations of flow in a network. It prints output for the flow component at a few locations.

Parameters:
iniTime - The initial time of the solution
finalTime - The final time of the solution
incrementalTime - How often the values are desired
IC - The value of the initial condition
outputStream - The file to which the information will be writen
linksStructure - The structure describing the topology of the river network
thisNetworkGeom - The descripion the the hydraulic and geomorphic parameters of the links in the network
Throws:
java.io.IOException - Captures errors while writing to the file

simpleRunToScreen

public void simpleRunToScreen(double iniTime,
                              double finalTime,
                              double[] IC)
Writes to standard output the values of the function described by differential equations in the the intermidia steps needed to go from the Initial to the Final time

Parameters:
iniTime - The initial time of the solution
finalTime - The final time of the solution
IC - The value of the initial condition
outputStream - The file to which the information will be writen
Throws:
java.io.IOException - Captures errors while writing to the file

jumpsRunToScreen

public void jumpsRunToScreen(double iniTime,
                             double finalTime,
                             double incrementalTime,
                             double[] IC)
Writes to standard output the values of the function described by differential equations in the the intermidia steps requested to go from the Initial to the Final time

Parameters:
iniTime - The initial time of the solution
finalTime - The final time of the solution
incrementalTime - How often the values are desired
IC - The value of the initial condition
outputStream - The file to which the information will be writen
Throws:
java.io.IOException - Captures errors while writing to the file

jumpsRunToAsciiFile_luciana

public void jumpsRunToAsciiFile_luciana(double iniTime,
                                        double finalTime,
                                        double incrementalTime,
                                        double[] IC,
                                        java.io.OutputStreamWriter outputStream,
                                        LinksAnalysis linksStructure,
                                        LinksInfo thisNetworkGeom)
                                 throws java.io.IOException
Throws:
java.io.IOException

setBasicTimeStep

public void setBasicTimeStep(double newBTS)
Sets the valuo of the algorithm time step

Parameters:
newBTS - The time step to assign

getMaximumAchieved

public double[] getMaximumAchieved()
Returns an array with the maximum value calculated during the iteration process

Parameters:
newBTS - The time step to assign

main

public static void main(java.lang.String[] args)
Tests for the class

Parameters:
args - the command line arguments


CUENCAS was initially developed by Ricardo Mantilla at the University of Colorado under the supervision of Dr. Vijay K. Gupta. We wish to recognize the support from the National Science Fundation.