OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

ODESolver.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::ODESolver
00027 
00028 Description
00029     Selection for ODE solver
00030 
00031 SourceFiles
00032     ODESolver.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef ODESolver_H
00037 #define ODESolver_H
00038 
00039 #include "ODE.H"
00040 #include "typeInfo.H"
00041 #include "autoPtr.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 /*---------------------------------------------------------------------------*\
00049                          Class ODESolver Declaration
00050 \*---------------------------------------------------------------------------*/
00051 
00052 class ODESolver
00053 {
00054 
00055 protected:
00056 
00057     // Private data
00058 
00059         label n_;
00060         mutable scalarField yScale_;
00061         mutable scalarField dydx_;
00062 
00063 
00064     // Private Member Functions
00065 
00066         //- Disallow default bitwise copy construct
00067         ODESolver(const ODESolver&);
00068 
00069         //- Disallow default bitwise assignment
00070         void operator=(const ODESolver&);
00071 
00072 
00073 public:
00074 
00075     //- Runtime type information
00076     TypeName("ODESolver");
00077 
00078 
00079     // Declare run-time constructor selection table
00080 
00081         declareRunTimeSelectionTable
00082         (
00083             autoPtr,
00084             ODESolver,
00085             ODE,
00086             (const ODE& ode),
00087             (ode)
00088         );
00089 
00090 
00091     // Constructors
00092 
00093         //- Construct for given ODE
00094         ODESolver(const ODE& ode);
00095 
00096 
00097     // Selectors
00098 
00099         //- Select null constructed
00100         static autoPtr<ODESolver> New
00101         (
00102             const word& ODESolverTypeName,
00103             const ODE& ode
00104         );
00105 
00106 
00107     // Destructor
00108 
00109         virtual ~ODESolver()
00110         {}
00111 
00112 
00113     // Member Functions
00114 
00115         virtual void solve
00116         (
00117             const ODE& ode,
00118             scalar& x,
00119             scalarField& y,
00120             scalarField& dydx,
00121             const scalar eps,
00122             const scalarField& yScale,
00123             const scalar hTry,
00124             scalar& hDid,
00125             scalar& hNext
00126         ) const = 0;
00127 
00128 
00129         virtual void solve
00130         (
00131             const ODE& ode,
00132             const scalar xStart,
00133             const scalar xEnd,
00134             scalarField& y,
00135             const scalar eps,
00136             scalar& hEst
00137         ) const;
00138 };
00139 
00140 
00141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00142 
00143 } // End namespace Foam
00144 
00145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00146 
00147 #endif
00148 
00149 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd