[Gmsh] Fwd: Re: about mesh refinement by scripting

David Colignon David.Colignon at ulg.ac.be
Wed May 12 17:58:49 CEST 2010

-------- Original Message --------
Subject: 	Re: [Gmsh] about mesh refinement by scripting
Date: 	Wed, 12 May 2010 17:46:54 +0200
From: 	Giuseppe Zagari <gzagari at unical.it>
To: 	David Colignon <David.Colignon at ulg.ac.be>

Hi David,
thank you for the reply.

Something like this:

i#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>
#include "MySolver.h"

   int main(int argc, char* argv[])
     int i, pid;

    system("gmsh -pid -listen test.geo > /tmp/gmsh.pid &");
    //system("gmsh -pid -listen -2 test.geo > /tmp/gmsh.pid &");
    for(i = 0; i < 5; i++)
          system("  ??? "); // put here the command for refine
          MySolver ms("test");

    kill(pid, 9);

I hope I understod right.

Best Regards,

2010/5/12 David Colignon <David.Colignon at ulg.ac.be
<mailto:David.Colignon at ulg.ac.be>>

     On 12/05/10 09:56, Giuseppe Zagari wrote:


         I am using gmsh gui for checking
         convergence of my finite elements following this procedure:
         open gmsh, open filename, go to mesh module, clicking 2D and refine
         many times as I want and run the analysis.

     Hi Giuseppe,

     I suppose you mean that after refining, you save the mesh, perform
     your FE calculations, go back to the Gmsh GUI, click on refine,
     save, etc. ?

         But now I would like to use it in a script like this:

         gmsh -2 filename.geo
         analyze filename // it use both .geo and .msh files
         gmsh -refine filename.msh
         analyze filename.msh
         gmsh -refine filename.msh
         analyze filename.msh

         but, used in this way, gmsh change the node numbering.

     yes, if you save the mesh, quit Gmsh, relaunch Gmsh,reload the mesh,
     refine, save, quit,  etc. like in your script above, the node
     numbering will probably change.

     One solution could be to launch Gmsh in "server" mode (launch Gmsh
     on the command line with "gmsh -listen") and interact with it
     through "sockets", like explained here (point 3):


     or launch your FE code from within Gmsh :





     David Colignon, Ph.D.
     Collaborateur Logistique du F.R.S.-FNRS
     CÉCI - Consortium des Équipements de Calcul Intensif
     ACE - Applied & Computational Electromagnetics
     Sart-Tilman B28
     Université de Liège
     4000 Liège - BELGIQUE
     Tél: +32 (0)4 366 37 32
     Fax: +32 (0)4 366 29 10
     WWW: http://hpc.montefiore.ulg.ac.be/

         Please suggest me in wich way I can obtaine the same
         behavoiur of the gmsh-gui.

         Best Regards and Many Thanks for gmsh


         Ing. Giuseppe Zagari, Ph. D.
         Dip. Modellistica per l'Ing. - UNICAL
         Via P. Bucci, Cubo 39/b 87036
         Arcavacata di Rende CS ITALY