PhotoElectrochemical Cell Simulator
A Finite Element Based Simulator For Water Splitting Solar Cells
Public Member Functions | Data Fields | Private Types
MixedPoisson::MixedFEM< dim > Class Template Reference

#include <MixedFEM.hpp>

Public Member Functions

 MixedFEM ()
 Simple constructor which instantiates test function.
 
 ~MixedFEM ()
 Simple desctructor which clears the dof_handler.
 
void assemble_local_Poisson_matrix (const typename DoFHandler< dim >::active_cell_iterator &cell, Assembly::AssemblyScratch< dim > &scratch, Assembly::Poisson::CopyData< dim > &data, const double &semi_permittivity, const double &elec_permittivity, const double &scaled_debye_length)
 Assembles the matrix for local cell in the mixed finite element metho in the mixed finite element method for Poissons equation. More...
 
void assemble_local_test_rhs (const typename DoFHandler< dim >::active_cell_iterator &cell, Assembly::AssemblyScratch< dim > &scratch, Assembly::Poisson::CopyData< dim > &data)
 
void compute_errors (const Triangulation< dim > &triangulation, DoFHandler< dim > &Poisson_dof_handler, Vector< double > &solution, double &potential_error, double &field_error) const
 Computes the local error of your approximation for the mixed method on the cell and stores the errors in potential_error and field_error. More...
 
void output_rescaled_results (DoFHandler< dim > &dof_handler, const Vector< double > &solution, const ParameterSpace::Parameters &sim_params, const unsigned int time_step_number) const
 
void output_unscaled_results (DoFHandler< dim > &dof_handler, const Vector< double > &solution, const unsigned int time_step_number) const
 

Data Fields

test_DD_Poisson::Poisson_RightHandSide< dim > test_coupling_Poisson_rhs
 
const test_Poisson::DirichletBoundaryValues< dim > test_Poisson_bc
 
const test_Poisson::RightHandSide< dim > test_Poisson_rhs
 
const test_Poisson::TrueSolution< dim > test_Poisson_solution
 

Private Types

enum  { Interface, Dirichlet, Neumann, Schottky }
 
enum  { semiconductor_id, semi_boundary_layer_id, electrolyte_id, elec_boundary_layer_id }
 

Detailed Description

template<int dim>
class MixedPoisson::MixedFEM< dim >

This class provides a mixed finite element method solver for Poisson's equation in the drit-diffusion-Poisson system with constant Debeye length. The class also can compute the error of the approximation for testing. The data is stored in Poisson::PoissonData.

The general Poisson equation problem we are solving is,

\[ \begin{align} \epsilon_{r}^{-1} \ \textbf{D} \ + \ \nabla \Phi \ &= \ 0 && \text{in} \; \Omega \\ \ \nabla \ \cdot \ \textbf{D} \ &= \frac{1}{\lambda^{2}} f(\textbf{x}) && \text{in} \; \Omega \\ \textbf{D} \ \cdot \ \boldsymbol \eta \ &= \ 0 && \text{on} \; \partial \Omega_{N} \\ \Phi \ &= \ \Phi_{D} && \text{on} \; \partial \Omega_{D} \end{align} \]

For \(\lambda^{2} \ = \ \frac{\Phi^{*} \epsilon }{L^{2} q C^{*}}\).

This becomes the problem in the weak formulation:

Find \(( \ \Phi \ , \ \textbf{D} \ ) \ \in \left( \ \text{W} \ \times \ [ \ 0 , \ T \ ] , \ \textbf{V}^{d} \ \times \ [ \ 0 , \ T \ ] \ \right) \) such that:

\[ \begin{align} \ \left( \textbf{p} \ , \ \epsilon_{r}^{-1} \ \textbf{D} \right)_{\Omega} \ - \ \left( \ \boldsymbol \nabla \cdot \ \textbf{p} \ , \ \Phi \right)_{\Omega} \; &= \; - \langle \textbf{p} \ , \ \Phi_{D} \rangle_{\Gamma_{D}} \\ - \left( v \ , \ \boldsymbol \nabla \cdot \textbf{D} \right)_{\Omega} \; &= \; - \frac{1}{\lambda^{2}} \ \left( v,\ f(\textbf{x}) \right)_{\Omega} \end{align} \]

For all \(( v \ , \ \textbf{p} ) \, \in \, W \, \times\, \textbf{V}^{d}\).

We obtain the electric field \(-\boldsymbol \nabla \Phi\) by setting,

\[ - \boldsymbol \nabla \Phi \ = \ \epsilon_{r}^{-1} \ \textbf{D} \]

Member Enumeration Documentation

