> > For non-time-dependent problems I would simply use apply_boundary_conditions
> > to get the right-hand-side contributions. Is there any way to do this
> > efficiently for N_T (number of time-steps) boundary conditions?
> 
> I would advice to use the ConstraintMatrix class for that, see step-22.

Well, if the boundary conditions change in every time step, I don't
think ConstraintMatrix is very efficient: One would need to hold a
ConstraintMatrix with other constraints (e.g. hanging nodes), copy that
over to the actual constraint matrix _in every time step_, insert the
boundary conditions, and then close that constraint matrix. In the
assembly loop, one can use the call

  ConstraintMatrix::distribute_local_to_global 
        (local_vector, local_dof_indices, rhs_vector, local_matrix)

Reference:
http://www.dealii.org/developer/doxygen/deal.II/classConstraintMatrix.html#a70f344e871f346e5c9e7b234bc9dd0ee

There one only needs to compute the columns in local matrix associated
with inhomogeneously constrained entries (check with
CM::is_inhomogeneously_constrained(local_dof_indices[i])), but of course
they need to be exactly the same as have been filled into the global
matrix.

However, this approach of recomputing the constraint matrix in every
time step might introduce a significant cost, depending on what other
work is done in each time step (e.g. solution of linear systems). This
is necessary because the inhomogeneities change from time step to time
step, and ConstraintMatrix does not have a fast method for updating
inhomogeneities other than reconstructing the whole thing - at least not
yet. I have some ideas and would help you with the implementation in
case you want more efficiency than the approach below.

In such a case I would say that using apply_boundary_conditions with
std::map (computed from interpolate_boundary_values in each time step)
is the best you can do. If the matrix does not change from time step to
time step, you will need to have two matrices: one without boundary
values applied, and another one where you copy the content to and apply
the boundary values from time step to time step.

Best,
Martin

_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to