At the moment, you are setting the manifold ID on the boundary of your *domain* 
with the call to 


tri.set_all_manifold_ids_on_bounary(4);
tri.set_manifold (4, manifold_neg);

And then you are telling the triangulation to use on it the  
SphericalManifold<2> manifold_neg(center).
Then you re-do the same thing (i.e., you define all boundaries *of the 
triangulation*) with the other id (5), and again set another manifold


tri.set_all_manifold_ids_on_bounary(5);
tri.set_manifold (5, manifold_neg);

The effect of this is: your domain *boundary* now has id 5, and in fact the 
faces of the boundary, upon refinement try to refine according to polar 
coordinates around the center of `manifold_neg`.

what you really want to do is to identify the regions you want to behave like 
manifold_neg (NOT the domain boundary, so the call to 
tri.set_all_manifold_ids_on_bounary should not be there).

in your first picture, identify the cells that belong to id 4:

for cell in first region:
        cell->set_all_boundary_ids(4);

then do the same with the second region:

for cell in first region:
        cell->set_all_boundary_ids(5);

and at this point instruct the triangulation that those two different region, 
follow different manifold rules:

tri.set_manifold (4, manifold_neg);
tri.set_manifold (5, manifold_pos);

The logic here is this one:

1. identify what region is described by what manifold (cell, face, line, etc. 
->set_manifold_id(…)) using an identification (a manifold id)
2. tell the triangulation that the region identified by the chosen manifold id 
must obey the given manifold description (tria.set_manifold(manifold_id, 
manifold_object)

You are doing this with the boundary of the domain (that has nothing to do with 
the regions you colored differently), and you are assigning *the same id* to 
the two regions, so the triangulation does what you asked for: it uses only one 
descriptor (because the other id is not present in the triangulation), and it 
uses it in both regions *and* on the boundary.

L.




> On 20 Feb 2023, at 8:35, Deepika Kushwah <deepika20263...@iitgoa.ac.in> wrote:
> 
> Thank you for your response.
> 
> I have also tried to set the manifold ids of the two regions with two 
> different numbers but the problem is not solved yet.
> <image.png>
> <image.png>
> What else can I do?
> 
> 
> Thanks,
> Deepika
> 
> On Mon, Feb 20, 2023 at 12:34 PM Luca Heltai <luca.hel...@gmail.com> wrote:
> You should set the manifold ids of the two regions to different numbers, and 
> add the second manifold with the second id you choose,  otherwise the second 
> call is simply overwriting the first one, and they are both described by the 
> last manifold. 
> 
> Luca
> 
>> Il giorno 20 feb 2023, alle ore 07:08, Deepika Kushwah 
>> <deepika20263...@iitgoa.ac.in> ha scritto:
>> 
>> 
>> Hello Everyone,
>> 
>> I have created a merged geometry by using subdivided_hyper_cube and two 
>> hyper_ball functions. See below 
>> <20.png>
>> 
>>  Now I want to apply a Spherical Manifold in place of the default manifold. 
>> I have tried the following code but it is not working for both hyper_ball 
>> simultaneously. 
>> 
>>  std::vector< unsigned int > repetitions(4);
>>   GridGenerator::subdivided_hyper_cube(tria_1, 4, -1., 1.);
>>   
>>   std::set<typename Triangulation<2>::active_cell_iterator> cells_to_remove;
>>   
>>   for (auto &cell : tria_1.active_cell_iterators())
>>       {
>>         if ((cell->center()[0] == -0.25) && (cell->center()[1] == -0.25))
>>         {
>>         cells_to_remove.insert(cell);
>>         }
>>         if ((cell->center()[0] == 0.25) && (cell->center()[1] == 0.25))
>>        {
>>         cells_to_remove.insert(cell);
>>        }
>>       }
>>    
>>   GridGenerator::create_triangulation_with_removed_cells(tria_1, 
>> cells_to_remove,tria_2);
>>     Point<2> center (-.25,-.25);
>>     GridGenerator::hyper_ball (tria_3, center, 0.354);
>>  
>>    GridGenerator::merge_triangulations (tria_2, tria_3,triangulation);
>>     
>>   Point<2> center_1 (.25,.25);
>>   GridGenerator::hyper_ball (tria_4, center_1, 0.354);
>>   
>>   GridGenerator::merge_triangulations (triangulation, tria_4, tri);
>>   
>> 
>>  //tri.reset_all_manifolds();
>> //tri.set_all_manifold_ids(0);
>>   
>>  SphericalManifold<2> manifold_neg(center);
>>  SphericalManifold<2> manifold_pos(center_1);
>>   
>>  tri.set_all_manifold_ids_on_boundary(0);
>>  tri.set_manifold (0, manifold_neg);
>>  tri.set_all_manifold_ids_on_boundary(0);
>>  tri.set_manifold (0, manifold_pos);
>>  
>>   tri.refine_global(3);
>> 
>> The output of the code is:
>> <image.png>
>> 
>> 
>> I want to apply a spherical manifold for both hyper_balls. Can you please 
>> suggest to me how I can do this? 
>> 
>> 
>> Thanks and Regard,
>> Deepika
>> 
>> **************************************************************************
>> This e-mail is for the sole use of the intended recipient(s) and may
>> contain confidential and privileged information. If you are not the
>> intended recipient, please contact the sender by reply e-mail and destroy
>> all copies and the original message. Any unauthorized review, use,
>> disclosure, dissemination, forwarding, printing or copying of this email
>> is strictly prohibited and appropriate legal action will be taken. 
>> ************************************************************************************************
>> 
>> -- 
>> 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/CAKTdrpps7Cs2Nbt8YeNa%3Dw1RZL8qX6msXVvOxorY-2CRPEXGDg%40mail.gmail.com.
> 
> -- 
> 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/0DF5F73C-EA4F-427F-A268-766CA41F3E9D%40gmail.com.
> 
> **************************************************************************
> This e-mail is for the sole use of the intended recipient(s) and may
> contain confidential and privileged information. If you are not the
> intended recipient, please contact the sender by reply e-mail and destroy
> all copies and the original message. Any unauthorized review, use,
> disclosure, dissemination, forwarding, printing or copying of this email
> is strictly prohibited and appropriate legal action will be taken. 
> ************************************************************************************************
> 
> -- 
> 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/CAKTdrprySqN1-Q3jW%3DQtX1vr5wE%3D4whp%3Dh_kRs7mWmWqzv9xFg%40mail.gmail.com.

-- 
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/218A05F7-FA23-49A4-8822-DB195F47C9A7%40gmail.com.

Reply via email to