Re: [deal.II] Re: Subdivided cylinder and boundary ids

2021-08-23 Thread blais...@gmail.com
This issue is now fixed by a PR merged yesterday.
Best
Bruno


On Monday, June 28, 2021 at 6:40:04 a.m. UTC-4 alexanderc...@gmail.com 
wrote:

> Hi Bruno,
>
> Sure, I can try making a PR this week.
>
> Best,
> Alex
>
> On Sunday, June 27, 2021 at 9:36:50 p.m. UTC+2 blais...@gmail.com wrote:
>
>> I most likely copied this mistake from the regular Cylinder and did not 
>> think of it when I coded the subdivided cylinder.
>> Alex, if you feel comfortable, you could go ahead and make a PR following 
>> Wolfgang's suggestion. Otherwise, I'll gladly look into it this week :)
>> Best
>> BRuno
>>
>>
>> On Friday, June 25, 2021 at 11:52:51 p.m. UTC-4 Wolfgang Bangerth wrote:
>>
>>> On 6/25/21 12:37 PM, Marc Fehling wrote: 
>>> > # Instead of an absolute threshold, you can introduce a relative one, 
>>> for 
>>> > example, `epsilon * cell->diameter()` or something similar. 
>>>
>>> FWIW, in most places, this is what we do. 
>>> Best 
>>> W. 
>>>
>>>
>>> -- 
>>>  
>>> Wolfgang Bangerth email: bang...@colostate.edu 
>>> www: http://www.math.colostate.edu/~bangerth/ 
>>>
>>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/64f0d14c-bacf-4b33-84d9-6c36253b26e6n%40googlegroups.com.


Re: [deal.II] Re: Subdivided cylinder and boundary ids

2021-06-28 Thread Alex Cumberworth
Hi Bruno,

Sure, I can try making a PR this week.

Best,
Alex

On Sunday, June 27, 2021 at 9:36:50 p.m. UTC+2 blais...@gmail.com wrote:

> I most likely copied this mistake from the regular Cylinder and did not 
> think of it when I coded the subdivided cylinder.
> Alex, if you feel comfortable, you could go ahead and make a PR following 
> Wolfgang's suggestion. Otherwise, I'll gladly look into it this week :)
> Best
> BRuno
>
>
> On Friday, June 25, 2021 at 11:52:51 p.m. UTC-4 Wolfgang Bangerth wrote:
>
>> On 6/25/21 12:37 PM, Marc Fehling wrote:
>> > # Instead of an absolute threshold, you can introduce a relative one, 
>> for 
>> > example, `epsilon * cell->diameter()` or something similar.
>>
>> FWIW, in most places, this is what we do.
>> Best
>> W.
>>
>>
>> -- 
>> 
>> Wolfgang Bangerth email: bang...@colostate.edu
>> www: http://www.math.colostate.edu/~bangerth/
>>
>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/d0c5b90e-5f8e-4ed7-b492-5365f5ae4329n%40googlegroups.com.


Re: [deal.II] Re: Subdivided cylinder and boundary ids

2021-06-27 Thread blais...@gmail.com
I most likely copied this mistake from the regular Cylinder and did not 
think of it when I coded the subdivided cylinder.
Alex, if you feel comfortable, you could go ahead and make a PR following 
Wolfgang's suggestion. Otherwise, I'll gladly look into it this week :)
Best
BRuno


On Friday, June 25, 2021 at 11:52:51 p.m. UTC-4 Wolfgang Bangerth wrote:

> On 6/25/21 12:37 PM, Marc Fehling wrote:
> > # Instead of an absolute threshold, you can introduce a relative one, 
> for 
> > example, `epsilon * cell->diameter()` or something similar.
>
> FWIW, in most places, this is what we do.
> Best
> W.
>
>
> -- 
> 
> Wolfgang Bangerth email: bang...@colostate.edu
> www: http://www.math.colostate.edu/~bangerth/
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/2f396547-7ea3-4142-a339-06371ac07782n%40googlegroups.com.


Re: [deal.II] Re: Subdivided cylinder and boundary ids

2021-06-25 Thread Wolfgang Bangerth

On 6/25/21 12:37 PM, Marc Fehling wrote:
# Instead of an absolute threshold, you can introduce a relative one, for 
example, `epsilon * cell->diameter()` or something similar.


FWIW, in most places, this is what we do.
Best
 W.


--

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

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/c3f7609b-1274-be7d-2854-6e95b4f0440b%40colostate.edu.


[deal.II] Re: Subdivided cylinder and boundary ids

2021-06-25 Thread Marc Fehling
By the way, this function has just been introduced in April with #12003 
. Suggestions for improvement 
on this new feature are welcome!

Best,
Marc

On Friday, June 25, 2021 at 12:37:31 PM UTC-6 Marc Fehling wrote:

