function [Solver]=GetPowerCoef(Solver,BMesh,mur,solverNum)
%description: compute normalized coefficient of electric field intensity

%Guass quadracture points
[xft,yft,pft,Integral2DOrder]=Get2DGuassPoints(2);

k0=2*pi/Solver.lam0;
gamma=Solver.gamma(solverNum);
NbrElements=length(BMesh.NewFaces);

%loop over elements
powerCoef=0;
for n=1:NbrElements
    %coordinate of nodes
    x=BMesh.Nodes(BMesh.NewFaces(n,:),1);
    y=BMesh.Nodes(BMesh.NewFaces(n,:),2);

    l=zeros(3,1);
    l(1)=sqrt((x(1)-x(2))*(x(1)-x(2))+(y(1)-y(2))*(y(1)-y(2)));
    l(2)=sqrt((x(1)-x(3))*(x(1)-x(3))+(y(1)-y(3))*(y(1)-y(3)));
    l(3)=sqrt((x(3)-x(2))*(x(3)-x(2))+(y(3)-y(2))*(y(3)-y(2)));
    
    %Jac matrics
    Jac=zeros(3,3);JacS=zeros(3,3);
    Jac(1,1)=x(2)-x(1);Jac(1,2)=y(2)-y(1);
    Jac(2,1)=x(3)-x(1);Jac(2,2)=y(3)-y(1);Jac(3,3)=1;
    InvJac=inv(Jac);
    JacS(1,1)=InvJac(2,2);JacS(1,2)=-InvJac(2,1);
    JacS(2,1)=-InvJac(1,2);JacS(2,2)=InvJac(1,1);JacS(3,3)=1;
    DetJac=abs(det(Jac));
    TJac=Jac'/det(Jac);

    %Compute material coefficients
    domain=BMesh.FacesIndex(n);
    mu=mur(domain);
    physicsIndex=1i/k0/(120*pi)/mu;

    %compute electric
    EE=zeros(3,Integral2DOrder);
    HH=zeros(3,Integral2DOrder);
    curlEE=zeros(3,Integral2DOrder);
    et=zeros(3,3,Integral2DOrder);ez=zeros(3,3,Integral2DOrder);
    curlEt=zeros(3,3,Integral2DOrder);curlEz=zeros(3,3,Integral2DOrder);
    temp=zeros(3,1);
    for i=1:3 %basis function 
        for k=1:Integral2DOrder % quadracture points
            [temp(1),temp(2)]=BF_Et(i,xft(k),yft(k));temp(3)=0;
            et(:,i,k)=InvJac*temp*l(i);
            temp(3)=BF_Ez(i,xft(k),yft(k));temp(1)=0;temp(2)=0;
            ez(:,i,k)=temp;
            temp(3)=BF_curlEt(i,xft(k),yft(k));temp(1)=0;temp(2)=0;
            curlEt(:,i,k)=TJac*temp*l(i);
            [temp(1),temp(2)]=BF_curlEz(i,xft(k),yft(k));temp(3)=0;
            curlEz(:,i,k)=JacS*temp;
        end
    end
    for k=1:Integral2DOrder % quadracture points
        for i=1:3 %basis function 
            MappingEz=BMesh.NewFaces(n,i);
            MappingEt=BMesh.EdgesOfElements((n-1)*3+i);
            EE(:,k)=EE(:,k)+et(:,i,k)*Solver.Et(MappingEt)+ez(:,i,k)*Solver.Ez(MappingEz);
            curlEE(:,k)=curlEE(:,k)+curlEt(:,i,k)*Solver.Et(MappingEt)+curlEz(:,i,k)*Solver.Ez(MappingEz);
        end
        HH(:,k)=curlEE(:,k);
        HH(1,k)=HH(1,k)+EE(2,k)*gamma;
        HH(2,k)=HH(2,k)-EE(1,k)*gamma;
    end
    HH=HH*physicsIndex;
    rEE=real(EE);
    iEE=imag(EE);
    rHH=real(HH);
    iHH=imag(HH);

    %Surface integral
    for k=1:Integral2DOrder
       powerCoef=powerCoef+pft(k)*0.5*DetJac*...
           (-rEE(2,k)*rHH(1,k)-iEE(2,k)*iHH(1,k)+rEE(1,k)*rHH(2,k)+iEE(1,k)*iHH(2,k));
    end

end

Solver.powerCoef=sqrt(1/powerCoef);

% Solver.normE=Solver.normE*Solver.powerCoef;

end