template<int dim>
anonymous enum
private
Enumerator
Interface 

Marker for cells's face to be on the Interface.

Dirichlet 

Marker for cells's face to be on the Dirichlet boundary.

Neumann 

Marker for cells's face to be on the Neumann boundary.

Schottky 

Markert for cells' face to be on the Schottky boundary.

Member Function Documentation

template<int dim>
void MixedPoisson::MixedFEM< dim >::assemble_local_Poisson_matrix ( const typename DoFHandler< dim >::active_cell_iterator cell,
Assembly::AssemblyScratch< dim > &  scratch,
Assembly::Poisson::CopyData< dim > &  data,
const double &  semi_permittivity,
const double &  elec_permittivity,
const double &  scaled_debye_length 
)

Assembles the matrix for local cell in the mixed finite element metho in the mixed finite element method for Poissons equation.

This function can either be called when looping throug the cells by hand and assemblying the global matrix sequentially or by using the WorkStream to assemble it in parallel. If you use it in squential mode, than you must have the AssemblyScratch and Poisson::CopyData instantiated before calling this function.

This function loops through the quadrature points of this cell and assembles a local matrix corresponding to the Mixed Method applied Poisson equation and stores it in Poisson::CopyData.

Parameters
debeyelength \(\lambda{^2}\) is a constant for now.
scratchis the temporary scratch objects and data structures that do the work.
datais the local data structures to this cell that the computed results get stored in before being passed off onto the global data structures.

The matrix will be of the form,

\[ \left[ \begin{matrix} A & B \\ B^{T} & 0 \end{matrix} \right] \]

where,

\[ A(\textbf{p},\textbf{D}) \; = \; \int_{\Omega} \ \textbf{p} \ \cdot \ \textbf{D} \ dx \]

\[ B(\textbf{p},\Phi) \; = \; \int_{\Omega} \ \nabla \ \cdot \ \textbf{p} \ \Phi \ dx \]

\[ B^{T}(v,\textbf{D} ) \; = \; \int_{\Omega} \ \nabla v \ \cdot \ \textbf{D} \ dx \]

template<int dim>
void MixedPoisson::MixedFEM< dim >::assemble_local_test_rhs ( const typename DoFHandler< dim >::active_cell_iterator cell,
Assembly::AssemblyScratch< dim > &  scratch,
Assembly::Poisson::CopyData< dim > &  data 
)

Assembles the local cell's right hand side for the test problem.

template<int dim>
void MixedPoisson::MixedFEM< dim >::compute_errors ( const Triangulation< dim > &  triangulation,
DoFHandler< dim > &  Poisson_dof_handler,
Vector< double > &  solution,
double &  potential_error,
double &  field_error 
) const

Computes the local error of your approximation for the mixed method on the cell and stores the errors in potential_error and field_error.

Parameters
solutionis the Poisson_solution vector to the Mixed Method.
potential_erroris \( L^{2} \) error of the approximation the potential.
field_erroris \( L^{2} \) error of the approximation electric field.
template<int dim>
void MixedPoisson::MixedFEM< dim >::output_rescaled_results ( DoFHandler< dim > &  dof_handler,
const Vector< double > &  solution,
const ParameterSpace::Parameters sim_params,
const unsigned int  time_step_number 
) const

Prints the electric field and potential with units put back in.

Note
: I think this will only work when the code is compiled in release mode.
template<int dim>
void MixedPoisson::MixedFEM< dim >::output_unscaled_results ( DoFHandler< dim > &  dof_handler,
const Vector< double > &  solution,
const unsigned int  time_step_number 
) const

Prints the electric field and potential without the units.

Field Documentation

template<int dim>
test_DD_Poisson::Poisson_RightHandSide<dim> MixedPoisson::MixedFEM< dim >::test_coupling_Poisson_rhs

Coupled test problem RHS function. See SOLARCELL::SolarCellProblem::test_DD_Poisson.

template<int dim>
const test_Poisson::DirichletBoundaryValues<dim> MixedPoisson::MixedFEM< dim >::test_Poisson_bc

Uncoupled test problem Dirichlet BC function. See SOLARCELL::SolarCellProblem::test_steady_state

template<int dim>
const test_Poisson::RightHandSide<dim> MixedPoisson::MixedFEM< dim >::test_Poisson_rhs

Uncoupled test problem RHS function. See SOLARCELL::SolarCellProblem::test_steady_state

template<int dim>
const test_Poisson::TrueSolution<dim> MixedPoisson::MixedFEM< dim >::test_Poisson_solution

Uncoupled test problem solution. See SOLARCELL::SolarCellProblem::test_steady_state


The documentation for this class was generated from the following file: