Hoe to merge hyper_cube_with_cylindrical_hole with hyper_ball()

91 views
Skip to first unread message

Deepika Kushwah

unread,
Dec 7, 2022, 2:24:19 AM12/7/22
to deal.II User Group
Hello Everyone,

I am trying to create a triangulation with hyper_cube_with_cylindrical_hole function but in place of hole I want to use solid inclusion. I tried with function GridGenerator::merge_triangulations(tria_inner, tria_outer, triangulation) but I am getting the following geometry ( see the attachment).

How to resolve this please help.

Thanks & Regards 
Deepika


merge_triangulation.png

Daniel Arndt

unread,
Dec 7, 2022, 2:03:58 PM12/7/22
to dea...@googlegroups.com
Deepika,

You will need to appropriate manifolds ids and manifolds after merging the triangulations. Also, you need to make sure that the coarse triangulations share the same vertices and edges at the interior boundary.

Best,
Daniel

**************************************************************************
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/d1f3c6a3-a408-4de8-905c-121b4e5a2c42n%40googlegroups.com.

Deepika Kushwah

unread,
Dec 12, 2022, 5:41:10 AM12/12/22
to dea...@googlegroups.com
Thank you for your response.

Now I have 2 quarries:
1. I have created the following geometry using CellData class. Now I wanted to calculate stresses and strains under dirichlet and Neumann boundary conditions for the attached triangulation.
For strain calculations I have used the DataPostprocedure tensor class, but my problem is how to calculate stress while there are two materials in the same domain?

image.png


2. I am also facing difficulty calculating single material, I tried the procedure which is mention in documentation that multiply strain with stress-strain tensor (considering lambda=1, mu =1), see below

image.png


but I am getting the following error:

 error: invalid operands of types ‘dealii::Tensor<1, 2>::value_type’ {aka ‘double’} and ‘int [3][3]’ to binary ‘operator*’
   68 |               = ((input_data.solution_gradients[p][d][e]
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      
   69 |                  +
      |                  ~                                            
   70 |                  input_data.solution_gradients[p][e][d]) / 2)*C;
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
make[3]: *** [CMakeFiles/stress.dir/build.make:76: CMakeFiles/stress.dir/stress.cc.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:90: CMakeFiles/stress.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:123: CMakeFiles/run.dir/rule] Error 2
make: *** [Makefile:137: run] Error 2

Please give me suggestions so that I can resolve these issues. 



Thanks & Regard,
 Deepika

Wolfgang Bangerth

unread,
Dec 12, 2022, 7:00:33 PM12/12/22
to dea...@googlegroups.com

> 1. I have created the following geometry using CellData class. Now I wanted to
> calculate stresses and strains under dirichlet and Neumann boundary conditions
> for the attached triangulation.
> For strain calculations I have used the DataPostprocedure tensor class, but my
> problem is how to calculate stress while there are two materials in the same
> domain?

I see from your picture that you have already used the material_id to mark
which cells are which. You can access the material_id of the cell you are
currently working on from the DataPostprocessor object: The
DataPostprocessorInputs object you are handed in the evaluate() function gives
an example of how to do that:

https://dealii.org/developer/doxygen/deal.II/structDataPostprocessorInputs_1_1CommonInputs.html


> 2. I am also facing difficulty calculating single material, I tried the
> procedure which is mention in documentation that multiply strain with
> stress-strain tensor (considering lambda=1, mu =1), see below
>
> image.png
>
>
> but I am getting the following error:
>
>  error: invalid operands of types ‘dealii::Tensor<1, 2>::value_type’ {aka
> ‘double’} and ‘int [3][3]’ to binary ‘operator*’
>    68 |               = ((input_data.solution_gradients[p][d][e]
>       |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    69 |                  +
>       |                  ~
>    70 |                  input_data.solution_gradients[p][e][d]) / 2)*C;
>       |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~

Well, what data type do you use for 'C'? The error message says something
about int[3][3], but it's not clear to me what that is. Can you show the code
you use?

Best
W.

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


Deepika Kushwah

unread,
Dec 13, 2022, 2:01:09 AM12/13/22
to dea...@googlegroups.com
Thank you Prof. for your reply.

I have already attached the code in previous mail. But after reading more about Datapostprocedure class I understood that I can't multiply an array directly to the computed_quantities.
I have also checked the attached link. I understand how we can assign material_id when I have a variable (for ex. viscosity ) related to that quantity (for ex. stress). 

