Hi dear deal.ii community!
I am trying to solve 2D transient problem in semiconductor devices and I'm stuck with application of Dirichlet boundary values via ConstrainMatrix or AffineMatrix (in the last version of this library)
The program (which I am rewriting) solves consecutively two equation: (i) for a given charge density it solves Poisson equation, and than (ii) the continuity equation to find the densities in next step.
The poisson equation looks like this:
This is a formulation of mixed finite element problem with phi as electric potential and E = (Ex, Ey) as a vector of electric field.
Program uses a Raviart-Thomas finite element to describe E, and Discontinous Galerkin (FE_DGQ) for potential.
Weak fe formulation:
I have choosen this kind of boundary conditions because:
- the potential is applied on the left side of device
- Interesting things (non-zero carrier densities) shound appeard only near the interface of two domains so I assumed that Ex=0, Ey=0 on Dirichlet boundaries
- there should be no current through top and bottom of domains, so I decided in most simple case to have zero electric field perpendicular to the boundary.
I hope those are reasonable bc.
dof_handler.distribute_dofs(fe); DoFRenumbering::component_wise(dof_handler);
// make hanging node constraints constraints.clear(); DoFTools::make_hanging_node_constraints(dof_handler, constraints); // add constaints to Poisson equation const FEValuesExtractors::Vector ElectricField(0); ComponentMask electric_field_mask = fe.component_mask(ElectricField);
DoFTools::make_zero_boundary_constraints(dof_handler, Dirichlet, // DIRICHLET BOUNDARY INDICATOR constraints, electric_field_mask);
std::set<unsigned int> no_flux_boundary; no_flux_boundary.insert(Neumann); VectorTools::compute_no_normal_flux_constraints(dof_handler, 0, no_flux_boundary, constraints);
constraints.close();
during the procedure of assembling the global matrix I use in each loop:
constraints.distribute_local_to_global( data.local_matrix, data.local_dof_indices, Poisson_object.system_matrix);
constraints.distribute_local_to_global(data.local_rhs, data.local_dof_indices, Poisson_object.system_rhs);
Unfortunately when I look at the output the E value on Dirichlet boundary only x-component Ex is 0, but not Ey. On Neumann boundary non of the components are 0, but of course Ey should be. Additionally the value of a potential (which comes from face integral on right hand side) on Dirichlet boundaries is not longer as it should be (eg. I ascribed 1V and in the output I read 1e-5V)
What did I do wrong? Is it because the Raviart-Thomas should be treated differently? Maybe the value that I look at in Paraview is extrapolated from the values from the middle of the cells face and that is why the values are incorrect?
Another problem is that for the simplest case all Ey on all of the domain should be zero. Maybe this is the problem, but I kind of don't want to write a code especially for the simplest case when Ey=0 -> is there a better way to do this?
I will appreciate any help!