DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
MultiVectorPoissonLinearSolverProblem.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (c) 2017-2025 The Regents of the University of Michigan and DFT-FE
4// authors.
5//
6// This file is part of the DFT-FE code.
7//
8// The DFT-FE code is free software; you can use it, redistribute
9// it, and/or modify it under the terms of the GNU Lesser General
10// Public License as published by the Free Software Foundation; either
11// version 2.1 of the License, or (at your option) any later version.
12// The full text of the license can be found in the file LICENSE at
13// the top level of the DFT-FE distribution.
14//
15// ---------------------------------------------------------------------
16//
17
18#ifndef DFTFE_MULTIVECTORPOISSONLINEARSOLVERPROBLEM_H
19#define DFTFE_MULTIVECTORPOISSONLINEARSOLVERPROBLEM_H
20
22#include "headers.h"
23#include "BLASWrapper.h"
24#include "FEBasisOperations.h"
25namespace dftfe
26{
27 /*
28 * @brief Extension of the poissonSolverProblem to multi Vector
29 */
30 template <dftfe::utils::MemorySpace memorySpace>
32 : public MultiVectorLinearSolverProblem<memorySpace>
33 {
34 public:
35 // Constructor
36 MultiVectorPoissonLinearSolverProblem(const MPI_Comm &mpi_comm_parent,
37 const MPI_Comm &mpi_comm_domain);
38
39 // Destructor
41
42 /*
43 * @brief reinit function to set up the internal variables
44 * this function calls the computeDiagonal() and preComputeShapeFunction()
45 */
46 void
48 BLASWrapperPtr,
49 std::shared_ptr<
51 basisOperationsPtr,
52 const dealii::AffineConstraints<double> &constraintMatrix,
53 const unsigned int matrixFreeVectorComponent,
54 const unsigned int matrixFreeQuadratureComponentRhs,
55 const unsigned int matrixFreeQuadratureComponentAX,
56 bool isComputeMeanValueConstraint);
57 /**
58 * @brief Compute right hand side vector for the problem Ax = rhs.
59 *
60 * @param rhs vector for the right hand side values
61 */
66 unsigned int blockSizeInput) override;
67
68 /**
69 * @brief Compute A matrix multipled by x.
70 *
71 */
72 void
75 unsigned int blockSize) override;
76
77 /**
78 * @brief Apply the constraints to the solution vector.
79 *
80 */
81 void
82 distributeX() override;
83
84 /**
85 * @brief Jacobi preconditioning function.
86 *
87 */
88 void
92 const double omega) const override;
93
94
95 /**
96 * @brief Apply square-root of the Jacobi preconditioner function.
97 *
98 */
99 void
103 const double omega) const override;
104
105 /**
106 * @brief function to set data for Rhs Vec.
107 * @param[in] inputQuadData the value of the right hand side at the quad
108 * points
109 */
110 void
113
114
115 void
117
118 private:
119 void
121
122 void
124
125 void
127
128 void
130
132
134
135 /// pointer to dealii dealii::AffineConstraints<double> object
136 const dealii::AffineConstraints<double> *d_constraintMatrixPtr;
137
138 /// the vector that stores the output obtained by solving the poisson
139 /// problem
142
145 unsigned int d_blockSize;
146
149
150 std::shared_ptr<dftfe::linearAlgebra::BLASWrapper<memorySpace>>
152
153 std::shared_ptr<
156
157 /// pointer to dealii MatrixFree object
158 const dealii::MatrixFree<3, double> *d_matrixFreeDataPtr;
159
162
164
165 /// data members for the mpi implementation
167 const unsigned int n_mpi_processes;
168 const unsigned int this_mpi_process;
169 dealii::ConditionalOStream pcout;
171
174
178 double d_beta;
179 double d_alpha;
182
183
186
189
190
192
194
195 /// pointer to the dealii::DofHandler object. This is already part of the
196 /// matrixFreeData object.
197 const dealii::DoFHandler<3> *d_dofHandler;
198
199 /**
200 * @brief finite-element cell level matrix to store dot product between shapeFunction gradients (\int(\nabla N_i \cdot \nabla N_j))
201 * with first dimension traversing the macro cell id
202 * and second dimension storing the matrix of size numberNodesPerElement x
203 * numberNodesPerElement in a flattened 1D dealii Vectorized array
204 */
206
207 /**
208 * @brief finite-element cell level matrix to store dot product between shapeFunction gradients (\int(\nabla N_i ))
209 * with first dimension traversing the macro cell id
210 * and second dimension storing the matrix of size numberNodesPerElement in
211 * a flattened 1D dealii Vectorized array
212 */
213 std::vector<double> d_cellShapeFunctionJxW;
214
215 /// storage for shapefunctions
216 std::vector<double> d_shapeFunctionValue;
217
218 unsigned int d_cellBlockSize;
219 };
220
221} // namespace dftfe
222
223
224#endif // DFTFE_MULTIVECTORPOISSONLINEARSOLVERPROBLEM_H
Definition MultiVectorLinearSolverProblem.h:31
char d_transA
Definition MultiVectorPoissonLinearSolverProblem.h:180
std::vector< double > d_shapeFunctionValue
storage for shapefunctions
Definition MultiVectorPoissonLinearSolverProblem.h:216
bool d_isMeanValueConstraintComputed
Definition MultiVectorPoissonLinearSolverProblem.h:133
const dealii::DoFHandler< 3 > * d_dofHandler
Definition MultiVectorPoissonLinearSolverProblem.h:197
double d_beta
Definition MultiVectorPoissonLinearSolverProblem.h:178
const unsigned int n_mpi_processes
Definition MultiVectorPoissonLinearSolverProblem.h:167
bool d_isComputeDiagonalA
Definition MultiVectorPoissonLinearSolverProblem.h:131
dftfe::utils::MemoryStorage< double, memorySpace > d_xCellLLevelNodalData
Definition MultiVectorPoissonLinearSolverProblem.h:187
const dealii::MatrixFree< 3, double > * d_matrixFreeDataPtr
pointer to dealii MatrixFree object
Definition MultiVectorPoissonLinearSolverProblem.h:158
unsigned int d_matrixFreeQuadratureComponentAX
Definition MultiVectorPoissonLinearSolverProblem.h:193
dftfe::utils::MemoryStorage< double, memorySpace > d_diagonalA
Definition MultiVectorPoissonLinearSolverProblem.h:147
void setDataForRhsVec(dftfe::utils::MemoryStorage< double, memorySpace > &inputQuadData)
function to set data for Rhs Vec.
void vmult(dftfe::linearAlgebra::MultiVector< double, memorySpace > &Ax, dftfe::linearAlgebra::MultiVector< double, memorySpace > &x, unsigned int blockSize) override
Compute A matrix multipled by x.
double d_scalarCoeffAlpha
Definition MultiVectorPoissonLinearSolverProblem.h:177
unsigned int d_nQuadsPerCell
Definition MultiVectorPoissonLinearSolverProblem.h:193
std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< memorySpace > > d_BLASWrapperPtr
Definition MultiVectorPoissonLinearSolverProblem.h:151
std::vector< double > d_cellShapeFunctionGradientIntegral
finite-element cell level matrix to store dot product between shapeFunction gradients (\int(\nabla N_...
Definition MultiVectorPoissonLinearSolverProblem.h:205
void distributeX() override
Apply the constraints to the solution vector.
const dftfe::utils::MemoryStorage< double, memorySpace > * d_cellStiffnessMatrixPtr
Definition MultiVectorPoissonLinearSolverProblem.h:161
std::shared_ptr< dftfe::basis::FEBasisOperations< double, double, memorySpace > > d_basisOperationsPtr
Definition MultiVectorPoissonLinearSolverProblem.h:155
double d_negScalarCoeffAlpha
Definition MultiVectorPoissonLinearSolverProblem.h:176
unsigned int d_matrixFreeVectorComponent
Definition MultiVectorPoissonLinearSolverProblem.h:144
size_type d_numberDofsPerElement
Definition MultiVectorPoissonLinearSolverProblem.h:172
char d_transB
Definition MultiVectorPoissonLinearSolverProblem.h:181
dftfe::utils::MemoryStorage< dftfe::global_size_type, memorySpace > d_mapNodeIdToProcId
Definition MultiVectorPoissonLinearSolverProblem.h:185
dftfe::utils::MemoryStorage< double, memorySpace > d_diagonalSqrtA
Definition MultiVectorPoissonLinearSolverProblem.h:148
size_type d_inc
Definition MultiVectorPoissonLinearSolverProblem.h:175
dealii::ConditionalOStream pcout
Definition MultiVectorPoissonLinearSolverProblem.h:169
dftfe::utils::MemoryStorage< dftfe::global_size_type, memorySpace > d_mapQuadIdToProcId
Definition MultiVectorPoissonLinearSolverProblem.h:185
const dealii::AffineConstraints< double > * d_constraintMatrixPtr
pointer to dealii dealii::AffineConstraints<double> object
Definition MultiVectorPoissonLinearSolverProblem.h:136
void precondition_JacobiSqrt(dftfe::linearAlgebra::MultiVector< double, memorySpace > &dst, const dftfe::linearAlgebra::MultiVector< double, memorySpace > &src, const double omega) const override
Apply square-root of the Jacobi preconditioner function.
dftfe::utils::MemoryStorage< double, memorySpace > * d_rhsQuadDataPtr
Definition MultiVectorPoissonLinearSolverProblem.h:191
std::vector< double > d_cellShapeFunctionJxW
finite-element cell level matrix to store dot product between shapeFunction gradients (\int(\nabla N_...
Definition MultiVectorPoissonLinearSolverProblem.h:213
size_type d_locallyOwnedSize
Definition MultiVectorPoissonLinearSolverProblem.h:170
dftfe::linearAlgebra::MultiVector< double, memorySpace > * d_blockedXPtr
Definition MultiVectorPoissonLinearSolverProblem.h:140
void tempRhsVecCalc(dftfe::linearAlgebra::MultiVector< double, memorySpace > &rhs)
void reinit(std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< memorySpace > > BLASWrapperPtr, std::shared_ptr< dftfe::basis::FEBasisOperations< double, double, memorySpace > > basisOperationsPtr, const dealii::AffineConstraints< double > &constraintMatrix, const unsigned int matrixFreeVectorComponent, const unsigned int matrixFreeQuadratureComponentRhs, const unsigned int matrixFreeQuadratureComponentAX, bool isComputeMeanValueConstraint)
const MPI_Comm d_mpi_parent
Definition MultiVectorPoissonLinearSolverProblem.h:166
dftfe::linearAlgebra::MultiVector< double, memorySpace > * d_blockedNDBCPtr
Definition MultiVectorPoissonLinearSolverProblem.h:141
dftfe::linearAlgebra::MultiVector< double, memorySpace > & computeRhs(dftfe::linearAlgebra::MultiVector< double, memorySpace > &NDBCVec, dftfe::linearAlgebra::MultiVector< double, memorySpace > &outputVec, unsigned int blockSizeInput) override
Compute right hand side vector for the problem Ax = rhs.
MultiVectorPoissonLinearSolverProblem(const MPI_Comm &mpi_comm_parent, const MPI_Comm &mpi_comm_domain)
void precondition_Jacobi(dftfe::linearAlgebra::MultiVector< double, memorySpace > &dst, const dftfe::linearAlgebra::MultiVector< double, memorySpace > &src, const double omega) const override
Jacobi preconditioning function.
dftfe::utils::MemoryStorage< double, memorySpace > d_AxCellLLevelNodalData
Definition MultiVectorPoissonLinearSolverProblem.h:188
unsigned int d_matrixFreeQuadratureComponentRhs
Definition MultiVectorPoissonLinearSolverProblem.h:143
const MPI_Comm mpi_communicator
data members for the mpi implementation
Definition MultiVectorPoissonLinearSolverProblem.h:166
size_type d_numCells
Definition MultiVectorPoissonLinearSolverProblem.h:173
dftUtils::constraintMatrixInfo< memorySpace > d_constraintsInfo
Definition MultiVectorPoissonLinearSolverProblem.h:163
const unsigned int this_mpi_process
Definition MultiVectorPoissonLinearSolverProblem.h:168
dftfe::linearAlgebra::MultiVector< double, memorySpace > d_rhsVec
Definition MultiVectorPoissonLinearSolverProblem.h:141
unsigned int d_blockSize
Definition MultiVectorPoissonLinearSolverProblem.h:145
unsigned int d_cellBlockSize
Definition MultiVectorPoissonLinearSolverProblem.h:218
double d_alpha
Definition MultiVectorPoissonLinearSolverProblem.h:179
Definition FEBasisOperations.h:84
Overloads dealii's distribute and distribute_local_to_global functions associated with constraints cl...
Definition constraintMatrixInfo.h:43
Definition BLASWrapper.h:35
An class template to encapsulate a MultiVector. A MultiVector is a collection of vectors belonging t...
Definition MultiVector.h:127
Definition MemoryStorage.h:33
Definition pseudoPotentialToDftfeConverter.cc:34
unsigned int size_type
Definition TypeConfig.h:6