Dear Jean-Paul,

Thanks for your answer! Still, I am not sure if I understand the code. The
main issue seems to be that both blocks in every if else path are the
exactly the same. For instance,

if (apply_dirichlet_bc == true)
> VectorTools::interpolate_boundary_values
> <http://dealii.org/developer/doxygen/deal.II/namespaceVectorTools.html#a9f3e3ae1396811f998cc35f94cbaa926>
> (dof_handler_ref,
> boundary_id,
> Functions::ZeroFunction<dim>
> <http://dealii.org/developer/doxygen/deal.II/classFunctions_1_1ZeroFunction.html>
> (n_components),
> constraints,
> fe.component_mask
> <http://dealii.org/developer/doxygen/deal.II/classFiniteElement.html#ace1f6cf0a9f0eb472be4df56743851aa>
> (x_displacement));
> else
> VectorTools::interpolate_boundary_values
> <http://dealii.org/developer/doxygen/deal.II/namespaceVectorTools.html#a9f3e3ae1396811f998cc35f94cbaa926>
> (dof_handler_ref,
> boundary_id,
> Functions::ZeroFunction<dim>
> <http://dealii.org/developer/doxygen/deal.II/classFunctions_1_1ZeroFunction.html>
> (n_components),
> constraints,
> fe.component_mask
> <http://dealii.org/developer/doxygen/deal.II/classFiniteElement.html#ace1f6cf0a9f0eb472be4df56743851aa>
> (x_displacement));
>

 What is the use of having if-else in this situation?

Also, in your answer you mentioned that in the second call (iteration ==
1), only homogeneous constrains will be built. I also cannot see this from
the code. Perhaps this part is interacting with some other part of the code
in a way I cannot see?

Thanks for the help,
Lucas Campos

On 28 August 2017 at 17:03, Jean-Paul Pelteret <jppelte...@gmail.com> wrote:

> Hi Lucas,
>
> So it sounds as if you've already worked out what's happening here. We
> consider 3 cases, namely what to do for newton iteration equal to 0, equal
> to 1, and greater than 1.
>
> For iteration == 0 and iteration == 1, the early return on line 2468
> <https://github.com/dealii/dealii/blob/master/examples/step-44/step-44.cc?utf8=%E2%9C%93#L2468>
> is not satisfied and we have to build some dirichlet constraints. Which
> constraints are build is governed by the iteration number: if it is equal
> to zero, then apply_dirichlet_BC
> <https://github.com/dealii/dealii/blob/master/examples/step-44/step-44.cc?utf8=%E2%9C%93#L2471>
> is set true and we build non-homogeneous constraints (the "if" case). On
> the next visit to this function (iteration == 1) this flag is set to false
> and we build only homogeneous constraints (the "else" case). At subsequent
> iterations we use the early return that I previously mentioned to make no
> further changes to the existing constraint matrix. This is because it is
> already filled with the homogeneous constraints, which is what we want for
> all newton iterations > 0.
>
> Does this make sense?
>
> Regards,
> Jean-Paul
>
> On Monday, August 28, 2017 at 4:14:31 PM UTC+2, Lucas Campos wrote:
>>
>> > This calculation does not happen anyway, because of the early return in
>> line 2466.
>>
>> Just a minor correction for the previous sentence: The guard on line 2466
>> will be true only on the second iterations. The else paths will still be
>> taken at least once.
>>
>> On Monday, 28 August 2017 16:02:01 UTC+2, Lucas Campos wrote:
>>>
>>> Dear all,
>>>
>>> First of all, thanks for the great library! I spent the last few days
>>> reading your (very!) extensive
>>> documentation and I think it will be really useful for me in the near
>>> future.
>>>
>>> Right now I am struggling a bit on understanding some things on step-44.
>>> Most pressing right
>>> now is that, in Section Solid::make_constraints of the tutorials, we
>>> have
>>>
>>> > However, since we are dealing with an iterative Newton method, it
>>> should be noted
>>> > that any displacement constraints should only be specified at the
>>> zeroth iteration
>>> > and subsequently no additional contributions are to be made since the
>>> constraints
>>> > are already exactly satisfied.
>>>
>>> However, reading the code underneath, the code under the if-else blocks
>>> are the same (around
>>> line 2490 of step-44.cc). That is to say, we would run the same
>>> computation whether the condition
>>> is true or false. This calculation does not happen anyway, because of
>>> the early return in line 2466.
>>> If we disregard this early return, would this code be wrong, or is there
>>> something I am not seeing?
>>>
>>> Bests,
>>> Lucas
>>>
>> --
> 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 a topic in the
> Google Groups "deal.II User Group" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/dealii/TSUwtKqcotY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> dealii+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to