1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 void Foam::SIBS::SIMPR
35 const scalarField& dydx,
36 const scalarField& dfdx,
37 const scalarSquareMatrix& dfdy,
43 scalar h = deltaX/nSteps;
45 scalarSquareMatrix a(n_);
46 for (register label i=0; i<n_; i++)
48 for (register label j=0; j<n_; j++)
50 a[i][j] = -h*dfdy[i][j];
55 labelList pivotIndices(n_);
56 LUDecompose(a, pivotIndices);
58 for (register label i=0; i<n_; i++)
60 yEnd[i] = h*(dydx[i] + h*dfdx[i]);
63 LUBacksubstitute(a, pivotIndices, yEnd);
65 scalarField del(yEnd);
66 scalarField ytemp(n_);
68 for (register label i=0; i<n_; i++)
70 ytemp[i] = y[i] + del[i];
73 scalar x = xStart + h;
75 ode.derivatives(x, ytemp, yEnd);
77 for (register label nn=2; nn<=nSteps; nn++)
79 for (register label i=0; i<n_; i++)
81 yEnd[i] = h*yEnd[i] - del[i];
84 LUBacksubstitute(a, pivotIndices, yEnd);
86 for (register label i=0; i<n_; i++)
88 ytemp[i] += (del[i] += 2.0*yEnd[i]);
93 ode.derivatives(x, ytemp, yEnd);
95 for (register label i=0; i<n_; i++)
97 yEnd[i] = h*yEnd[i] - del[i];
100 LUBacksubstitute(a, pivotIndices, yEnd);
102 for (register label i=0; i<n_; i++)
109 // ************************************************************************* //