5#ifndef IPPL_FEM_MAXWELL_DIFFUSION_SOLVER_H
6#define IPPL_FEM_MAXWELL_DIFFUSION_SOLVER_H
12#include "FEM/FEMQuadratureData.h"
13#include "LinearSolvers/PCG.h"
28 template <
typename T,
unsigned Dim,
unsigned numElementDOFs>
73 T curlTerm = dot(
DPhiInvT * qd.deriv_q[j],
DPhiInvT * qd.deriv_q[i]).apply();
74 T massTerm = dot(qd.val_q[j], qd.val_q[i]).apply();
87 template <
typename FieldType>
89 constexpr static unsigned Dim = FieldType::dim;
93 using T =
typename FieldType::value_type::value_type;
99 using MeshType =
typename FieldType::Mesh_t;
125 :
Base(lhs, lhs, rhs)
130 static_assert(std::is_floating_point<T>::value,
"Not a floating point type");
160 const auto firstElementVertexPoints =
165 refElement_m.getInverseTransposeTransformationJacobian(firstElementVertexPoints);
169 const T absDetDPhi = Kokkos::abs(
170 refElement_m.getDeterminantOfTransformationJacobian(firstElementVertexPoints));
178 const auto algoOperator = [maxwellDiffusionEval,
187 return return_vector;
200 std::string msg = e.where() +
": " + e.what() +
"\n";
201 Kokkos::abort(msg.c_str());
205 lhsVector_m = std::make_unique<FEMVector<T>>(lhsVector);
258 template <
typename F>
275 this->params_m.
add(
"max_iterations", 10);
276 this->params_m.
add(
"tolerance", (T)1e-13);
Definition IpplException.h:6
virtual int getIterationCount()
Definition PCG.h:106
virtual void setOperator(OperatorF op)
Definition PCG.h:70
A solver for the electric diffusion equation given by and using the Nédélec basis functions.
Definition FEMMaxwellDiffusionSolver.h:88
std::unique_ptr< FEMVector< T > > rhsVector_m
FEM represenation of the rhs We use this to store the rhs b of the System Ax = b used in the Galerkin...
Definition FEMMaxwellDiffusionSolver.h:284
virtual void setDefaultParameters()
Sets the default values for the CG solver. Defaults are: max Iterations = 10, tolerance = 1e-13.
Definition FEMMaxwellDiffusionSolver.h:274
Kokkos::View< point_t * > reconstructToPoints(const Kokkos::View< point_t * > &positions)
Reconstructs function values at arbitrary points in the mesh.
Definition FEMMaxwellDiffusionSolver.h:247
void solve() override
Solve the equation using finite element methods.
Definition FEMMaxwellDiffusionSolver.h:155
T getL2Error(const F &analytic)
Given an analytical solution computes the L2 norm error.
Definition FEMMaxwellDiffusionSolver.h:259
QuadratureType quadrature_m
The quadrature rule we use.
Definition FEMMaxwellDiffusionSolver.h:301
T getResidue() const
Definition FEMMaxwellDiffusionSolver.h:222
PCGSolverAlgorithm_t pcg_algo_m
The CG Solver we use.
Definition FEMMaxwellDiffusionSolver.h:268
int getIterationCount()
Definition FEMMaxwellDiffusionSolver.h:216
ElementType refElement_m
the reference element we have.
Definition FEMMaxwellDiffusionSolver.h:296
NedelecType nedelecSpace_m
The Nedelec Space object.
Definition FEMMaxwellDiffusionSolver.h:309
std::unique_ptr< FEMVector< T > > lhsVector_m
FEM represenation of the solution vector We use this to store the solution x of the System Ax = b use...
Definition FEMMaxwellDiffusionSolver.h:291
1D vector used in the context of FEM.
Definition FEMVector.h:34
void fillHalo()
Copy values from neighboring ranks into local halo.
Definition FEMVector.hpp:38
void accumulateHalo()
Accumulate halo values in neighbor.
Definition FEMVector.hpp:95
FEMVector< T > deepCopy() const
Create a deep copy, where all the information of this vector is copied to a new one.
Definition FEMVector.hpp:234
KOKKOS_FUNCTION vertex_points_t getElementMeshVertexPoints(const indices_t &elementNDIndex) const
Get all the global vertex points of an element (given by its NDIndex).
Definition FiniteElementSpace.hpp:271
Definition HexahedralElement.h:14
FEMVector< T > evaluateAx(FEMVector< T > &x, F &evalFunction) const
Assembly operations ///////////////////////////////////////////////.
Definition NedelecSpace.hpp:372
T computeError(const FEMVector< T > &u_h, const F &u_sol) const
Error norm computations ///////////////////////////////////////////.
Definition NedelecSpace.hpp:912
FEMVector< T > evaluateLoadVector(const FEMVector< point_t > &f) const
Assemble the load vector b of the system Ax = b, given a field of the right hand side defined at the ...
Definition NedelecSpace.hpp:494
Kokkos::View< point_t * > reconstructToPoints(const Kokkos::View< point_t * > &positions, const FEMVector< T > &coef) const
Reconstructs function values at arbitrary points in the mesh given the Nedelec DOF coefficients.
Definition NedelecSpace.hpp:830
void add(const std::string &key, const T &value)
Definition ParameterList.h:44
Representation of the lhs of the problem we are trying to solve.
Definition FEMMaxwellDiffusionSolver.h:29
KOKKOS_FUNCTION auto operator()(size_t i, size_t j, const QuadratureData< Vector< T, Dim >, Vector< T, Dim >, numElementDOFs > &qd) const
Returns the evaluation of (curl(b_i)*curl(b_j) + b_i*b_j)*absDetDPhi.
Definition FEMMaxwellDiffusionSolver.h:70
const T absDetDPhi
The determinant of the Jacobian.
Definition FEMMaxwellDiffusionSolver.h:44
const Vector< T, Dim > DPhiInvT
The inverse transpose Jacobian.
Definition FEMMaxwellDiffusionSolver.h:36
EvalFunctor(Vector< T, Dim > DPhiInvT, T absDetDPhi)
Constructor.
Definition FEMMaxwellDiffusionSolver.h:49
Per-quadrature-node basis data passed to evaluateAx evaluator functors.
Definition FEMQuadratureData.h:18