waves
Basic FE playground
wSolver.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 University of Liège
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef WSOLVER_H
18 #define WSOLVER_H
19 
20 #include "flow.h"
21 #include "wObject.h"
22 #include "wTimers.h"
23 
24 #include <iostream>
25 #include <vector>
26 #include <memory>
27 #include <Eigen/Dense>
28 
29 namespace flow
30 {
31 
36 class FLOW_API Solver : public fwk::wSharedObject
37 {
38 public:
39  std::shared_ptr<Problem> pbl;
40  std::shared_ptr<tbox::LinearSolver> linsol;
41 
42  int nthreads;
43  double relTol;
44  double absTol;
45  int maxIt;
46  int verbose;
47 
48  int nIt;
49  std::vector<double> phi;
50  std::vector<double> rPhi;
51  std::vector<double> vPhi;
52  std::vector<Eigen::Vector3d> U;
53  std::vector<double> rho;
54  std::vector<double> M;
55  std::vector<double> Cp;
56  double Cl;
57  double Cd;
58  double Cs;
59  double Cm;
60 
61 protected:
62  fwk::Timers tms;
63  std::vector<int> rows;
64 
65 public:
66  Solver(std::shared_ptr<Problem> _pbl, std::shared_ptr<tbox::LinearSolver> _linsol);
67  virtual ~Solver();
68 
69  virtual bool run();
70  void save(tbox::MshExport *mshWriter, int n = 0);
71 
72 protected:
73  void computeFlow();
74  void computeLoad();
75 };
76 
77 } // namespace flow
78 #endif //WSOLVER_H
flow::Solver::tms
fwk::Timers tms
internal timers
Definition: wSolver.h:62
flow::Solver::pbl
std::shared_ptr< Problem > pbl
problem definition
Definition: wSolver.h:39
flow::Solver::rPhi
std::vector< double > rPhi
residual on potential
Definition: wSolver.h:50
flow::Solver::nthreads
int nthreads
number of threads for the execution
Definition: wSolver.h:42
flow::Solver
Base solver class.
Definition: wSolver.h:36
flow::Solver::U
std::vector< Eigen::Vector3d > U
velocity
Definition: wSolver.h:52
flow::Solver::absTol
double absTol
absolute tolerance on the residual
Definition: wSolver.h:44
FLOW_API
#define FLOW_API
Definition: flow.h:29
flow::Solver::rho
std::vector< double > rho
density
Definition: wSolver.h:53
flow::Solver::maxIt
int maxIt
max number of iterations
Definition: wSolver.h:45
flow
Namespace for flow module.
Definition: flow.h:37
flow::Solver::Cl
double Cl
lift coefficient
Definition: wSolver.h:56
flow::Solver::Cm
double Cm
pitch moment coefficient (positive nose-up)
Definition: wSolver.h:59
flow::Solver::Cs
double Cs
sideforce coefficient
Definition: wSolver.h:58
flow::Solver::linsol
std::shared_ptr< tbox::LinearSolver > linsol
linear solver
Definition: wSolver.h:40
flow::Solver::M
std::vector< double > M
mach number
Definition: wSolver.h:54
flow::Solver::vPhi
std::vector< double > vPhi
perturbation potential
Definition: wSolver.h:51
flow::Solver::verbose
int verbose
display more info
Definition: wSolver.h:46
flow::Solver::relTol
double relTol
relative tolerance on the residual
Definition: wSolver.h:43
flow::Solver::Cp
std::vector< double > Cp
pressure coefficient
Definition: wSolver.h:55
flow::Solver::phi
std::vector< double > phi
full potential
Definition: wSolver.h:49
flow::Solver::nIt
int nIt
number of iterations
Definition: wSolver.h:48
flow.h
flow::Solver::Cd
double Cd
drag coefficient
Definition: wSolver.h:57
flow::Solver::rows
std::vector< int > rows
unknown nodal index
Definition: wSolver.h:63