Step-4 1D problem

23 views
Skip to first unread message

Christoph Kammer

unread,
Jun 7, 2020, 12:20:53 AM6/7/20
to deal.II User Group
Hi Deal.ii team,

I went through tutorial step-4 and I tried to use the solver for Poisson's problem in 2D and rewrite it for a 1D problem. This is basically step-4 and setting RHS f =1 and solving for homogeneous BCs. The program is compiling just fine and executing, however, the solution I am getting from that doesn't make any sense. The BCs aren't even satisfied at x = 1.

Could anyone let me know what's going on here? Setting f = 1 and changing everything to solve for homogeneous BC in 1D seems like a very simple problem.

Thank you,

Christoph

Praveen C

unread,
Jun 7, 2020, 1:14:15 AM6/7/20
to Deal. II Googlegroup
In 1-D,

GridGenerator::hyper_cube(triangulation, -1, 1);

will assign different boundary indicators to left and right side, even though colorize=false is default, see


 I think left=0 and right=1. Due to this reason, bc may not be applied on both sides.

Do the apply bc twice, once with indicator=0 and once with indicator=1.

  std::map<types::global_dof_index, double> boundary_values;
  VectorTools::interpolate_boundary_values(dof_handler,
                                           0, // left boundary
                                           BoundaryValues<dim>(),
                                           boundary_values);
  MatrixTools::apply_boundary_values(boundary_values,
                                     system_matrix,
                                     solution,
                                     system_rhs);

  VectorTools::interpolate_boundary_values(dof_handler,
                                           1, // right boundary
                                           BoundaryValues<dim>(),
                                           boundary_values);
  MatrixTools::apply_boundary_values(boundary_values,
                                     system_matrix,
                                     solution,
                                     system_rhs);

Best
praveen

Christoph Kammer

unread,
Jun 8, 2020, 11:50:25 AM6/8/20
to dea...@googlegroups.com

Thank you Praveen,

that solved my problem. After fixing the issue with the boundary id things made sense. Is there a particular reason that in 1D the boundary points are labeled in a different manner than in 2+ D?

PS. deal ii team. In the documentation on step 3 + 4 it states that the Poisson problem is solved on a domain [0,1]^dim. The actual solver however is implemented to solve this problem on the domain [-1,1]^dim. Perhaps the introduction to this tutorial should be made consistent with the commented program.


Thanks again,


Christoph

--
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 dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/C66D5394-FFCF-426E-A66F-9F3CA5A0F7B0%40gmail.com.

peterrum

unread,
Jun 8, 2020, 12:00:36 PM6/8/20
to deal.II User Group
Indeed! Christoph, you seem to be right!

Feel free to create a pull request on GitHub for this inconsistency! We will help you if you need some assistance! Amazing that there are still errors in the first tutorials although - probably - all deal.II user have had a look at these...

Thanks,
Peter
To unsubscribe from this group and stop receiving emails from it, send an email to dea...@googlegroups.com.

Christoph Kammer

unread,
Jun 8, 2020, 12:39:07 PM6/8/20
to 'peterrum' via deal.II User Group

Hi Peter,

I've never used this functionality of git but I think I just posted a pull-request describing this minor issue.

Wouldn't it be easier to change the documentation on the tutorials website or is that done through Git, too?

PS. My experience with Git is rather limited although I should probably adopt a habit of using it more so maybe this is the time.


Best,


Christoph

To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/83222619-db7c-421f-bee1-3de1d485836ao%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages