OpenLB 1.7
Loading...
Searching...
No Matches
inamuroNewtonRaphsonDynamics.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2006, 2007 Orestis Malaspinas, Jonas Latt
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
24#ifndef INAMURO_NEWTON_RAPHSON_DYNAMICS_H
25#define INAMURO_NEWTON_RAPHSON_DYNAMICS_H
26
27#include "dynamics/dynamics.h"
28#include "io/ostreamManager.h"
29
30namespace olb {
31
39template<typename T, typename DESCRIPTOR, typename Dynamics, typename MOMENTA, int direction, int orientation>
40class InamuroNewtonRaphsonDynamics : public legacy::BasicDynamics<T,DESCRIPTOR,MOMENTA> {
41public:
45 T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const override;
48 LatticeStatistics<T>& statistics) override;
50 T getOmega() const;
52 void setOmega(T omega);
53private:
54 void computeApproxMomentum(T approxMomentum[DESCRIPTOR::d],
56 const T &rho, const T u[DESCRIPTOR::d], const T xi[DESCRIPTOR::d],
57 const std::vector<int> knownIndexes,const std::vector<int> missingIndexes);
58
60 T computeError(const T &rho,const T u[DESCRIPTOR::d], const T approxMomentum[DESCRIPTOR::d]);
61
62 void computeGradGradError(T gradGradError[DESCRIPTOR::d][DESCRIPTOR::d],
63 T gradError[DESCRIPTOR::d],
64 const T &rho, const T u[DESCRIPTOR::d],const T xi[DESCRIPTOR::d],
65 const T approxMomentum[DESCRIPTOR::d],
66 const std::vector<int> missingIndexes);
67
69 bool newtonRaphson(T xi[DESCRIPTOR::d],
70 const T gradError[DESCRIPTOR::d],
71 const T gradGradError[DESCRIPTOR::d][DESCRIPTOR::d]);
72
73 bool invert(const T a[2][2],T b[2][2]);
74
75 bool invert(const T a[3][3],T b[3][3]);
76
77 Dynamics _boundaryDynamics;
78 T _xi[DESCRIPTOR::d];
79 mutable OstreamManager clout;
80};
81
82}
83
84#endif
Highest-level interface to Cell data.
Definition cell.h:148
Highest-level interface to read-only Cell data.
Definition cell.h:53
This class computes the inamuro BC with general dynamics.
T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const override
Compute equilibrium distribution function.
T getOmega() const
Get local relaxation parameter of the dynamics.
void setOmega(T omega)
Set local relaxation parameter of the dynamics.
CellStatistic< T > collide(Cell< T, DESCRIPTOR > &cell, LatticeStatistics< T > &statistics) override
Collision step.
class for marking output with some text
Top level namespace for all of OpenLB.
Return value of any collision.
Definition interface.h:43
Interface for per-cell dynamics.
Definition interface.h:54