1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 void Foam::SIBS::SIMPR
36 const scalarField& dydx,
37 const scalarField& dfdx,
38 const scalarSquareMatrix& dfdy,
44 scalar h = deltaX/nSteps;
46 scalarSquareMatrix a(n_);
47 for (register label i=0; i<n_; i++)
49 for (register label j=0; j<n_; j++)
51 a[i][j] = -h*dfdy[i][j];
56 labelList pivotIndices(n_);
57 LUDecompose(a, pivotIndices);
59 for (register label i=0; i<n_; i++)
61 yEnd[i] = h*(dydx[i] + h*dfdx[i]);
64 LUBacksubstitute(a, pivotIndices, yEnd);
66 scalarField del(yEnd);
67 scalarField ytemp(n_);
69 for (register label i=0; i<n_; i++)
71 ytemp[i] = y[i] + del[i];
74 scalar x = xStart + h;
76 ode.derivatives(x, ytemp, yEnd);
78 for (register label nn=2; nn<=nSteps; nn++)
80 for (register label i=0; i<n_; i++)
82 yEnd[i] = h*yEnd[i] - del[i];
85 LUBacksubstitute(a, pivotIndices, yEnd);
87 for (register label i=0; i<n_; i++)
89 ytemp[i] += (del[i] += 2.0*yEnd[i]);
94 ode.derivatives(x, ytemp, yEnd);
96 for (register label i=0; i<n_; i++)
98 yEnd[i] = h*yEnd[i] - del[i];
101 LUBacksubstitute(a, pivotIndices, yEnd);
103 for (register label i=0; i<n_; i++)
110 // ************************************************************************* //