Hi Martin, thanks for the comments.
The last option you gave in your message of storing two matrices is what I would have come up but dismissed it for inefficiency. Essentially, if I could extract the matrix entries that correspond to the columns for the non-zero boundary constraints, I could compute the right hand side contributions in a more straightforward way. Something like lower_part(S_before-S_after) [yb_1,..,yb_NT] would then give me the sought-after right hand sides. I am just wondering how to do this efficiently? Martin, if you can suggest something better I am all ears! Thanks anyways. Cheers, Martin I would like to take you On Wed, Jan 12, 2011 at 12:07 PM, Martin Kronbichler < [email protected]> wrote: > > > > 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 > > -- *Martin Stoll* *Postdoctoral Research Fellow* Computational Methods in Systems and Control Theory Max Planck Institute for Dynamics of Complex Technical Systems Sandtorstr. 1 D-39106 Magdeburg Germany Email: [email protected] URL : http://www.mpi-magdeburg.mpg.de/people/stollm Tel :+49 391 6110 384
_______________________________________________ dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii
