Re: [deal.II] Re: Problem with parallelization when using hyper_cube_slit

2018-04-16 Thread Timo Heister
Roberto,

you are setting boundary ids only for locally owned cells. I assume
this means your constraint matrix will be inconsistent because of
that.

Can you check what happens if you use the correct boundary indices on
all processors?


On Fri, Apr 13, 2018 at 1:42 PM, Roberto Porcù  wrote:
> Dear Lucas,
>
>   thanks very much for replying.
> I tried to solve the same problem without rotating the domain. I rotated the
> problem.
>
> Unfortunately the issue is still there.
> I attach the new images.
> I also attach the source code again because I realized that the previous one
> had a misplaced bracket
> and was giving an error at compile time. I attached the wrong version of the
> file.
>
> Thanks again.
> Best,
>
> Roberto
>
>
> On Friday, April 13, 2018 at 7:54:54 AM UTC-4, Lucas Campos wrote:
>>
>> Dear Roberto,
>>
>> I think the problem is that you are using GridTools::transform (via
>> GridTools::rotate), in a distributed triangulation. This should not be done,
>> as noted here:
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.dealii.org_8.5.0_doxygen_deal.II_namespaceGridTools.html-23a212e99cf0d923cebfa04f1d23fa60b04=DwIFaQ=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4=4k7iKXbjGC8LfYxVJJXiaYVu6FRWmEjX38S7JmlS9Vw=pll_qCI8ZY-oMy-zFQG7zFp22DLzRo2a2Ceab7GJi0w=1eMxV5ztZtXMT485FFJZjkZ8LwrDi-oe5Ycd-W4Jisk=
>>
>> If this is indeed the root of the issue, I see two options:
>>
>> 1. Rotate your problem, rather than your triangulation, 90 degrees.
>> 2. You can create a temporary local normal triangulation, rotate it, and
>> finally copy into the distributed triangulation. That is, something in the
>> lines of
>>

 Triangulation<2> tri_tmp;

 GridGenerator::hyper_cube_slit(tri_tmp, -1, 1, false);

 GridTools::rotate(-M_PI/2, tri_tmp);


 triangultion.copy_triangulation(tri_tmp);

 triangulation.refine_global (6);
>>
>> Bests,
>> Lucas
>> On Thursday, 12 April 2018 00:54:05 UTC+2, Roberto Porcù wrote:
>>>
>>> Dear all,
>>>
>>>   in the reply to my first post I forgot the code.
>>> I attach it to this reply.
>>>
>>> Best
>>>
>>> Roberto P.
>>>
>>>
>>> On Tuesday, February 20, 2018 at 7:27:37 PM UTC-5, Roberto Porcù wrote:

 Dear all,

 I'm solving a linear elasticity problem on a cracked domain created by
 means
 of the  GridGenerator::hyper_cube_slit  function.
 When I solve it in serial everything works fine.
 When I solve it in parallel I get a problem on a node which is on one
 of the slit boundaries as it is possible to see from the attached
 pictures.
 I don't understand why that is happening because I wrote other parallel
 codes in deal.II
 and everything was always working fine. I've checked my code many times,
 also comparing It to the tutorials.
 I am supposing there is something related to the slit.

 Thanks in advance,
 Roberto
>
> --
> The deal.II project is located at 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.dealii.org_=DwIFaQ=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4=4k7iKXbjGC8LfYxVJJXiaYVu6FRWmEjX38S7JmlS9Vw=pll_qCI8ZY-oMy-zFQG7zFp22DLzRo2a2Ceab7GJi0w=Ns11WFvY9U3IcCB0ymEKp-tE6Iff3DP8lbDGxOnhCBM=
> For mailing list/forum options, see
> https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_forum_dealii-3Fhl-3Den=DwIFaQ=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4=4k7iKXbjGC8LfYxVJJXiaYVu6FRWmEjX38S7JmlS9Vw=pll_qCI8ZY-oMy-zFQG7zFp22DLzRo2a2Ceab7GJi0w=qVHJw_tDWv64VtypVSFBOXa6ybTVwKCWW2kPJBFfg7A=
> ---
> 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://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_optout=DwIFaQ=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4=4k7iKXbjGC8LfYxVJJXiaYVu6FRWmEjX38S7JmlS9Vw=pll_qCI8ZY-oMy-zFQG7zFp22DLzRo2a2Ceab7GJi0w=5RwG8zsOEnb0fnEnubbOjcSxVuVxHZHUvkkDs3H09Wo=.



-- 
Timo Heister
http://www.math.clemson.edu/~heister/

-- 
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.


[deal.II] Re: Problem with parallelization when using hyper_cube_slit

2018-04-13 Thread Roberto Porcù
Dear Lucas,

  thanks very much for replying.
I tried to solve the same problem without rotating the domain. I rotated 
the problem.

Unfortunately the issue is still there.
I attach the new images.
I also attach the source code again because I realized that the previous 
one had a misplaced bracket
and was giving an error at compile time. I attached the wrong version of 
the file.

Thanks again.
Best,

Roberto


On Friday, April 13, 2018 at 7:54:54 AM UTC-4, Lucas Campos wrote:
>
> Dear Roberto,
>
> I think the problem is that you are using GridTools::transform (via 
> GridTools::rotate), in a distributed triangulation. This should not be 
> done, as noted here: 
> https://www.dealii.org/8.5.0/doxygen/deal.II/namespaceGridTools.html#a212e99cf0d923cebfa04f1d23fa60b04
>
> If this is indeed the root of the issue, I see two options:
>
> 1. Rotate your problem, rather than your triangulation, 90 degrees. 
> 2. You can create a temporary local normal triangulation, rotate it, and 
> finally copy into the distributed triangulation. That is, something in the 
> lines of
>
>
>>> Triangulation<2> tri_tmp;
>>
>> GridGenerator::hyper_cube_slit(tri_tmp, -1, 1, false);
>>
>> GridTools::rotate(-M_PI/2, tri_tmp);
>>
>>
>>> triangultion.copy_triangulation(tri_tmp);
>>
>> triangulation.refine_global (6);
>>
>> Bests,
> Lucas
> On Thursday, 12 April 2018 00:54:05 UTC+2, Roberto Porcù wrote:
>>
>> Dear all,
>>
>>   in the reply to my first post I forgot the code.
>> I attach it to this reply.
>>
>> Best
>>
>> Roberto P.
>>
>>
>> On Tuesday, February 20, 2018 at 7:27:37 PM UTC-5, Roberto Porcù wrote:
>>>
>>> Dear all,
>>>
>>> I'm solving a linear elasticity problem on a cracked domain created by 
>>> means
>>> of the  GridGenerator::hyper_cube_slit  function.
>>> When I solve it in serial everything works fine.
>>> When I solve it in parallel I get a problem on a node which is on one
>>> of the slit boundaries as it is possible to see from the attached 
>>> pictures.
>>> I don't understand why that is happening because I wrote other parallel 
>>> codes in deal.II
>>> and everything was always working fine. I've checked my code many times, 
>>> also comparing It to the tutorials.
>>> I am supposing there is something related to the slit.
>>>
>>> Thanks in advance,
>>> Roberto
>>>
>>

-- 
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.
#include 
#include 

#include 
#include 
#include 
#include 
#include 

#include 
#include 
#include 
#include 

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include 
#include 
#include 
#include 
#include 

#include 
#include 

namespace CrackedDomain { namespace aux {

  class AnalyticalSolution : public dealii::Function<2>
  {
public:
  AnalyticalSolution()
: dealii::Function<2>(1)
  {}

  virtual double
  value(const dealii::Point<2> & p, const unsigned int component=0) const;

  virtual dealii::Tensor<1,2>
  gradient(const dealii::Point<2> & p, const unsigned int component=0) const;

  virtual double
  laplacian(const dealii::Point<2> & p, const unsigned int component=0) const;

  virtual double
  forcing(const dealii::Point<2> & p, const unsigned int component=0) const;
  };

  class LeftCrack : public dealii::Function<2>
  {
public:
  LeftCrack()
: dealii::Function<2>(1)
  {}

  virtual double
  value(const dealii::Point<2> & p, const unsigned int component=0) const;
  };

  class RightCrack : public dealii::Function<2>
  {
public:
  RightCrack()
: dealii::Function<2>(1)
  {}

  virtual double
  value(const dealii::Point<2> & p, const unsigned int component=0) const;
  };

  class LeftEdge : public dealii::Function<2>
  {
public:
  LeftEdge()
: dealii::Function<2>(1)
  {}

  virtual double
  value(const dealii::Point<2> & p, const unsigned int component=0) const;
  };

  class RightEdge : public dealii::Function<2>
  {
public:
  RightEdge()
: dealii::Function<2>(1)
  {}

  virtual double
  value(const dealii::Point<2> & p, const unsigned int component=0) const;
  };

  double
  AnalyticalSolution::value(const dealii::Point<2> & p,
const unsigned int) const
  {
const double x = p[0];
const double y = p[1];

if((y > 0) or (std::abs(y) < 1.e-14))
  return 0;

if(x > 0)
  return y*y*std::exp(-1*y);

if(x < 0)
  return -1*y*y*std::exp(-1*y);

AssertThrow(false, dealii::ExcMessage("Error"));

return 0;
  }


  

[deal.II] Re: Problem with parallelization when using hyper_cube_slit

2018-04-13 Thread Lucas Campos
Dear Roberto,

I think the problem is that you are using GridTools::transform (via 
GridTools::rotate), in a distributed triangulation. This should not be 
done, as noted 
here: 
https://www.dealii.org/8.5.0/doxygen/deal.II/namespaceGridTools.html#a212e99cf0d923cebfa04f1d23fa60b04

If this is indeed the root of the issue, I see two options:

1. Rotate your problem, rather than your triangulation, 90 degrees. 
2. You can create a temporary local normal triangulation, rotate it, and 
finally copy into the distributed triangulation. That is, something in the 
lines of


>> Triangulation<2> tri_tmp;
>
> GridGenerator::hyper_cube_slit(tri_tmp, -1, 1, false);
>
> GridTools::rotate(-M_PI/2, tri_tmp);
>
>
>> triangultion.copy_triangulation(tri_tmp);
>
> triangulation.refine_global (6);
>
> Bests,
Lucas
On Thursday, 12 April 2018 00:54:05 UTC+2, Roberto Porcù wrote:
>
> Dear all,
>
>   in the reply to my first post I forgot the code.
> I attach it to this reply.
>
> Best
>
> Roberto P.
>
>
> On Tuesday, February 20, 2018 at 7:27:37 PM UTC-5, Roberto Porcù wrote:
>>
>> Dear all,
>>
>> I'm solving a linear elasticity problem on a cracked domain created by 
>> means
>> of the  GridGenerator::hyper_cube_slit  function.
>> When I solve it in serial everything works fine.
>> When I solve it in parallel I get a problem on a node which is on one
>> of the slit boundaries as it is possible to see from the attached 
>> pictures.
>> I don't understand why that is happening because I wrote other parallel 
>> codes in deal.II
>> and everything was always working fine. I've checked my code many times, 
>> also comparing It to the tutorials.
>> I am supposing there is something related to the slit.
>>
>> Thanks in advance,
>> Roberto
>>
>

-- 
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.


[deal.II] Re: Problem with parallelization when using hyper_cube_slit

2018-04-11 Thread Roberto Porcù
Dear all,

  in the reply to my first post I forgot the code.
I attach it to this reply.

Best

Roberto P.


On Tuesday, February 20, 2018 at 7:27:37 PM UTC-5, Roberto Porcù wrote:
>
> Dear all,
>
> I'm solving a linear elasticity problem on a cracked domain created by 
> means
> of the  GridGenerator::hyper_cube_slit  function.
> When I solve it in serial everything works fine.
> When I solve it in parallel I get a problem on a node which is on one
> of the slit boundaries as it is possible to see from the attached pictures.
> I don't understand why that is happening because I wrote other parallel 
> codes in deal.II
> and everything was always working fine. I've checked my code many times, 
> also comparing It to the tutorials.
> I am supposing there is something related to the slit.
>
> Thanks in advance,
> Roberto
>

-- 
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.
#include 
#include 

#include 
#include 
#include 
#include 
#include 

#include 
#include 
#include 
#include 

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include 
#include 
#include 
#include 
#include 

#include 
#include 

namespace CrackedDomain { namespace aux {

  class AnalyticalSolution : public dealii::Function<2>
  {
public:
  AnalyticalSolution()
: dealii::Function<2>(1)
  {}

  virtual double
  value(const dealii::Point<2> & p, const unsigned int component=0) const;

  virtual dealii::Tensor<1,2>
  gradient(const dealii::Point<2> & p, const unsigned int component=0) const;

  virtual double
  laplacian(const dealii::Point<2> & p, const unsigned int component=0) const;

  virtual double
  forcing(const dealii::Point<2> & p, const unsigned int component=0) const;
  };

  class UpperCrack : public dealii::Function<2>
  {
public:
  UpperCrack()
: dealii::Function<2>(1)
  {}

  virtual double
  value(const dealii::Point<2> & p, const unsigned int component=0) const;
  };

  class LowerCrack : public dealii::Function<2>
  {
public:
  LowerCrack()
: dealii::Function<2>(1)
  {}

  virtual double
  value(const dealii::Point<2> & p, const unsigned int component=0) const;
  };

  class UpperEdge : public dealii::Function<2>
  {
public:
  UpperEdge()
: dealii::Function<2>(1)
  {}

  virtual double
  value(const dealii::Point<2> & p, const unsigned int component=0) const;
  };

  class LowerEdge : public dealii::Function<2>
  {
public:
  LowerEdge()
: dealii::Function<2>(1)
  {}

  virtual double
  value(const dealii::Point<2> & p, const unsigned int component=0) const;
  };

  double
  AnalyticalSolution::value(const dealii::Point<2> & p,
const unsigned int) const
  {
const double x = p[0];
const double y = p[1];

if((x > 0) or (std::abs(x) < 1.e-14))
  return 0;

if(y > 0)
  return x*x*std::exp(-1*x);

if(y < 0)
  return -1*x*x*std::exp(-1*x);

AssertThrow(false, dealii::ExcMessage("Error"));

return 0;
  }


  dealii::Tensor<1,2>
  AnalyticalSolution::gradient(const dealii::Point<2> & p,
   const unsigned int) const
  {
dealii::Tensor<1,2> result;
result = 0;

const double x = p[0];
const double y = p[1];

if((x > 0) or (std::abs(x) < 1.e-14)) {
  return result;
}

if(y > 0) {
  result[0] = 2*x*std::exp(-1*x) - x*x*std::exp(-1*x);
  return result;
}

if(y < 0) {
  result[0] = -2*x*std::exp(-1*x) + x*x*std::exp(-1*x);
  return result;
}

AssertThrow(false, dealii::ExcMessage("Error"));

return result;
  }


  double
  AnalyticalSolution::laplacian(const dealii::Point<2> & p,
const unsigned int) const
  {
const double x = p[0];
const double y = p[1];

if((x > 0) or (std::abs(x) < 1.e-14))
  return 0;

if(y > 0)
  return 2*std::exp(-1*x) - 4*x*std::exp(-1*x) + x*x*std::exp(-1*x);

if(y < 0)
  return -2*std::exp(-1*x) + 4*x*std::exp(-1*x) - x*x*std::exp(-1*x);

AssertThrow(false, dealii::ExcMessage("Error"));

return 0;
  }


  double
  AnalyticalSolution::forcing(const dealii::Point<2> & p,
  const unsigned int component) const
  {
return -1 * laplacian(p, component);
  }


  double
  UpperCrack::value(const dealii::Point<2> & p,
const unsigned int) const
  {
const double x = p[0];

return x*x*std::exp(-1*x);
  }


  double
  

[deal.II] Re: Problem with parallelization when using hyper_cube_slit

2018-04-11 Thread Roberto Porcù
Dear all,

  since I am still experiencing the same issue, I tried to solve a very 
simple and basic problem
on a domain created with the  GridGenerator::hyper_cube_slit  and then 
rotated of -90 degrees.

As you can see in the attached figures I am experiencing the same issue: 
when I run
the program in parallel there is something wrong  on the fracture of the 
domain. In particular there
is a problem at the intersection of the different subdomains on the 
fracture, as you can see
from the picture of the derivatives (I computed those derivatives with 
Paraview using the filter "Compute derivatives").

I attach the code of my simulation. It is a very simple code having the 
same structure of
tutorial step-40. I made it like this in order to make it more readable.

Looking forward to hearing from you.

Roberto


On Tuesday, February 20, 2018 at 7:27:37 PM UTC-5, Roberto Porcù wrote:
>
> Dear all,
>
> I'm solving a linear elasticity problem on a cracked domain created by 
> means
> of the  GridGenerator::hyper_cube_slit  function.
> When I solve it in serial everything works fine.
> When I solve it in parallel I get a problem on a node which is on one
> of the slit boundaries as it is possible to see from the attached pictures.
> I don't understand why that is happening because I wrote other parallel 
> codes in deal.II
> and everything was always working fine. I've checked my code many times, 
> also comparing It to the tutorials.
> I am supposing there is something related to the slit.
>
> Thanks in advance,
> Roberto
>

-- 
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.