OpenFOAM logo
Open Source CFD Toolkit

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-2005 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     ODESolver
00027 
00028 Description
00029 
00030 SourceFiles
00031     ODESolver.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef ODESolver_H
00036 #define ODESolver_H
00037 
00038 #include "ODE.H"
00039 #include "typeInfo.H"
00040 #include "autoPtr.H"
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 /*---------------------------------------------------------------------------*\
00048                            Class ODESolver Declaration
00049 \*---------------------------------------------------------------------------*/
00050 
00051 class ODESolver
00052 {
00053 
00054 protected:
00055 
00056     // Private data
00057 
00058         label n_;
00059         mutable scalarField yScale_;
00060         mutable scalarField dydx_;
00061 
00062 
00063     // Private Member Functions
00064 
00065         //- Disallow default bitwise copy construct
00066         ODESolver(const ODESolver&);
00067 
00068         //- Disallow default bitwise assignment
00069         void operator=(const ODESolver&);
00070 
00071 
00072 public:
00073 
00074     //- Runtime type information
00075     TypeName("ODESolver");
00076 
00077 
00078     // Declare run-time constructor selection table
00079 
00080         declareRunTimeSelectionTable
00081         (
00082             autoPtr,
00083             ODESolver,
00084             ODE,
00085             (const ODE& ode),
00086             (ode)
00087         );
00088 
00089 
00090     // Constructors
00091 
00092         //- Construct for given ODE
00093         ODESolver(const ODE& ode);
00094 
00095 
00096     // Selectors
00097 
00098         //- Select null constructed
00099         static autoPtr<ODESolver> New
00100         (
00101             const word& ODESolverTypeName,
00102             const ODE& ode
00103         );
00104 
00105 
00106     // Destructor
00107 
00108         virtual ~ODESolver()
00109         {}
00110 
00111 
00112     // Member Functions
00113 
00114         virtual void solve
00115         (
00116             const ODE& ode,
00117             scalar& x,
00118             scalarField& y,
00119             scalarField& dydx,
00120             const scalar eps,
00121             const scalarField& yScale,
00122             const scalar hTry,
00123             scalar& hDid,
00124             scalar& hNext
00125         ) const = 0;
00126 
00127 
00128         virtual void solve
00129         (
00130             const ODE& ode,
00131             const scalar xStart,
00132             const scalar xEnd,
00133             scalarField& y,
00134             const scalar eps,
00135             scalar& hEst
00136         ) const;
00137 };
00138 
00139 
00140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00141 
00142 } // End namespace Foam
00143 
00144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00145 
00146 #endif
00147 
00148 // ************************************************************************* //
For further information go to www.openfoam.org