1#ifndef VIENNASHE_SHE_ASSEMBLE_TIMEDERIVATIVE_HPP
2#define VIENNASHE_SHE_ASSEMBLE_TIMEDERIVATIVE_HPP
32 template <
typename ElementType,
typename QuantityPotential,
typename QuantityPotentialOld>
34 QuantityPotential
const & new_potential,
35 QuantityPotentialOld
const & old_potential)
37 return 0.5*(new_potential.get_value(viennagrid::vertices(elem)[0]) + new_potential.get_value(viennagrid::vertices(elem)[1]))
38 - 0.5*(old_potential.get_value(viennagrid::vertices(elem)[0]) + old_potential.get_value(viennagrid::vertices(elem)[1]));
42 template <
typename ConfigType,
typename QuantityPotential,
typename QuantityPotentialOld>
44 QuantityPotential
const & new_potential,
45 QuantityPotentialOld
const & old_potential)
47 return new_potential.get_value(elem) - old_potential.get_value(elem);
52 template <
typename DeviceType,
57 typename CouplingMatrixType,
58 typename QuantityPotential,
59 typename QuantityPotentialOld
63 SHEQuantity
const & quan,
64 SHEQuantity
const & quan_old,
67 ElementType
const & elem, std::size_t index_H,
68 CouplingMatrixType
const & identity_matrix,
69 QuantityPotential
const & quan_pot,
70 QuantityPotentialOld
const & quan_pot_old)
72 (void)quan_pot; (void)quan_pot_old;
74 typedef typename viennagrid::result_of::point<typename DeviceType::mesh_type>::type PointType;
83 const long row_index = quan.get_unknown_index(elem, index_H);
94 if (! with_full_newton )
96 const long expansion_order =
static_cast<long>(quan.get_expansion_order(elem, index_H));
97 double box_volume = viennagrid::volume(elem);
150 const double height =
box_height(quan, elem, index_H);
151 const double coeff = height * box_volume;
154 std::size_t(row_index), std::size_t(row_index),
162 std::size_t(row_index),
167 quan_old.get_values(elem,index_H));
169 else if (with_full_newton)
171 log::warning() <<
"* simulator(): !! WARNING !! Time dependence is not available for Newton iterations! Skipping df/dt " << std::endl;
Common routines for the assembly of SHE equations.
Writes a possibly scaled block matrix to the system matrix. Includes similar functionality for comput...
The main SHE configuration class. To be adjusted by the user for his/her needs.
double time_step_size() const
nonlinear_solver_config_type & nonlinear_solver()
Returns the configuration object for the nonlinear solver.
MeshT const & mesh() const
Returns the underlying mesh.
Defines the physical properties of a device, e.g. doping. This is the implementation for 2d and highe...
Iteration over all spherical harmonics indices up to order L, with increasing indices l and m.
long id() const
Returns the current linear solver ID.
Defines several filter functors for the device. A filter functor returns true if the supplied argumen...
Contains forward declarations and definition of small classes that must be defined at an early stage.
logger< true > warning()
Used to log warnings. The logging level is logWARNING.
harmonics_iteration_type
An enumeration of spherical harmonics types (all, even, odd) ViennaSHE supports.
@ EVEN_HARMONICS_ITERATION_ID
@ ODD_HARMONICS_ITERATION_ID
bool is_odd_assembly(T const &, T const &)
double cell_connection_length(MeshT const &, CellT const &, CellT const &)
Static dispatcher for computing the connection between two cells adjacent to a facet....
double potential_difference_to_old_timestep(ElementType const &elem, QuantityPotential const &new_potential, QuantityPotentialOld const &old_potential)
Obtain the potential difference from an edge.
double box_height(SHEQuantity const &quan, ElementType const &elem, std::size_t index_H)
Returns the height of the control box with respect to energy at the provided element (vertex or edge)...
void assemble_timederivative(DeviceType const &device, viennashe::config const &conf, SHEQuantity const &quan, SHEQuantity const &quan_old, MatrixType &A, VectorType &b, ElementType const &elem, std::size_t index_H, CouplingMatrixType const &identity_matrix, QuantityPotential const &quan_pot, QuantityPotentialOld const &quan_pot_old)
void add_block_matrix(SystemMatrixType &system_matrix, std::size_t row_index, std::size_t col_index, double prefactor, BlockMatrixType const &coupling_matrix, RowIndexIterator row_iter, ColumnIndexIterator const &col_iter_init, bool elastic_scattering_roundoff_error_prevention=false)
Writes a sub-matrix of a block matrix 'coupling_matrix' into the global system matrix,...
void subtract_folded_block_vector(VectorType &residual, std::size_t row_index, double prefactor, BlockMatrixType const &coupling_matrix, RowIndexIterator row_iter, ColumnIndexIterator const &col_iter_init, double const *fold_vector)
Writes a sub-matrix of a block matrix 'coupling_matrix' to the residual vector. The columns are 'fold...
The main ViennaSHE namespace. All functionality resides inside this namespace.
Implementation of spherical harmonics plus helper functions.
@ newton_nonlinear_solver
Gummel iteration.