[Gmsh] ... electric field lines ...

Christophe Geuzaine cag32 at case.edu
Tue Oct 10 05:28:11 CEST 2006


Tammo Heeren wrote:
> Maybe I am not getting it, but
> 
> if you have the electric field vector you can calculate the magnitude of the 
> electric field with the extract plugin. This will generate a new view for you. 
> If you then use [options][range][iso-values] for this view, you will get electric 
> field lines.

Right, but it would also be nice to be able to "follow" just a bunch of 
charged particles in a field (we could e.g. implement the formula for 
the E-M force in the plugin, combining both electric and magnetic 
fields). Then we could make nice animations of charges moving around, 
like we can do it for particles in a fluid flow...




> 
> Tammo
> 
> On 9 Oct 2006 at 20:43, Matt Koch wrote:
> 
>> ... let me know how I can help ...
>>
>> ... I am no good at C++ ...
>>
>> ... I am fairly good at ANSI C, but tend to have a very non-standard 
>> coding style (stemming from Fortran and Scilab) ...
>>
>> Regards,
>>
>> Matt Koch
>>
>> Christophe Geuzaine wrote:
>>
>>> mkoch at gvtc.com wrote:
>>>
>>>> OK,
>>>>
>>>> so, what I suggested below seems to work OK.
>>>>
>>>> The problem is, Plugin(StreamLines) seems to allow to start the 
>>>> field  lines on a rectangular grid only. That makes the plot look 
>>>> relatively  ugly, unless the grid is very fine, but then it takes a 
>>>> long time to  calculate.
>>>>
>>>> Instead, I think what would be needed is an arbitrary definition of  
>>>> starting points, such as on irregular electrode or ground surfaces. 
>>>> I  realize that might be hard to implement, especially when trying to 
>>>> go  through the simplified Plugin user interface.
>>>>
>>>> On the other hand, for GetDP, surfaces must usually be defined, and  
>>>> thus it may be possible in GMsh to somehow "recall" these surfaces 
>>>> and  thus their geometry points?
>>>
>>>
>>> That sounds like a good idea: we could maybe specify a geometrical 
>>> entity--and the plugin would extract either the geometrical points or 
>>> the points from the mesh to start the plugin. Or we could use another 
>>> view as the input...
>>>
>>>
>>>
>>>> Regards,
>>>>
>>>> Matt Koch
>>>>
>>>> ----- Message from mkoch at gvtc.com ---------
>>>>      Date: Fri,  6 Oct 2006 10:10:37 -0500
>>>>      From: mkoch at gvtc.com
>>>> Reply-To: mkoch at gvtc.com
>>>>   Subject: Re: [Gmsh] ... electric field lines ...
>>>>        To: mkoch at gvtc.com
>>>>        Cc: Christophe Geuzaine <cag32 at case.edu>, mattkoch at scitex.us,  
>>>> gmsh at geuz.org
>>>>
>>>>
>>>>> Hi All,
>>>>>
>>>>> I just looked into StreamLines.cpp, and a I am not even going to
>>>>> pretend I understand what goes on in there. However, in GetDP
>>>>> PostProcessing, could one not define a new vector field as F/|F|,
>>>>> rather than F itself? And then indeed the StreamLines Plugin should
>>>>> apply, as long as one does not interpret time in there as literal time,
>>>>> but rather as some sort of independent space parameter?
>>>>>
>>>>> My concern is, that upon perusing StreamLines.cpp, I did not see any
>>>>> obvious reference to an ODE solver, such as the one from GSL. Instead,
>>>>> I see on lines 289 through 294 and below a reference to something that
>>>>> looks like some sort of homemade Runge-Kutta algorithm? What am I
>>>>> missing?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Matt Koch
>>>>>
>>>>> ----- Message from mkoch at gvtc.com ---------
>>>>>     Date: Fri,  6 Oct 2006 09:20:41 -0500
>>>>>     From: mkoch at gvtc.com
>>>>> Reply-To: mkoch at gvtc.com
>>>>>  Subject: Re: [Gmsh] ... electric field lines ...
>>>>>       To: Christophe Geuzaine <cag32 at case.edu>
>>>>>       Cc: mattkoch at scitex.us, gmsh at geuz.org
>>>>>
>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>> I think the Plugin(StreamLines) is different from what we would need
>>>>>> for a Plugin(FieldLines), because of the field normalization:
>>>>>>
>>>>>> StreamLines:
>>>>>> dx/dt = vx(x,y,z)
>>>>>> dy/dt = vy(x,y,z)
>>>>>> dz/dt = vz(x,y,z)
>>>>>>
>>>>>> FieldLines:
>>>>>> dx/ds = Fx(x,y,z)/|F(x,y,z)|
>>>>>> dy/ds = Fy(x,y,z)/|F(x,y,z)|
>>>>>> dz/ds = Fz(x,y,z)/|F(x,y,z)|
>>>>>>
>>>>>> Nevertheless, it should be possible to copy the StreamLines plugin 
>>>>>> to a
>>>>>> FieldLines plugin and add this normalization to it. I'll take a 
>>>>>> look at
>>>>>> the .CPP file later on today. However, I hope that most of the 
>>>>>> stuff in
>>>>>> there is in pure C, as I am virtually illiterate in C++.
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Matt Koch
>>>>>>
>>>>>>
>>>>>> ----- Message from cag32 at case.edu ---------
>>>>>>    Date: Thu, 05 Oct 2006 18:57:50 -0400
>>>>>>    From: Christophe Geuzaine <cag32 at case.edu>
>>>>>> Reply-To: Christophe Geuzaine <cag32 at case.edu>
>>>>>> Subject: Re: [Gmsh] ... electric field lines ...
>>>>>>      To: mattkoch at scitex.us
>>>>>>      Cc: gmsh at geuz.org
>>>>>>
>>>>>>
>>>>>>> Matt Koch wrote:
>>>>>>>
>>>>>>>> Hi All,
>>>>>>>>
>>>>>>>> this seems to be a simple matter of solving the following    
>>>>>>>> equations for F = (Fx,Fy,Fz) as the vector (yeah right, 
>>>>>>>> NOTHING    is EVER  simple):
>>>>>>>>
>>>>>>>> dx/ds = Fx/|F|
>>>>>>>> dy/ds = Fy/|F|
>>>>>>>> dz/ds = Fz/|F|
>>>>>>>>
>>>>>>>> with |F| = sqrt(Fx^2 + Fy^2 + Fz^2)
>>>>>>>>
>>>>>>>> Even a dumb Runge-Kutta approach could probably do. I might could 
>>>>>>>> give
>>>>>>> Isn't this pretty much what we do in Plugin(StreamLines)? There we
>>>>>>> solve dX(t)/dt = V, with X(0) chosen as a bunch of points in space 
>>>>>>> and
>>>>>>> V(x,y,z) interpolated from the vector view.
>>>>>>>
>>>>>>>> it a try, but I'd need to know how to write plugins (how to     
>>>>>>>> programmatically access fields calculated by GetDP, how to     
>>>>>>>> programmatically draw in GMsh, and such), and perhaps get 
>>>>>>>> some     feedback from y'all on how long it might take to write 
>>>>>>>> a   "typical"   plugin? Would some sort of Runge-Kutta driver 
>>>>>>>> or   other ODE solver   be accessible to a plugin, or would that 
>>>>>>>> have   to be developed  from  scratch, or pulled in from GSL, for 
>>>>>>>> example?
>>>>>>> Have a look at Plugin/StreamLines.cpp in the Gmsh source code: you'll
>>>>>>> see that it's actually pretty simple to write a plugin.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> Matt Koch
>>>>>>>>
>>>>>>>>
>>>>>>>> Christophe Geuzaine wrote:
>>>>>>>>
>>>>>>>>> Matt Koch wrote:
>>>>>>>>>
>>>>>>>>>> Hello there!
>>>>>>>>>>
>>>>>>>>>> what a wonderful program GMsh is! It takes a little while to   
>>>>>>>>>> get   used to its GUI, but once you get the hang of it, it 
>>>>>>>>>> is    extremely useful and intuitive! However, one thing I have 
>>>>>>>>>> not    been able to figure out yet is how to make electric 
>>>>>>>>>> field lines    from an  electric field vector solution. I 
>>>>>>>>>> looked into the    StreamLines  PlugIn, but that seems to only 
>>>>>>>>>> work off of a    velocity field. Any  thoughts?
>>>>>>>>>
>>>>>>>>> Maybe this could be a good idea for a new plugin?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>>
>>>>>>>>>> Matt Koch
>>>>>>>>>> mattkoch at scitex.us
>>>>>>>>>> www.scitex.us
>>>>>>>>>> _______________________________________________
>>>>>>>>>> gmsh mailing list
>>>>>>>>>> gmsh at geuz.org
>>>>>>>>>> http://www.geuz.org/mailman/listinfo/gmsh
>>>>>>>>>>
>>>>>>> -- 
>>>>>>> Christophe Geuzaine
>>>>>>> Assistant Professor, Case Western Reserve University, Mathematics
>>>>>>> http://www.case.edu/artsci/math/geuzaine
>>>>>>
>>>>>> ----- End message from cag32 at case.edu -----
>>>>>
>>>>> ----- End message from mkoch at gvtc.com -----
>>>>
>>>>
>>>> ----- End message from mkoch at gvtc.com -----
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> gmsh mailing list
>>>> gmsh at geuz.org
>>>> http://www.geuz.org/mailman/listinfo/gmsh
>>>>
>>>
>> _______________________________________________
>> gmsh mailing list
>> gmsh at geuz.org
>> http://www.geuz.org/mailman/listinfo/gmsh
>>
>> __________ NOD32 1.1796 (20061010) Information __________
>>
>> This message was checked by NOD32 antivirus system.
>> http://www.eset.com
>>
>>
> 
> 


-- 
Christophe Geuzaine
Assistant Professor, Case Western Reserve University, Mathematics
http://www.case.edu/artsci/math/geuzaine