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


On 6/7/20 1:14 AM, Praveen C wrote:
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

https://dealii.org/developer/doxygen/deal.II/namespaceGridGenerator.html#acea0cbcd68e52ce8113d1134b87de403

 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

On 07-Jun-2020, at 9:50 AM, 'Christoph Kammer' via deal.II User Group <[email protected] <mailto:[email protected]>> wrote:

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

--
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] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/C66D5394-FFCF-426E-A66F-9F3CA5A0F7B0%40gmail.com <https://groups.google.com/d/msgid/dealii/C66D5394-FFCF-426E-A66F-9F3CA5A0F7B0%40gmail.com?utm_medium=email&utm_source=footer>.

--
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/21d8b20b-3ae7-6e69-ff38-ab4494a8f27a%40googlemail.com.

Reply via email to