Here I wanted to ask 2 questions:
1. I have 2 materials in a single domain for which I already defined material_id in triangulation. Now how to call these material_id while calculating strain values? (as material_ids are only related with lambda and mu).
2. I wanted to calculate stress for the same problem which I defined above. I have the following relation but how to write this constitutive matrix (C) while using datapostprocessor class?

image.png
  

Thanks & Regards,
Deepika

--
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+un...@googlegroups.com.

Wolfgang Bangerth

unread,
Dec 14, 2022, 4:26:23 PM12/14/22
to dea...@googlegroups.com
On 12/13/22 00:00, Deepika Kushwah wrote:
> 1. I have 2 materials in a single domain for which I already defined
> material_id in triangulation. Now how to call these material_id while
> calculating strain values? (as material_ids are only related with lambda and mu).

In my previous email, I already pointed at the link to the function with which
you can obtain the cell iterator from the DataPostprocessor class you implement.

You then only need to do something along the lines of this:

DoFHandler<dim>::cell_iterator cell = ...;
double lambda;
if (cell->material_id == ...)
lambda = ...; // first material
else
lambda = ...; // second material



> 2. I wanted to calculate stress for the same problem which I defined above. I
> have the following relation but how to write this constitutive matrix (C)
> while using datapostprocessor class?

In the formula you show, you are using Voigt notation. If you want to use
that, you need to copy the solution gradients into a Voigt vector, multiply it
with the matrix you show (probably using the FullMatrix class), and the result
will be a Voigt vector of the stress.

We tend not to use Voigt notation in the tutorials and instead represent
strain and stress via SymmetricTensor<2,dim> objects and the C operator as a
SymmetricTensor<4,dim>. You can find numerous examples of using these in the
tutorials.

Deepika Kushwah

unread,
Dec 15, 2022, 6:19:45 AM12/15/22
to dea...@googlegroups.com
Thank you Prof. for your explanation.
 I have calculated stress using a C tensor. The stress calculations I did in the same strain-data postprocedure class.
Now I want to visualize stresses in paraview but I don't know how to use the compute_quantities term again in the same class so that it can show the stress results in paraview (what should I write in add_data_vector argument?).
(see the attached code).

image.png

Please guide me. 

Thanks & Regards,
Deepika

--
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+un...@googlegroups.com.

Wolfgang Bangerth

unread,
Dec 16, 2022, 5:32:23 PM12/16/22
to dea...@googlegroups.com
On 12/15/22 04:19, Deepika Kushwah wrote:
>  I have calculated stress using a C tensor. The stress calculations I
> did in the same strain-data postprocedure class.
> Now I want to visualize stresses in paraview but I don't know how to use
> the compute_quantities term again in the same class so that it can show
> the stress results in paraview (what should I write in add_data_vector
> argument?).

Deepika:
I don't understand the question. Are you asking how to visualize tensors
in Paraview?

Best
WB

Deepika Kushwah

unread,
Dec 17, 2022, 2:25:40 AM12/17/22
to dea...@googlegroups.com
Yes sir, I want to  visualize tensors (stress) in Paraview. (Have attached the portion of code again for reference).
I also want to know if the strain values which are calculated using data postprocedure class are at gauss points or at nodes?

image.png

Thanks & Regards,
Deepika

--
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+un...@googlegroups.com.

Deepika Kushwah

unread,
Dec 17, 2022, 9:41:59 AM12/17/22
to dea...@googlegroups.com
Sir,
I have used another approach to calculate stress, where I am calculating stress components using components of computed_quantities[p] (strain) and parameters lambda and mu. The stress values are obtained but I am not clear how to plot these values of stresses in paraview (see the attached stress formulation and code used).
Please guide.
image.png
image.png

Thanks & Regard,
Deepika

Wolfgang Bangerth

unread,
Dec 17, 2022, 1:45:06 PM12/17/22
to dea...@googlegroups.com
On 12/17/22 00:24, Deepika Kushwah wrote:
> **
>
> Yes sir, I want to  visualize tensors (stress) in Paraview. (Have attached the
> portion of code again for reference).

I don't actually know how to do that in Paraview (I don't use Paraview
myself), but that seems like a question you should be able to solve by
consulting the Paraview manuals and/or forums.


> I also want to know if the strain values which are calculated using data
> postprocedure class are at gauss points or at nodes?

At nodes.

Best
W.
Reply all
Reply to author
Forward
0 new messages