Use of std::map boundary_values object instead of constraint object in step-40 tutorail

18 views
Skip to first unread message

Wasim Niyaz Munshi ce21d400

unread,
Feb 14, 2023, 3:28:17 PM2/14/23
to deal.II User Group
Hello everyone.
I am working on a problem very similar to the Laplace equation solved in step-3. I have made some changes to step-3 as I need to. Now, I want to solve this problem in parallel. I looked at step-40, which solves the Laplace equation in parallel. However, it uses a constraints object to apply BCs. Right now, I don't have any hanging nodes to handle, so I used a std::map object to apply BCs. I first copy all the local contributions to the global matrix and then apply the BCs.
 While going through the documentation of step-40,  I read that "Copying local contributions into the global matrix must include distributing constraints and boundary values. In other words, we cannot (as we did in step-6) first copy every local contribution into the global matrix and only in a later step take care of hanging node constraints and boundary values."

If my understanding is correct, then I think the following line of code does this job in step-40:
constraints.distribute_local_to_global(cell_matrix,cell_rhs,local_dof_indices,
system_matrix,system_rhs);
My doubt is whether it is possible to do this(Copying local contributions into the global matrix and distributing boundary values.) with the std::map object or do I need to use a constraint object even though I don't have any hanging nodes to handle.

Thanks and regards
Wasim

Wolfgang Bangerth

unread,
Feb 14, 2023, 11:36:05 PM2/14/23
to dea...@googlegroups.com

Wasim,

> I am working on a problem very similar to the Laplace equation solved in
> step-3. I have made some changes to step-3 as I need to. Now, I want to solve
> this problem in parallel. I looked at step-40, which solves the Laplace
> equation in parallel. However, it uses a constraints object to apply BCs.
> Right now, I don't have any hanging nodes to handle, so I used a std::map
> object to apply BCs. I first copy all the local contributions to the global
> matrix and then apply the BCs.
>  While going through the documentation of step-40,  I read that *"Copying
> local contributions into the global matrix must include distributing
> constraints and boundary values. In other words, we cannot (as we did in
> step-6
> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.dealii.org%2Fcurrent%2Fdoxygen%2Fdeal.II%2Fstep_6.html&data=05%7C01%7CWolfgang.Bangerth%40colostate.edu%7C4d743ade451748dc8de008db0eca03a4%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C638120033038833445%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=jiwhUoR2e3pdMgrBUuE0O6aNkvqizuqsxrb61F8YmUE%3D&reserved=0>) first copy every local contribution into the global matrix and only in a later step take care of hanging node constraints and boundary values."*
> *
> *

This text turns out to no longer be correct. It refers to a method step-6 used
to use, but no longer does. I've fixed this here:
https://github.com/dealii/dealii/pull/14801/files


> If my understanding is correct, then I think the following line of code does
> this job in step-40:
> *constraints.distribute_local_to_global(cell_matrix,cell_rhs,local_dof_indices,*
> **
> *system_matrix,system_rhs);*
> My doubt is whether it is possible to do this(*Copying local contributions
> into the global matrix and distributing boundary values.*) with the std::map
> object or do I need to use a constraint object even though I don't have any
> hanging nodes to handle.

It requires an AffineConstraints object, just like the current state of step-6
and step-40 do.

Best
W.


--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/


Reply all
Reply to author
Forward
0 new messages