“Problem” and “varf” format

Hi, everyone!
I have a three-dimensional model:

E+u\times B-(1/Rm)* \curl B=g             in \Omega
(\partial B)/(\partial t)+\curl E=0           in \Omega

The boundary condition is

B\cdot n=0,     E\times n=0    On \partial Omega

here, u represents the velocity field, E represents the electric field, and B represents the magnetic field.
The discrete format of this model is

(E_h^n,F)+(u_h^n \times B_h^{n-1},F )-(B_h^n,\curl F)=(g,F),
(1/\tau)*(B_h^n-B_h^{n-1},C)+(\curl E_h^n,C)=0.

In the code, I do the decoupling operation, which involves the exact solution with respect to the values of u. I used two types of code to solve these two models, but the convergence order obtained using “Problem” was correct, while it was incorrect when changed to “varf”.

Blockquote
solver_EB_3D.edp (6.2 KB)
solver_EB3D_save.edp (6.3 KB)

Hi,
In your right-hand side you miss the boundary values for B. You can include them by

     real[int] bon = a2(0,WhPh);
     b=b+bon;

When you set [E1[], B1[]] = sol, the dof are not in the correct order. A correct way is

    WhPh [Q1,Q2,Q3,Z1,Z2,Z3];
     Q1[]=sol;
    [E1,E2,E3]=[Q1,Q2,Q3];[B1,B2,B3]=[Z1,Z2,Z3];

Another difference is that in one file you have [u1,u2,u3]=(Et(0.)+1.)*u1Exact; and in the other [u1,u2,u3]=(Et(tnext)+1.)*u1Exact;
full file with the corrections (not the last one with Et(0.) or Et(tnext))
solver_EB3D_save.edp (6.5 KB)