Computes the electric field \(\vec{E}\) as a negative gradient of the scalar electric potential, \(\Phi\), i.e., \(\vec{E} = - \vec{\nabla} \Phi\). More...
#include <project_PHI_to_E.hpp>


Public Member Functions | |
| ProjectPHItoE (unsigned int p, unsigned int mapping_degree, const Triangulation< dim > &triangulation_PHI, const DoFHandler< dim > &dof_handler_PHI, const Vector< double > &solution_PHI, std::string fname="E", const Function< dim > *exact_solution=nullptr, bool axisymmetric=false, bool print_time_tables=false, bool project_exact_solution=false, bool log_cg_convergence=false, bool write_higher_order_cells=false) | |
| The only constructor. More... | |
Public Member Functions inherited from StaticScalarSolver::ProjectHgradToHcurl< dim, 1 > | |
| ProjectHgradToHcurl (unsigned int p, unsigned int mapping_degree, const Triangulation< dim > &triangulation_Hgrad, const DoFHandler< dim > &dof_handler_Hgrad, const Vector< double > &solution_Hgrad, const std::string fname="Hcurl", const Function< dim > *exact_solution=nullptr, bool axisymmetric=false, bool vector_potential=false, bool print_time_tables=false, bool project_exact_solution=false, bool log_cg_convergence=false, bool write_higher_order_cells=false) | |
| The only constructor. More... | |
| double | get_L2_norm () |
| Returns \(L^2\) error norm. | |
| double | get_Linfty_norm () |
| Returns \(L^{\infty}\) error norm. | |
| unsigned int | get_n_cells () const |
| Returns the number of active cells in the mesh. | |
| unsigned int | get_n_dofs () const |
| Returns the total amount of the degrees of freedom. | |
| void | clear () |
| Releases computer memory associated with system matrix and right-hand side. | |
| const Triangulation< dim > & | get_tria () const |
| Returns a reference to triangulation. | |
| const DoFHandler< dim > & | get_dof_handler () const |
| Returns a reference to dof handler associated with the Nedelec finite elements. | |
| const Vector< double > & | get_solution () const |
| Returns a reference to solution, i.e., the result of the projection. | |
| void | save_matrix_and_rhs_to_csv (std::string fname) const |
| Saves the system matrix and the right-hand side into a csv file. More... | |
Computes the electric field \(\vec{E}\) as a negative gradient of the scalar electric potential, \(\Phi\), i.e., \(\vec{E} = - \vec{\nabla} \Phi\).
The problem is assumed to be two- or three- dimensional. This class template is meant to be used in conjunction with StaticScalarSolver::Solver.
The scalar electric potential, \(\Phi\), is assumed to be an output of an object of the class StaticScalarSolver::Solver. That is, \(\Phi\) is expressed as a linear combination of the shape functions of the FE_Q finite elements. In other words, \(\Phi\) is in the \(H(\text{grad})\) function space. This class template computes electric field \(\vec{E}\) as a negative gradient of the scalar electric potential, \(\Phi\), such that \(\vec{E}\) is expressed as a linear combination of the shape functions of the FE_Nedelec finite elements. That is, \(\vec{E}\) is in the \(H(\text{curl})\) function space. In other words, this class template takes a scalar function \(\Phi\) from the \(H(\text{grad})\) function space, calculates its gradient, multiplies the gradient by \(-1\), and projects the result into \(H(\text{curl})\) function space, which is a proper space for the electric field \(\vec{E}\). The operation of projection is illustrated by means of the Bossavit's diagrams below.
It is assumed that the object of the class StaticScalarSolver::Solver that yielded \(\Phi\) is still in the computer memory such that the triangulation, the degrees of freedom, and the handler of the degrees of freedom are accessible while \(\vec{E}\) is computed. An object of the StaticScalarSolver::ProjectPHItoE class template reuses the triangulation by creating an additional dof handler associated with the FE_Nedelec finite elements. That is, \(\vec{E}\) and \(\Phi\) share the same triangulation but are modeled by different finite elements: \(\vec{E}\) - by FE_Nedelec and \(\Phi\) - by FE_Q. In this disposition there are two DoFHandler objects associated with one Triangulation object. The algorithm walks synchronously through both DoFHandler objects and assembles the system matrix and the right-hand side. The algorithm utilizes the WorkStream technology of deal.II. The amount of threads used can be limited as the following
The output data are saved into a vtk file. The following data are saved:
The "L2norm", "LinftyNorm", and "VectorFieldExact" are saved only if an exact solution is passed to the constructor. Moreover, "VectorFieldExact" is calculated and saved only if the input parameter project_exact_solution passed to the constructor equals true.
The user is supposed to derive an object from this class template. All usual computations, i.e., setup, assembling the linear system, etc., happen automatically.
Definition at line 100 of file project_PHI_to_E.hpp.
|
inline |
The only constructor.
Constructs the object and runs the calculations. That is, there is no need to call other functions such as run().
| [in] | p | - The degree of the FE_Nedelec finite elements. |
| [in] | mapping_degree | - The degree of the interpolating polynomials used for mapping. Setting it to 1 will do in the most of the cases. Note, that it makes sense to attach a meaningful manifold to the triangulation if this parameter is greater than 1. |
| [in] | triangulation_PHI | - Reference to the triangulation inside the object of the class StaticScalarSolver::Solver that has yielded the scalar electric potential, \(\Phi\). |
| [in] | dof_handler_PHI | - Reference to the dof handler inside the class StaticScalarSolver::Solver that has yielded the scalar electric potential, \(\Phi\). |
| [in] | solution_PHI | - Vector filled with the degrees of freedom that together with the shape functions of the FE_Q finite elements model the total scalar electric potential, \(\Phi\). |
| [in] | fname | - The name of the output files without extension. |
| [in] | exact_solution | - Points to an object that describes the exact solution to the problem. It is needed for calculating error norms. The exact solution object must exist in the computer memory at the time of calling this constructor. |
| [in] | axisymmetric | - If true, assumes that the problem is axisymmetric. In this case, of course, the problem must be two- dimensional. |
| [in] | print_time_tables | - If true, prints time tables on the screen. |
| [in] | project_exact_solution | - If true, projects the exact solution onto the space spanned by the Nedelec finite elements and saves the result into the output file next to \(\vec{E}\). |
| [in] | log_cg_convergence | - If true, logs convergence of the conjugate gradient solver into a file. The name of the file is generated by appending "_cg_convergence.csv" to fname. |
| [in] | write_higher_order_cells | - If false, the data is saved in the file fname.vtk. Higher-order cells are not saved. If true, the data is saved into fname.vtu file preserving the higher-order cells. In this case the file can be viewed with a help of Paraview version 5.5.0 or higher. |
Definition at line 148 of file project_PHI_to_E.hpp.