[Getdp] Bug & Fix

Lars Rindorf Lars.Rindorf at teknologisk.dk
Fri Oct 24 13:19:33 CEST 2008

Dear all 
I have found a bug when using the time solver with complex numbers.
(Maybe it is just a feature that hasn't just been implemented yet and
not a bug). You can replicate the error with the attached script.  I
have also made a correction, which I have tested succesfully. To be used
at own risk.
The bug appears with both getdp 2.0 with petsc and 1.2.1 with sparsekit.
All corrections in the source file are marked with 'LHR' (my initials).
The version is getdp 2.0. 
The problem is that getdp dosn't build the matrices and vectors when
complex numbers and a time solver are used. The static solution works
correctly. The problem is in the file Cal_AssembleTerm.cpp, and has to
do with the variable Current.NbrHar which is 1 with reals and 2 with
complex numbers. If Current.NbrHar = 2 getdp does not build the matrices
and vectors which will be zero when using the time solver. 
Question: what does Current.NbrHar > 2 mean? And is there a (good)
reason why getdp has not design to work with Current.NbrHar = 2?
I have attached my corrected source file. I have correct the bug in all
instances in the file I could find, except in the "multiharmonics" part.
BTW: what does the multiharmonics part do?
The attached script simulates equation  d_x^2 e(x,t) = d_t e(x,t). You
can also change it to  e(x,t) = -d_t e(x,t), in which case the solution
is e(x,t) = e(x,t=0)*exp(-t).
Another related problem: There is some confusion in the postprocessing
in getdp with the Current.NbrHar = 2 after having used the time solver.
If a complex field is postprocessed (after having used the time solver)
it has the form e.g re[e(t=0)],im[e(t=0)],re[e(t=1)],im[e(t=1)],
t=0,0,1,1. This is fine. But if I output re(e) instead of e, then it
still outputs the imaginary value which is now zero.  If im(e) is
outputted it returns im(e) + 0*i, instead of just im(e) which is a real.

KR Lars


Lars Rindorf

Technology consultant, Ph.D.


Mobile +45 7220 3367


Surfaces and microtechnology

Danish Technological Institute


2630 Taastrup


http://www.dti.dk <http://www.dti.dk/> 

Phone +45 7220 2000

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/getdp/attachments/20081024/daba213a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: time.pro
Type: application/octet-stream
Size: 3779 bytes
Desc: time.pro
URL: <http://www.geuz.org/pipermail/getdp/attachments/20081024/daba213a/attachment.pro>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Cal_AssembleTerm.cpp
Type: application/octet-stream
Size: 16776 bytes
Desc: Cal_AssembleTerm.cpp
URL: <http://www.geuz.org/pipermail/getdp/attachments/20081024/daba213a/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: time.geo
Type: application/octet-stream
Size: 441 bytes
Desc: time.geo
URL: <http://www.geuz.org/pipermail/getdp/attachments/20081024/daba213a/attachment.geo>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: time.msh
Type: application/octet-stream
Size: 229 bytes
Desc: time.msh
URL: <http://www.geuz.org/pipermail/getdp/attachments/20081024/daba213a/attachment.msh>