[Gmsh] cannot create a volumic mesh of a "complex" region??

trophime christophe.trophime at lncmi.cnrs.fr
Wed Nov 7 11:17:23 CET 2012


Hi,
I have some trouble generating the mesh of a "slice" of our magnets
especially for the region "Air' defined in HR_New_Virtual_Sphere.geo.

The geometry is defined in HR_New_GMSH.geo which includes several files.
The construction is parametrized (see data in HR_New-DAT.dat) : first we
build the magnet (see functions defined in HR_New-GEO.geo) then we
define the air around (see HR_New_Virtual_Sphere.geo which defines Air
and AirInf ) to compute the magnetic field generated by the magnet. 

The trouble is that I cannot get a volumic mesh of the Air region...
I only have a mesh of the "Air" boundaries.

I must do something wrong in the definition of the Air region?
I would be grateful for any help to fix this problem

Best
C 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: HR_New_GMSH.geo
Type: text/x-csrc
Size: 2578 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20121107/a1a0171d/attachment.geo>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HR_New-DAT.dat
Type: text/x-csrc
Size: 4999 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20121107/a1a0171d/attachment.dat>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HR_New-GEO.geo
Type: text/x-csrc
Size: 35500 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20121107/a1a0171d/attachment-0001.geo>
-------------- next part --------------
Function Virtual_Sphere

    Z_C = (z+z0)/2.;
    Printf("z0=%g", z0);
    Printf("z=%g", z);
    Printf("z+z0=%g", Fabs[z-z0]);
    Printf("Z_C=%g", (z+z0)/2.);
    
    // Define Points
    P0=newp; Point(P0) = {0, 0, Z_C, LcAxis};
    P1=newp; Point(P1) = {R * Cos[alpha[0]], R * Sin[alpha[0]], Z_C, LcBox};
    P2=newp; Point(P2) = {R * Cos[alpha[#alpha[]-1]], R * Sin[alpha[#alpha[]-1]], Z_C, LcBox};
    P3=newp; Point(P3) = {0, 0, Z_C+R, LcBox};
    P4=newp; Point(P4) = {0, 0, Z_C-R, LcBox};
    
    C12=newl; Circle(C12) = {P1, P0, P2};
    C23=newl; Circle(C23) = {P2, P0, P3};
    C31=newl; Circle(C31) = {P3, P0, P1};
    C14=newl; Circle(C14) = {P1, P0, P4};
    C24=newl; Circle(C24) = {P2, P0, P4};
    
    //L01=newl; Line(L01) = {P0, P1};
    //L02=newl; Line(L02) = {P0, P2};
    L03=newl; Line(L03) = {P0, P3};
    L04=newl; Line(L04) = {P0, P4};

    Hemi1=newl; Line Loop(Hemi1) = {C12, C23, C31};
    HemiS1=newl; Ruled Surface(HemiS1) = {Hemi1};
    Printf("HemiS1=%g", HemiS1);
    
    lb230=newreg; Line Loop(lb230)={-C31, -L03, L04, -C14}; 
    Lb230=newreg; Plane Surface(Lb230)={lb230, -V0[]}; 
    Printf("Lb230=%g", Lb230);

    Hemi2=newl; Line Loop(Hemi2) = {C12, C24, -C14};
    HemiS2=newl; Ruled Surface(HemiS2) = {Hemi2};
    Printf("HemiS2=%g", HemiS2);
    
    lb380=newreg; Line Loop(lb380)={-C23, C24, -L04, L03}; 
    Lb380=newreg; Plane Surface(Lb380)={lb380, -V1[]};
    Printf("Lb380=%g", Lb380);
   
    box = newreg ;
    If(isolant)
       Surface Loop(box) = {HemiS1, HemiS2, Lb230, Lb380, Bord_RI[], Bord_RE[], Bord_HChannel[], Bord_RChannel[], Bord_Neumann[], Bord_Isolant[]};
    EndIf
    If (!isolant)
       Surface Loop(box) = {HemiS1, HemiS2, Lb230, Lb380, Bord_RI[], Bord_RE[], Bord_HChannel[], Bord_RChannel[], Bord_Neumann[]};
    EndIf
    Printf("box=%g", box);
   
     
    Box = newreg ; Volume(Box) = {box} ;
    Printf("Box=%g", Box);
   
    Physical Volume("Air") = {Box}; //Volume Box1

    // Define Shell Points
    X_R_S = (R+Delta_R) * Cos[alpha[0]];
    Y_R_S = (R+Delta_R) * Sin[alpha[0]];

    P10=newp; Point(P10) =  {(R+Delta_R) * Cos[alpha[0]], (R+Delta_R) * Sin[alpha[0]], Z_C, LcInf};
    P20=newp; Point(P20) =  {(R+Delta_R) * Cos[alpha[#alpha[]-1]], (R+Delta_R) * Sin[alpha[#alpha[]-1]], Z_C, LcInf};
    P30=newp; Point(P30) = {0, 0, Z_C+(R+Delta_R), 5*LcInf};
    P40=newp; Point(P40) = {0, 0, Z_C-(R+Delta_R), 5*LcInf};

    C1020=newl; Circle(C1020) = {P10, P0, P20};
    C2030=newl; Circle(C2030) = {P20, P0, P30};
    C3010=newl; Circle(C3010) = {P30, P0, P10};
    C1040=newl; Circle(C1040) = {P10, P0, P40};
    C2040=newl; Circle(C2040) = {P20, P0, P40};

    L110=newl; Line(L110) = {P1, P10};
    L220=newl; Line(L220) = {P2, P20};
    L330=newl; Line(L330) = {P3, P30};
    L440=newl; Line(L440) = {P4, P40};

    HemiR1=newl; Line Loop(HemiR1) = {C1020, C2030, C3010};
    HemiRS1=newl; Ruled Surface(HemiRS1) = {HemiR1};
    
    HemiR2=newl; Line Loop(HemiR2) = {C1020, C2040, -C1040};
    HemiRS2=newl; Ruled Surface(HemiRS2) = {HemiR2};
    
    OxOz1=newl; Line Loop(OxOz1) = {C14, L440, -C1040, -L110};
    Sym_OxOz1=newl; Plane Surface(Sym_OxOz1) = {OxOz1};
    OxOz2=newl; Line Loop(OxOz2) = {C31, L110, -C3010, -L330};
    Sym_OxOz2=newl; Plane Surface(Sym_OxOz2) = {OxOz2};

    OyOz1=newl; Line Loop(OyOz1) = {-C24, L220, C2040, -L440};
    Sym_OyOz1=newl; Plane Surface(Sym_OyOz1) = {OyOz1};
    OyOz2=newl; Line Loop(OyOz2) = {C23, L330, -C2030, -L220};
    Sym_OyOz2=newl; Plane Surface(Sym_OyOz2) = {OyOz2};
    
    shell=newreg; Surface Loop(shell) = {Sym_OxOz1, Sym_OxOz2, HemiRS1, HemiRS2, HemiS1, HemiS2, Sym_OyOz1, Sym_OyOz2};
    Shell = newreg ; Volume(Shell) = {shell} ;
    
    ////////PHYSICAL REGION /////////
    
    Physical Surface("Infinity") = {HemiRS1, HemiRS2} ; // Infini
    Physical Surface("Symetrie1") = {Lb230, Sym_OxOz1, Sym_OxOz2} ; // Sym OxOz
    Physical Surface("Symetrie2") = {Lb380, Sym_OyOz1, Sym_OyOz2} ; // Sym OyOzFace Bas Box 2


    Physical Volume("AirInf") = {Shell}; //Volume Box2 
    
Return