I'm having some issues playing around with step-26 of the tutorial. I don't
have the deepest theoretical background so do bear with me if this is
basic.
I'm trying to impose inhomogeneous heat flux conditions on a simple
rectangular domain where the bottom boundary has id 2 and the top has 1
(and the rest of course 0).
I'm testing a very very simple problem with u=y+t as the solution, which
gives me a source term for this domain as simply 1 on the RHS.
I've gone through all the possible areas i could have fallen down on, and
this works if i interpolate boundary values on both the top and the bottom
(i do nothing for the sides as from the known solution i have that the flux
is 0), using VectorTools::interpolate_boundary_values
however, moving to the inhomogeneous case, i have added the below in the
time loop. with n.grad u =1 satisfying my solution and the equation with 1
as the source term on the right hand side (with Dirichlet condition at the
top of (topvalue+t). This gives me the incorrect solution, and i'm unsure
as to where it is going wrong (i've followed a step-7 type approach here).
I've tried it with some other test cases and it seems to do something
rather odd. I've tried it with just u=y too (without time dependence ) and
I get a time-dependent solution popping out which is clearly wrong...
Another thing I have noticed is that when I am using Dirichlet conditions
at the top and the bottom (the one where it looks like it works), my l2
error norm analysis tells me that the error doesn't decrease with further
refinement levels which I expected. Could anyone shed light on why this
might be happening?
all your help is much appreciated. thanks.
{
QGauss<dim-1> face_quadrature_formula(2);
FEFaceValues<dim> fe_face_values (fe, face_quadrature_formula,
update_values | update_quadrature_points |
update_normal_vectors | update_JxW_values);
const unsigned int n_face_q_points = face_quadrature_formula.size();
HeatFluxValues<dim> heatflux;
heatflux.set_time(time);
std::vector<double> heatflux_values (n_face_q_points);
const unsigned int dofs_per_cell = fe.dofs_per_cell;
Vector<double> cell_rhs (dofs_per_cell);
std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell);
typename DoFHandler<dim>::active_cell_iterator
cell = dof_handler.begin_active(),
endc = dof_handler.end();
for (; cell!=endc; ++cell)
{
cell_rhs = 0;
for (unsigned int face_number=0;
face_number<GeometryInfo<dim>::faces_per_cell; ++face_number)
if (cell->face(face_number)->at_boundary()
&&
(cell->face(face_number)->boundary_id() == 2))
{
fe_face_values.reinit (cell, face_number);
heatflux.value_list (fe_face_values.get_quadrature_points(),
heatflux_values);
for (unsigned int q_point=0; q_point<n_face_q_points; ++q_point)
{
for (unsigned int i=0; i<dofs_per_cell; ++i)
cell_rhs(i) += -( heatflux_values[q_point]*
fe_face_values.shape_value(i,q_point) *
fe_face_values.JxW(q_point));
}
}
cell->get_dof_indices (local_dof_indices);
for (unsigned int i=0; i<dofs_per_cell; ++i)
{
system_rhs_mass(local_dof_indices[i]) += cell_rhs(i);
}
}
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.