<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Hello,<br><br>I am currently trying to define a mesh from a grid defined by loops but something does not work.<br>Actually, there is no message error from gmsh but the output result is not correct: a physical surface does not seem to be taken into account in the resulting msh file.<br>Here is defined my geometry (grid):<br><br><i>---------------------------------------------------------------------------<br>Printf("DEBUG")>"toto.txt";<br>// parametres de la geometrie<br>nrow = 7; // nombre de lignes (matrice)<br>ncol = 7; // nombre de colonnes (matrice)<br>step = 1;<br>nhe = (nrow+1)*ncol; // nombre aretes horizontales<br>nve = nrow*(ncol+1); // nombre aretes verticales<br>noe = nrow*ncol; // nombre aretes obliques<br>he={};<br>ve={};<br>oe={};<br>// points de la grille<br>For i In {1:nrow+1}<br> For j In {1:ncol+1}<br> idx = j+(i-1)*(ncol+1);<br> Point (idx) = {j-ncol-1,i-1,0};<br> EndFor<br>EndFor<br>// arêtes horizontales de la grille<br>cpt=1;<br>For i In {1:nrow+1}<br> For j In {1:ncol}<br> idx = j+(i-1)*(ncol+1);<br> Line (cpt) = {idx,idx+1};<br> he[cpt] = cpt;<br> cpt+=1;<br> EndFor<br>EndFor<br>// arêtes verticales de la grille<br>k=1;<br>For i In {1:nrow}<br> For j In {1:ncol+1}<br> idx = j+(i-1)*(ncol+1);<br> Line (cpt) = {idx,idx+ncol+1};<br> ve[k] = cpt;<br> cpt+=1;<br> k+=1;<br> EndFor<br>EndFor<br>// arêtes obliques de la grille<br>k=1;<br>For i In {1:nrow}<br> For j In {1:ncol}<br> idx = j+(i-1)*(ncol+1);<br> Line (cpt) = {idx,idx+ncol+2};<br> oe[k] = cpt;<br> cpt+=1;<br> k+=1;<br> EndFor<br>EndFor<br>// carres<br>carres={};<br>For i In {1:nrow}<br> For j In {1:ncol}<br> idx = j+(i-1)*ncol;<br> Line Loop (cpt) = {-ve[idx+i-1],he[idx],ve[idx+i],-he[idx+ncol]};<br> Plane Surface (cpt+1) = {cpt};<br>// Physical Surface ( Sprintf ("C%g%g",i,j)) = {cpt+1}; <br> Printf("cpt = %g",cpt)>>"toto.txt";<br> carres[idx] = cpt+1;<br> Printf("carres[idx] = %g",carres[idx])>>"toto.txt";<br> cpt+=2;<br> EndFor<br>EndFor<br>// definition du guide<br>Physical Surface ("GUIDE1") = carres[1];<br>Physical Surface ("GUIDE2") = {carres[1],carres[2]};<br>carres_guide={};<br>For j In{1:2}<br> carres_guide[j] = carres[j];<br>EndFor<br>Physical Surface ("GUIDE3") = carres_guide;<br>---------------------------------------------------------------------------------------------------</i><br><br>At the end of this file, I try to define 3 physical surfaces: GUIDE1, GUIDE2 and GUIDE3.<br>The last physical surface (GUIDE3) does not seem to be correctly defined since I obtain the following msh file:<br><br>---------------------------------------------------------------------------------------------------------<br>$MeshFormat<br>2.2 0 8<br>$EndMeshFormat<br>$PhysicalNames<br>3<br>2 1 "GUIDE1"<br>2 2 "GUIDE2"<br>2 3 "GUIDE3"<br>$EndPhysicalNames<br>$Nodes<br>8<br>1 -7 0 0<br>2 -6 0 0<br>3 -5 0 0<br>4 -7 1 0<br>5 -6 1 0<br>6 -5 1 0<br>7 -6.5 0.5 0<br>8 -5.5 0.5 0<br>$EndNodes<br>$Elements<br>12<br>1 2 2 1 163 1 7 4<br>2 2 2 2 163 1 7 4<br>3 2 2 1 163 1 2 7<br>4 2 2 2 163 1 2 7<br>5 2 2 1 163 4 7 5<br>6 2 2 2 163 4 7 5<br>7 2 2 1 163 2 5 7<br>8 2 2 2 163 2 5 7<br>9 2 2 2 165 3 6 8<br>10 2 2 2 165 5 8 6<br>11 2 2 2 165 2 8 5<br>12 2 2 2 165 2 3 8<br>$EndElements<br>---------------------------------------------------------------------------------------------------------<br><br>In other words, no element is linked with GUIDE3.<br><br>Does anybody know how to overcome this problem?<br><br>Thank you very much for your help!<br><br>Cédric Doucet<br><br><br> </div></body>
</html>