5#ifndef IPPL_FEM_MAXWELL_DIFFUSION_SOLVER_H
6#define IPPL_FEM_MAXWELL_DIFFUSION_SOLVER_H
26 template <
typename T,
unsigned Dim,
unsigned numElementDOFs>
74 T massTerm =
dot(val_b_q_k[j], val_b_q_k[i]).apply();
87 template <
typename FieldType>
89 constexpr static unsigned Dim = FieldType::dim;
93 using T =
typename FieldType::value_type::value_type;
106 using ElementType = std::conditional_t<Dim == 2, ippl::QuadrilateralElement<T>,
124 :
Base(lhs, lhs, rhs)
130 static_assert(std::is_floating_point<T>::value,
"Not a floating point type");
163 const auto firstElementVertexPoints =
168 refElement_m.getInverseTransposeTransformationJacobian(firstElementVertexPoints);
172 const T absDetDPhi = Kokkos::abs(
173 refElement_m.getDeterminantOfTransformationJacobian(firstElementVertexPoints));
178 DPhiInvT, absDetDPhi);
181 const auto algoOperator = [maxwellDiffusionEval,
this](
FEMVector<T> vector)
190 return return_vector;
203 std::string msg =
e.where() +
": " +
e.what() +
"\n";
208 lhsVector_m = std::make_unique<FEMVector<T>>(lhsVector);
264 template <
typename F>
ippl::UniformCartesian< double, 3 > Mesh_t
constexpr double e
The value of.
Implementations for FFT constructor/destructor and transforms.
KOKKOS_INLINE_FUNCTION detail::meta_dot< E1, E2 > dot(const detail::Expression< E1, N1 > &u, const detail::Expression< E2, N2 > &v)
void abort(const char *msg, int errorcode)
1D vector used in the context of FEM.
void fillHalo()
Copy values from neighboring ranks into local halo.
void accumulateHalo()
Accumulate halo values in neighbor.
KOKKOS_FUNCTION vertex_points_t getElementMeshVertexPoints(const indices_t &elementNDIndex) const
Get all the global vertex points of an element (given by its NDIndex).
FEMVector< T > evaluateAx(FEMVector< T > &x, F &evalFunction) const
Assembly operations ///////////////////////////////////////////////.
T computeError(const FEMVector< T > &u_h, const F &u_sol) const
Error norm computations ///////////////////////////////////////////.
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 ...
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.
virtual T getResidue() const
virtual int getIterationCount()
virtual void setOperator(OperatorF op)
Representation of the lhs of the problem we are trying to solve.
KOKKOS_FUNCTION auto operator()(size_t i, size_t j, const ippl::Vector< ippl::Vector< T, Dim >, numElementDOFs > &curl_b_q_k, const ippl::Vector< ippl::Vector< T, Dim >, numElementDOFs > &val_b_q_k) const
Returns the evaluation of (curl(b_i)*curl(b_j) + b_i*b_j)*absDetDPhi.
const T absDetDPhi
The determinant of the Jacobian.
const Vector< T, Dim > DPhiInvT
The inverse transpose Jacobian.
EvalFunctor(Vector< T, Dim > DPhiInvT, T absDetDPhi)
Constructor.
A solver for the electric diffusion equation given by and using the Nédélec basis functions.
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...
typename FieldType::Mesh_t MeshType
void setRhs(FieldType &rhs, const FEMVector< point_t > &rhsVector)
virtual void setDefaultParameters()
Sets the default values for the CG solver.
Kokkos::View< point_t * > reconstructToPoints(const Kokkos::View< point_t * > &positions)
Reconstructs function values at arbitrary points in the mesh.
void solve() override
Solve the equation using finite element methods.
FEMMaxwellDiffusionSolver()
T getL2Error(const F &analytic)
Given an analytical solution computes the L2 norm error.
static constexpr unsigned Dim
QuadratureType quadrature_m
The quadrature rule we use.
T getResidue() const
Query the residue.
FEMMaxwellDiffusionSolver(FieldType &lhs, FieldType &rhs, const FEMVector< point_t > &rhsVector)
typename FieldType::value_type::value_type T
PCGSolverAlgorithm_t pcg_algo_m
The CG Solver we use.
int getIterationCount()
Query how many iterations were required to obtain the solution the last time this solver was used.
ElementType refElement_m
the reference element we have.
NedelecType nedelecSpace_m
The Nedelec Space object.
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...
std::conditional_t< Dim==2, ippl::QuadrilateralElement< T >, ippl::HexahedralElement< T > > ElementType
void add(const std::string &key, const T &value)