File: PoissonSolver.h

package info (click to toggle)
lammps 20220106.git7586adbb6a%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 348,064 kB
  • sloc: cpp: 831,421; python: 24,896; xml: 14,949; f90: 10,845; ansic: 7,967; sh: 4,226; perl: 4,064; fortran: 2,424; makefile: 1,501; objc: 238; lisp: 163; csh: 16; awk: 14; tcl: 6
file content (137 lines) | stat: -rw-r--r-- 2,776 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#ifndef POISSON_SOLVER_H
#define POISSON_SOLVER_H

// ATC includes
#include "Array2D.h"
#include "LinearSolver.h"
#include "PhysicsModel.h"
#include "NonLinearSolver.h"

// other includes
#include <vector>
#include <map>

namespace ATC {

// Forward class declarations
class ATC_Coupling;
class FE_Engine;
class PrescribedDataManager;
class PhysicsModel;

/**
 *  @class PoissonSolver
 *  @brief a class to solve the Poisson equation of electro-statics
 */
class PoissonSolver {

 public:

  /** Constructor */
  PoissonSolver(
    const FieldName fieldName,
    const PhysicsModel * physicsModel,
    const FE_Engine * feEngine,
    const PrescribedDataManager * prescribedDataMgr,
    /*const*/ ATC_Coupling * atc,
    const Array2D<bool> & rhsMask,
    const int solverType = LinearSolver::DIRECT_SOLVE,
    bool parallel = false
  );

  /** Destructor */
  ~PoissonSolver();

  /** parser */
  bool modify(int narg, char **arg);

  /** initialize */
  void initialize(void);

  /** compute_rhs */
  void compute_rhs(const FIELDS & fields, FIELDS & rhs);

  /** solve */
  bool solve(FIELDS & fields, FIELDS & rhs); // rhs is a return value
  bool solve(DENS_MAT & field, const DENS_MAT & rhs); // rhs is input

  /** greens function */
  void greens_function(const int I, VECTOR & inv_stiffness_I) const
  {
    solver_->greens_function(I,inv_stiffness_I);
  }

  /** access to penalty coefficient */
  double penalty_coefficient() const
  {
    return solver_->penalty_coefficient();
  }

  /** set tolerance for underlying solver */
  void set_tolerance(double tol)
  {
    solverTol_ = tol;
  }

  /** set max iterations for underlying solver */
  void set_max_iterations(int maxIter)
  {
    solverMaxIter_ = maxIter;
  }

 protected:

  /** set atomic charges from electron model */
  void set_charges(FIELDS & fields);

  /** Pointer to ATC_Tranfer */
  ATC_Coupling * atc_;

  /** Pointer to FE_Engine */
  const FE_Engine * feEngine_;

  /** Pointer to PrescribedDataManager */
  const PrescribedDataManager * prescribedDataMgr_;

  /** Pointer to FE_Engine */
  const PhysicsModel * physicsModel_;

  /** field to solve for */
  FieldName fieldName_;

  /** number of nodes */
  int nNodes_;

  /** degree-of-freedom */
  int dof_;

  /** righthand side vector */
  Array2D<bool> rhsMask_;

  /** linear Poisson equation */
  bool linear_;

  /** solver */
  LinearSolver * solver_;
  NonLinearSolver *solverNL_;
  PhysicsModelTangentOperator * tangent_;
  int solverType_;
  double solverTol_;
  int solverMaxIter_;

  /** source quadrature */
  IntegrationDomainType integrationType_;

  /** stiffness matrix */

  SPAR_MAT stiffness_;

  /** use owned grid */
  bool useOwnGrid_;

  /** run solve in parallel */
  bool parallel_;
};

} // namespace ATC
#endif