> Hi Alex,
>
> > I scrolled through grid_generator.cc and found that subdivided_cylinder 
> has a hardcoded epsilon of 1e-5 for determining whether a face is at the 
> boundary. Of course, with a system of my size, all faces will end up being 
> considered to be at the boundary.
> >
> > Because it not only sets the boundary ids, but the manifold ids, it 
> seems I will have to modify the subdivided_cylinder to make the epsilon 
> value much smaller or somehow relative to the system size, which is simple 
> enough.
>
> That sounds like a good idea to me. Would you willing to write a patch and 
> open a pull request for the library? I'm sure others will benefit of your 
> changes as well!
>
> There are several options you can consider.
>
>1. You could provide epsilon as a parameter to the function and 
>default it to `1e-5`.
>2. Instead of an absolute threshold, you can introduce a relative one, 
>for example, `epsilon * cell->diameter()` or something similar.
>3. You can also try to use the machine precision 
>std::numeric_limits::epsilon 
> as a 
>substitute for `1e-5`.
>4. Why do we need these epsilons in the first place? Maybe it will 
>work if you just replace the greater/lesser checks with their equal 
>variants `>=` and `<=`.
>
> Best,
> Marc
>
> On Friday, June 25, 2021 at 6:45:12 AM UTC-6 alexanderc...@gmail.com 
> wrote:
>
>> I have been trying to construct a system that is small (a total length of 
>> 1e-5 m) with the subdivided cylinder grid generator. However, I have been 
>> having trouble with the boundary indicators. I wanted to set my own 
>> boundaries, and because there is no colorize option (it defaults to setting 
>> the left end face of the cylinder to 1, and the right end to 2), I tried to 
>> first set all boundary ids to 0. However, this leads to the following 
>> exception:
>>
>> terminate called after throwing an instance of 
>> 'dealii::TriaAccessorExceptions::ExcNoPeriodicNeighbor'
>>   what():  
>> 
>> An error occurred in line <2597> of file 
>>  
>> in function
>> dealii::TriaIterator > 
>> dealii::CellAccessor::neighbor_or_periodic_neighbor(unsigned 
>> int) const [with int dim = 3; int spacedim = 3]
>> The violated condition was: 
>> false
>> Additional information: 
>> (none)
>>
>> Since in my test system, I was setting the boundary ids to be the same as 
>> the default, I tried to rely on this instead. However, I was having strange 
>> behaviour where it seemed that the entire system was having the boundary 
>> conditions applied to it. I scrolled through grid_generator.cc and found 
>> that subdivided_cylinder has a hardcoded epsilon of 1e-5 for determining 
>> whether a face is at the boundary. Of course, with a system of my size, all 
>> faces will end up being considered to be at the boundary.
>>
>> Because it not only sets the boundary ids, but the manifold ids, it seems 
>> I will have to modify the subdivided_cylinder to make the epsilon value 
>> much smaller or somehow relative to the system size, which is simple enough.
>>
>> It would probably also be good to have the colorize option. However, I am 
>> not sure what to make of the exception when I try to set all the boundary 
>> ids to 0.
>>
>> Best,
>> Alex
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/70c57a19-cd2e-4950-afd8-e8890aab1491n%40googlegroups.com.


[deal.II] Re: Subdivided cylinder and boundary ids

2021-06-25 Thread Marc Fehling
Hi Alex,

> I scrolled through grid_generator.cc and found that subdivided_cylinder 
has a hardcoded epsilon of 1e-5 for determining whether a face is at the 
boundary. Of course, with a system of my size, all faces will end up being 
considered to be at the boundary.
>
> Because it not only sets the boundary ids, but the manifold ids, it seems 
I will have to modify the subdivided_cylinder to make the epsilon value 
much smaller or somehow relative to the system size, which is simple enough.

That sounds like a good idea to me. Would you willing to write a patch and 
open a pull request for the library? I'm sure others will benefit of your 
changes as well!

There are several options you can consider.

   1. You could provide epsilon as a parameter to the function and default 
   it to `1e-5`.
   2. Instead of an absolute threshold, you can introduce a relative one, 
   for example, `epsilon * cell->diameter()` or something similar.
   3. You can also try to use the machine precision std::numeric_limits::
   epsilon  
   as a substitute for `1e-5`.
   4. Why do we need these epsilons in the first place? Maybe it will work 
   if you just replace the greater/lesser checks with their equal variants 
   `>=` and `<=`.
   
Best,
Marc

On Friday, June 25, 2021 at 6:45:12 AM UTC-6 alexanderc...@gmail.com wrote:

> I have been trying to construct a system that is small (a total length of 
> 1e-5 m) with the subdivided cylinder grid generator. However, I have been 
> having trouble with the boundary indicators. I wanted to set my own 
> boundaries, and because there is no colorize option (it defaults to setting 
> the left end face of the cylinder to 1, and the right end to 2), I tried to 
> first set all boundary ids to 0. However, this leads to the following 
> exception:
>
> terminate called after throwing an instance of 
> 'dealii::TriaAccessorExceptions::ExcNoPeriodicNeighbor'
>   what():  
> 
> An error occurred in line <2597> of file 
>  
> in function
> dealii::TriaIterator > 
> dealii::CellAccessor::neighbor_or_periodic_neighbor(unsigned 
> int) const [with int dim = 3; int spacedim = 3]
> The violated condition was: 
> false
> Additional information: 
> (none)
>
> Since in my test system, I was setting the boundary ids to be the same as 
> the default, I tried to rely on this instead. However, I was having strange 
> behaviour where it seemed that the entire system was having the boundary 
> conditions applied to it. I scrolled through grid_generator.cc and found 
> that subdivided_cylinder has a hardcoded epsilon of 1e-5 for determining 
> whether a face is at the boundary. Of course, with a system of my size, all 
> faces will end up being considered to be at the boundary.
>
> Because it not only sets the boundary ids, but the manifold ids, it seems 
> I will have to modify the subdivided_cylinder to make the epsilon value 
> much smaller or somehow relative to the system size, which is simple enough.
>
> It would probably also be good to have the colorize option. However, I am 
> not sure what to make of the exception when I try to set all the boundary 
> ids to 0.
>
> Best,
> Alex
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/a3bc87d8-71c6-425e-add3-dc42d270fdf3n%40googlegroups.com.