[Gmsh] How to use a Field as a View?
Christophe Geuzaine
cgeuzaine at ulg.ac.be
Sun Jun 14 21:01:38 CEST 2009
Marc Duflot wrote:
> Dear all,
>
> Fields in gmsh may be defined in Mesh/Define/Fields and then used as the
> definition for desired element size. They can also be put on a view.
> But, as far as I know, they can not be exported in .pos format with
> "Save as..." (STL works, though) or used with a Plugin.
>
> Am I missing something?
Hi Marc - Here's an example (save this in the tutorial/ directory: it
makes use of the bgmesh.pos file):
Point(1) = {0, 0, 0};
Point(2) = {.1, 0, 0} ;
Point(3) = {.1, .3, 0} ;
Point(4) = {0, .3, 0} ;
Line(1) = {1,2} ;
Line(2) = {3,2} ;
Line(3) = {3,4} ;
Line(4) = {4,1} ;
Line Loop(5) = {4,1,-2,3} ;
Plane Surface(6) = {5} ;
Field[1] = Attractor;
Field[1].NodesList = {1};
Merge "bgmesh.pos";
Plugin(FieldView).iField = 1;
Plugin(FieldView).iView = 0;
Plugin(FieldView).Run;
Save View[0] "aa.pos";
You might want to generalize the plugin to automatically create a new
view from a mesh if you don't have an existing "support" view (use
field->putOnNewView() instead of field->putOnView() in Plugin/FieldView.cpp)
>
> In my opinion, they could be useful for a broad purpose if they could be
> handled like a view coming from a .pos file. As an example, let's say
> that I want to define a residual stress field known as an analytical
> function of the distance to the free surface. I could first use the
> Attractor Field to get the distance to a geometrical entity list, next
> apply the Evaluate Plugin with my function and finally save the result
> in a .pos file as the input of a finite element code.
>
> What do you think? Would it be hard to implement? I already had a look
> at the source code in Post/PViewData* and am willing to contribute.
>
> Thank you,
> Marc
>
--
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
http://www.montefiore.ulg.ac.be/~geuzaine