waves
Basic FE playground
wNewton.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 WNEWTON_H
18 #define WNEWTON_H
19 
20 #include "flow.h"
21 #include "wSolver.h"
22 
23 #include <iostream>
24 #include <vector>
25 #include <memory>
26 #include <Eigen/Sparse>
27 
28 namespace flow
29 {
30 
35 class FLOW_API Newton : public Solver
36 {
37  friend class Adjoint;
38  friend class FpeLSFunction;
39 
40 public:
41  double lsTol;
42  int maxLsIt;
43  double avThrsh;
44 
45 private:
46  double mCOv;
47  double muCv;
48 
49 public:
50  Newton(std::shared_ptr<Problem> _pbl, std::shared_ptr<tbox::LinearSolver> _linsol);
51 
52  virtual bool run() override;
53 
54 #ifndef SWIG
55  virtual void write(std::ostream &out) const override;
56 #endif
57 
58 private:
59  void buildJac(Eigen::SparseMatrix<double, Eigen::RowMajor> &J);
60  void buildRes(Eigen::Map<Eigen::VectorXd> &R);
61  void findUpwd();
62 };
63 
64 } // namespace flow
65 
66 #endif //WNEWTON_H
flow::Solver
Base solver class.
Definition: wSolver.h:36
FLOW_API
#define FLOW_API
Definition: flow.h:29
flow
Namespace for flow module.
Definition: flow.h:37
flow::FpeLSFunction
Line search function for Full Potential Equation.
Definition: wFpeLSFunction.h:33
flow::Newton::mCOv
double mCOv
variable cut-off Mach number
Definition: wNewton.h:46
flow::Newton::maxLsIt
int maxLsIt
max number of line search
Definition: wNewton.h:42
flow::Newton::avThrsh
double avThrsh
residual threshold to deacrease artificial viscosity
Definition: wNewton.h:43
flow::Adjoint
Adjoint solver class.
Definition: wAdjoint.h:36
flow::Newton::lsTol
double lsTol
tolerance for line search
Definition: wNewton.h:41
wSolver.h
flow.h
flow::Newton::muCv
double muCv
variable artificial viscosity scaling factor
Definition: wNewton.h:47
flow::Newton
Newton solver.
Definition: wNewton.h:35