Issues with warning when setting initial value

Hello Everyone,
I am currently working on Ginzburg-Landau equation using FreeFem, and I am facing difficulties in setting up initial value. I choose the exact solution as initial value, and when I try to use FreeFem to assign initial values, the following warning appeared :

Exception thrown at 0x00007FF9E3EF837A (KernelBase.dll) in FreeFem++.exe: 0x21474343 (parameters: 0x0000025E2623B480, 0x000000A8855FD270, 0x00007FF93F8E8178, 0x0000000000000000).

Although this warning does not affect the output of the results, it seems to be very time-consuming. My guess is that the exact solution function caused this problem. Any help/suggestion would be greatly appreciated. Here is a minimal code.

//verbosity = 1;
load "Element_Mixte"

// Parameters 
real nn = 8;
real dt = 0.01;
real t = 0.;
int N = 10;

// Mesh
mesh Th = square(nn, nn);
plot(Th,WindowIndex = 0);

// Fespace
fespace Vh(Th,BDM1Ortho);
Vh<complex> [A1x,A1y];
Vh<complex> [A2x,A2y];
Vh<complex> [Ao1x,Ao1y];
Vh<complex> [Ao2x,Ao2y];
Vh<complex> [Aoo2x,Aoo2y];
Vh<complex> [vx,vy];

fespace Wh(Th,P2);
Wh<complex> psi1,psi2;
Wh<complex> psio1,psio2;
Wh<complex> psioo2;
Wh<complex> w;

fespace W0h(Th,P0);
W0h k=1;
//W0h H=5;

// Functions
func complex Ax(real t) {return exp(t-y)*sin(pi*x);}
func complex Ay(real t) {return exp(t-x)*sin(2*pi*y);}
func complex psi(real t) {return exp(-t)*cos(2*pi*x)+1i*exp(-t)*cos(pi*y);}
func complex H(real t) {return -exp(t-x)*sin(2*pi*y)+exp(t-y)*sin(pi*x);}

[Ao1x,Ao1y] = [Ax(0),Ay(0)];
psio1 = psi(0);
w = H(0);

cout << "Ao1x" << Ao1x[] << endl;
cout << "Ao1y" << Ao1y[] << endl;
cout << "psio1" << psio1[] << endl;
cout << "H" << w[]    << endl;


Hello,
Evaluating a func is a bit time consuming, and doing it at each grid point is not the best you can do. The more standard way is to use macro , that does literal replacement at compile time.
This gives

macro Ax(t) (exp((t)-y)*sin(pi*x))//EOM
macro Ay(t) (exp((t)-x)*sin(2.*pi*y))//EOM
macro psi(t) (exp(-(t))*cos(2.*pi*x)+1i*exp(-(t))*cos(pi*y))//EOM
macro H(t) (-exp((t)-x)*sin(2.*pi*y)+exp((t)-y)*sin(pi*x))//EOM

[Ao1x,Ao1y] = [Ax(0.),Ay(0.)];
psio1 = psi(0.);
w = H(0.);

Thank you so much for your suggestions and for your time ! I tried and there are no more warnings.

You’re welcome. I think that the warning was due to psio1 = psi(0);
You have to set psio1 = psi(0.); to indicate that the argument is a real number (instead of an integer).