# [Getdp] Method of moments

Lars Rindorf lhr at com.dtu.dk
Thu Feb 7 11:41:18 CET 2008

```Dear all

Some time ago I described a problem with Dof of an integral quantity that I experienced with getdp (see further below for the correspondence). With a term
Quantity {
{ Name E;  Type Local;     NameOfSpace nodal_form0;}
{ Name E2; Type Integral ; NameOfSpace nodal_form0;
[ Laplace[]{2D} * {E} ];
In scat; Jacobian Jac ; Integration I1 ; }
}
Equation {
// Here is the problem:
Galerkin {      [ Dof{E2},{E} ]; In Domain2D; Integration I1; Jacobian Jac;}
getdp returns an error (segmentation fault). The error does not exist on unix OS and seems to be only on XP OS. I tracked down the error through the getdp code. Apparantly a pointer to the function space of E2 is NULL in Get_DofOfElement.c. The error arises in Cal_GalerkinTermOfEquation.c in the line
FI->QuantityStorageDof_P = QuantityStorage_P0 + EquationTerm_P->Case.LocalTerm.Term.DefineQuantityIndexDof ;
The problem is that  QuantityStorage_P0 is a pointer to a struct of type QuantityStorage and EquationTerm_P->Case.LocalTerm.Term.DefineQuantityIndexDof is an integer. Adding these to produces 'NULL'. The integer is non-zero (apparently) only for integral quantities, and thus for Galerkin terms
Galerkin {      [ Dof{E},{E} ]; In Domain2D; Integration I1; Jacobian Jac;}
Galerkin {      [      inc[],{E} ]; In Domain2D; Integration I1; Jacobian Jac;}
the zero integer is type cast into a NULL pointer and no problems occur. Thus the problem only occur for Dof on integral quantities.

What does the line in Cal_GalerkinTermOfEquation.c do? Can it programmed in an alternative way?

Ruth: I see you are a contributor to the Cal_GalerkinTermOfEquation.c. Can shed some light on this problem?

Thanks!

Lars

________________________________

From: getdp-bounces at geuz.org on behalf of Lars Rindorf
Sent: Thu 1/17/2008 2:42 PM
To: r.sabariego at ulg.ac.be
Cc: getdp at geuz.org
Subject: Re: [Getdp] Method of moments

The parameters are default except for Nb_Fill which is 50. The file is attached. Are you running getdp in the so-called 'expert mode'?

- Lars

________________________________

From: Ruth V. Sabariego [mailto:r.sabariego at ulg.ac.be]
Sent: Thu 1/17/2008 2:16 PM
To: Lars Rindorf
Subject: Re: [Getdp] Method of moments

Indeed, strange. I work under Linux, last Ubuntu distribution.
Which are your parameter values in solver.par?
Ruth

Lars Rindorf wrote:
> Dear Ruth
>
> That is strange. What OS do you use?
>
> I use windows xp. I have just installed the latest version of getdp on another computer running xp, and the error message is exactly the same. The complete message in the message consol is:
> Info    : -------------------------------------------------------
> Info    : Gmsh version   : 2.0.8
> Info    : Build OS       : CYGWIN_NT-5.1-no-cygwin
> Info    : Build options  : GSL TRIANGLE NETGEN TETGEN JPEG PNG ZLIB MATHEVAL ANN OCC
> Info    : Build date     : Fri Jul 13 10:18:46 RDT 2007
> Info    : Build host     : winxp
> Info    : Packager       : Administrator
> Info    : Home directory : C:\DOCUME~1\lhr\LOCALS~1\Temp/
> Info    : Launch date    : Thu Jan 17 12:35:01 2008
> Info    : Command line   : C:\Documents and Settings\lhr\My Documents\getPD\gmesh\gmsh.exe C:\Documents and Settings\lhr\My Documents\getPD\Greens_sq\2Dscat.msh
> Info    : -------------------------------------------------------
> Info    : Reading 'C:\Documents and Settings\lhr\My Documents\getPD\Greens_sq\2Dscat.msh'
> Info    : 2497 vertices
> Info    : Vertex numbering is dense
> Info    : 4798 elements
> Info    : Read 'C:\Documents and Settings\lhr\My Documents\getPD\Greens_sq\2Dscat.msh'
> Info    : Calling 'C:/Program Files/getPD/getdp.exe  "C:\Documents and Settings\lhr\My Documents\getPD\Greens_sq\2Dscat.pro" -socket "127.0.0.1:44122"'
> GetDP   : Info      : Available Resolutions
> GetDP   : (1) res_dirichlet
> GetDP   : Info      : Available PostOperations
> GetDP   : (1) po_dirichlet_E
> GetDP   : (2) po_dirichlet_scat
> GetDP   : E n d
> Info    : Calling 'C:/Program Files/getPD/getdp.exe "C:\Documents and Settings\lhr\My Documents\getPD\Greens_sq\2Dscat.pro"  -pre res_dirichlet -socket "127.0.0.1:44122"'
> GetDP   : Info      : Selected Resolution 'res_dirichlet'
> GetDP   : Info      : System 'A' : Complex, Frequency = 0 Hz
> GetDP   : P r e - P r o c e s s i n g . . .
> GetDP   : Operation : Treatment Formulation 'form_dirichlet'
> GetDP   : Resources : cpu 0.078125 s
> GetDP   : E n d   P r e - P r o c e s s i n g
> GetDP   : E n d
> Info    : Calling 'C:/Program Files/getPD/getdp.exe "C:\Documents and Settings\lhr\My Documents\getPD\Greens_sq\2Dscat.pro"  -cal -socket "127.0.0.1:44122"'
> GetDP   : Info      : Selected Resolution 'res_dirichlet'
> GetDP   : Info      : System 'A' : Complex, Frequency = 0 Hz
> GetDP   : P r e - P r o c e s s i n g . . .
> GetDP   : Resources : cpu 0.0625 s
> GetDP   : E n d   P r e - P r o c e s s i n g
> GetDP   : P r o c e s s i n g . . .
> GetDP   : Operation : Generate[A]
> GetDP   : Solver    : Loading parameter file 'C:\Documents and Settings\lhr\My Documents\getPD\Greens_sq\solver.par'
> GetDP   : Info      : Setting System {A,b} to zero
> GetDP   : Error     : Segmentation violation (invalid memory reference)
>
> Thanks
> Lars Rindorf
>
> ________________________________
>
> From: Ruth V. Sabariego [mailto:r.sabariego at ulg.ac.be]
> Sent: Thu 1/17/2008 11:44 AM
> To: Lars Rindorf
> Cc: Olivier Castany; getdp at geuz.org
> Subject: Re: [Getdp] Method of moments
>
>
>
> Dear Lars,
> You do have to include the Dof in the definition of the integral
> quantity.  E is a degree of freedom, so you have to indicate it even if
> appears in an integral quantity.
> The 'so-called' Dof flag is not necessary if you are going to use the
> integral quantity in a postprocessing.
>
>  { Name form_dirichlet; Type FemEquation;
>     Quantity {
>       { Name E;  Type Local;     NameOfSpace nodal_form0;}
>       { Name E2; Type Integral ; NameOfSpace nodal_form0;
>         [ Helmholtz[]{2D,k0} * Dof{E} ]; In scat; Jacobian Jac ;
> Integration I1 ; }
>    }
>     Equation {
>       Galerkin {      [  Dof{E},{E} ]; In Domain; Integration I1;
> Jacobian Jac;}
>       Galerkin {      [  -inc[],{E} ]; In Domain; Integration I1;
> Jacobian Jac;}
>       Galerkin {      [  Dof{E2},{E} ]; In Domain2D; Integration I1;
> Jacobian Jac;}
>       /*  g d^2 h - g k^2 h = -dg*dh - k^2 g*h*/
>        }
>   }
>
> I've just tried your files with my Getdp and Dof in the integral
> quantity definition mand they work here.
> Regards,
> Ruth
>
>
>
> Lars Rindorf wrote:
>
>> Dear Olivier
>>
>> I tried to do this, but the message consol returns
>> GetDP   : Operation : Generate[A]
>> GetDP   : Solver    : Loading parameter file 'C:\Documents and Settings\lhr\My Documents\getPD\Greens_sq\solver.par'
>> GetDP   : Info      : Setting System {A,b} to zero
>> GetDP   : Error     : Segmentation violation (invalid memory reference)
>>
>> In the getpd manual it is describes that the integral type is assembled before the calculation, and thus can't be a degree of freedom (dof). Before the calculation the field is zero, and thus the integral term is effectively ignored.
>>
>> But I don't really know what to do from here. I have attached the .pro, .geo, and solver paramter files, so you can play with it.  Note, that when you postproces the scattered field, i.e. the integral with the green's function, the computed E-field is used.
>>
>> Thanks
>> Lars
>>
>>
>>
>> ________________________________
>>
>> From: Olivier Castany [mailto:castany at quatramaran.ens.fr]
>> Sent: Wed 1/16/2008 11:12 PM
>> To: Lars Rindorf; getdp at geuz.org
>> Subject: Re: [Getdp] Method of moments
>>
>>
>>
>>
>>
>>>   { Name form_neumann; Type FemEquation;
>>>     Quantity {
>>>       { Name E;  Type Local;     NameOfSpace scalar;}
>>>       { Name E2; Type Integral ; NameOfSpace scalar;
>>>         [ Helmholtz[]{2D,k0} * {E} ];
>>>         In feed; Jacobian Jac ; Integration I1 ; }
>>>    }
>>>     Equation {
>>>       Galerkin {      [ Dof{E},{E} ]; In Domain; Integration I1; Jacobian Jac;}
>>>       Galerkin {      [ -inc[],{E} ]; In Domain; Integration I1; Jacobian Jac;}
>>>       Galerkin {      [ {E2},{E} ]; In Domain2D; Integration I1; Jacobian Jac;}
>>>        }
>>>   }
>>> The problem is 2D. "feed" is a 1D boundary. "inc[]" is the incoming field. Domain is the union of the 2D domain (Domain2D) and the 1D domain (feed).
>>>
>>> The problem is that the Green's function integral E2 is evaluated once during initialization of the problem, and it is not included in the discretization
>>> of the matrix. I have tried making a coupled model. This seems to be able to work, but it is not very elegant from a mathematical point of view. I have
>>> come rather stuck in the problem.
>>>
>>>
>> I think you should add the keyword "Dof" in the definition of the integral quantity and in the equations :
>>
>>    { Name form_neumann; Type FemEquation;
>>      Quantity {
>>        { Name E;  Type Local;     NameOfSpace scalar;}
>>        { Name E2; Type Integral ; NameOfSpace scalar;
>>          [ Helmholtz[]{2D,k0} * Dof{E} ];
>>          In feed; Jacobian Jac ; Integration I1 ; }
>>     }
>>      Equation {
>>        Galerkin {      [ Dof{E},{E} ]; In Domain; Integration I1; Jacobian Jac;}
>>        Galerkin {      [ -inc[],{E} ]; In Domain; Integration I1; Jacobian Jac;}
>>        Galerkin {      [ Dof{E2},{E} ]; In Domain2D; Integration I1; Jacobian Jac;}
>>         }
>>    }
>>
>> Let me know if it works, I'm interested.
>>
>> Bye,
>>
>> O.C.
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> getdp mailing list
>> getdp at geuz.org
>> http://www.geuz.org/mailman/listinfo/getdp
>>
>>
>
>
> --
> Dr. Ir. Ruth V. Sabariego
> University of Liege, Institut Montefiore,
> Dept. of Electrical Engineering & Computer Science,
> Applied & Computational Electromagnetics (ACE),
> Sart Tilman Campus, Grande Traverse, 10 (B28), B-4000 LIEGE, Belgium
> phone: +32-4-3663737 -- fax: +32-4-3662910 -- http://elap.montefiore.ulg.ac.be/
>
>
>
>
> _______________________________________________
> getdp mailing list
> getdp at geuz.org
> http://www.geuz.org/mailman/listinfo/getdp
>
>
>

--
Dr. Ir. Ruth V. Sabariego
University of Liege, Institut Montefiore,
Dept. of Electrical Engineering & Computer Science,
Applied & Computational Electromagnetics (ACE),
Sart Tilman Campus, Grande Traverse, 10 (B28), B-4000 LIEGE, Belgium
phone: +32-4-3663737 -- fax: +32-4-3662910 -- http://elap.montefiore.ulg.ac.be/

```