<html><body><div style="font-family: tahoma,new york,times,serif; font-size: 12pt; color: #000000"><div data-marker="__QUOTED_TEXT__"><div style="font-family: tahoma,new york,times,serif; font-size: 12pt; color: #000000"><div><div style="font-family: tahoma,new york,times,serif; font-size: 12pt; color: #000000"><div>Hi Hossam,<br></div><br><div>Controlling the mesh density with the options "Mesh.CharacteristicLengthMin" and "Mesh.CharacteristicLengthMax" may be too <span class="headword hdb tw-bw dhw dpos-h_hw "><span class="hw dhw">stringent. It may be better to use the "mesh size field" feature if you want to impose a mesh density.</span></span><br></div><div>Also, (I'm not sure about that) the last fragment operation with "Delete" specified might mess up the physical group.</div><br><div>I convert your  .geo file to a python script in order to test your code via the gmsh python API. You can find attached this .py file.<br>What you are trying to do seems somehow similar to what I do with gmsh and FEniCS (periodic homogenization for linear elasticity). You could be interested by some features of the python package HO-homog that we develop (<a href="https://gitlab.enpc.fr/baptiste.durand/HO_homog" target="_blank">https://gitlab.enpc.fr/baptiste.durand/HO_homog</a>).<br><br>Regards, <br><br>Baptiste Durand<br></div><br><br><div><div><span style="color: #333333; font-family: tahoma, 'new york', times, serif;">–––––</span></div><div><span style="color: #333333; font-family: tahoma, 'new york', times, serif;">Baptiste Durand</span><br><span style="font-family: tahoma, 'new york', times, serif; color: #333333;">Doctorant – <a href="https://navier-lab.fr/" target="_blank" style="color: #333333;">Laboratoire Navier</a></span><br><span style="color: #000000;"><span style="font-family: tahoma, 'new york', times, serif;"><a href="mailto:baptiste.durand@enpc.fr" style="color: #000000;" target="_blank">baptiste.durand@enpc.fr</a> – <a href="tel:+33164153721" style="color: #000000;" target="_blank">01 64 15 37 21</a> (<a href="tel:+33658880541" style="color: #000000;" target="_blank">06 58 88 05 41</a>) – </span><a href="linkedin.com/in/bd1747" title="linkedin.com/in/bd1747" style="color: #000000;" target="_blank"><span style="font-family: tahoma, 'new york', times, serif;">linkedin.com/in/</span></a><a href="linkedin.com/in/bd1747" title="linkedin.com/in/bd1747" style="color: #000000;" target="_blank"><span class="vanity-name__domain"></span><span class="vanity-name__domain"></span><span class="vanity-name__display-name">bd1747</span></a></span><br></div></div><br><hr id="zwchr"><br><div>Today's Topics:<br><br>   1. Composite RVE (Hossam Ragheb)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>Date: Thu, 10 Dec 2020 13:34:34 +0000<br>From: Hossam Ragheb <har1g15@soton.ac.uk><br>To: gmsh@onelab.info<br>Subject: [Gmsh] Composite RVE<br>Message-ID: <8b4e55e8-f24a-5e9e-b0da-b21288631289@soton.ac.uk><br>Content-Type: text/plain; charset="utf-8"; Format="flowed"<br><br>Hi,<br><br>I am new to gmsh, so apologies if the answer to my question is obvious.<br><br>I coded a .geo file (Attached) to create 3D RVE with fibers in a matrix <br>that includes voids.<br><br>The process simply is :<br><br> ??? 1- Create box of the matrix material.<br><br> ??? 2- Create voids using Sphere command and BooleanDifference to <br>remove these from the matrix material.<br><br> ??? 3- Create fibers as Cylinders and and utilise BooleanFragments to <br>include the cylinders in the matrix.<br><br>I have one persistent problem, once the mesh is created the fibers are <br>meshed as hollow cylinders, however i need them to be solid.<br><br>Its interesting behavior. Last thing to note that mesh size affects the <br>outcome, for example when the min/max mesh size is 2, the result is <br>solid cylinders, but with mesh size of 1, it becomes hollow.<br><br>It there a way to force the meshing algorithm to mesh the cylinder as <br>solid object?<br><br>I have attached the .geo file, please let me know if you can help.<br><br>Any suggestions?<br><br>Thanks,<br><br>Hossam Ragheb<br><br>-------------- next part --------------<br>//------------------------------------------------------------------------------<br>//<br>// Gmsh Stochastic Composite RVE<br>//<br>// Constructive Solid Geometry, OpenCASCADE geometry kernel<br>//<br>//------------------------------------------------------------------------------<br><br>SetFactory("OpenCASCADE");<br><br>Mesh.Tetrahedra = 1;<br>Mesh.Triangles = 1;<br>fac = 1;<br>Mesh.CharacteristicLengthMin = 2*fac;<br>Mesh.CharacteristicLengthMax = 2*fac;<br>voiden = 0.01;<br>Vf = 0.7;<br>// Coefficent of variation of the fibre diameter<br>cvf = 0.17;<br>Vlratio = 20;<br>Cube = 75*fac;<br>frmean = 5.0 * fac;<br>frmin = frmean - (frmean*cvf);<br>frmax = frmean + (frmean*cvf);<br>vrmin = 2.5*fac;<br>vrmax = 5.0*fac;<br>R = Cube;<br>nSvoid = Floor((voiden*2*R*2*R*2*R)/((4/3)*3.1415926*vrmax*vrmax*vrmax));<br>nFibre = Floor((Vf*2*R*2*R*2*R)/(3.1415926*frmax*frmax*2*R));<br>dims = Floor(Sqrt(nFibre));<br>Box(1) = {-R,-R,-R, 2*R,2*R,2*R};<br>For s In {2:nSvoid}<br>  If (s < nSvoid)<br>    r = vrmin +Rand(vrmax-vrmin);<br>    x = -R + Rand(2*R);<br>    y = -R + Rand(2*R);<br>    z = -R + Rand(2*R);<br>    Sphere(s) = {x, y, z, r};<br>  EndIf<br>  If (s == nSvoid)<br>    r = vrmin +Rand(vrmax-vrmin);<br>    x = -R + Rand(2*R);<br>    y = -R + Rand(2*R);<br>    z = -R + Rand(2*R);<br>    Sphere(s) = {x, y, z, r};<br>    Dilate {{x, y, z}, {Vlratio, 1, 0.5}} { Volume{s}; }<br>  EndIf<br>  Physical Volume(s) = {s};<br>EndFor<br>BooleanDifference(nSvoid+1) = { Volume{1}; Delete; }{ Volume{2:nSvoid}; Delete; };<br><br>dx = (2*R)/dims;<br>count = 0;<br>For i In {0:dims-1}<br>  For j In {0:dims-1}<br>    // Fibre diameter<br>    Fr = frmin +Rand(frmax-frmin);<br>    // Center of grid box in the RVE<br>    cgx = (-R + 0.5*dx) + j * dx;<br>    cgy = (-R + 0.5*dx) + i * dx;<br>    // Center of cylinder base<br>    xF = (cgx - 0.5*dx + Fr) + Rand(dx-2*Fr);<br>    yF = (cgy - 0.5*dx + Fr) + Rand(dx-2*Fr);<br>    zF = -R;<br>    // Cylinder axis dx,dy,dz<br>    dxF = 0;<br>    dyF = 0;<br>    dzF = 2*R;<br>    Cylinder(nSvoid+2+count) = {xF,yF,zF,dxF,dyF,dzF,Fr};<br>    Physical Volume(nSvoid+2+count) = {nSvoid+2+count};<br>    count = count +1;<br>  EndFor<br>EndFor<br>BooleanDifference(1000) = {Volume{nSvoid+1};Delete;}{Volume{nSvoid+2:nSvoid+1+count};};<br>Physical Volume("Matrix") = {1000};<br>Physical Volume("Fibres") = {nSvoid+2:nSvoid+1+count};<br>f() = BooleanFragments{Volume{1000};Delete;}{Volume{nSvoid+2:nSvoid+1+count};Delete;};<br><br>------------------------------<br></div></div></div></div><br></div></div></body></html>