# Compute Hdiv norm for RT elements

Hi there,

I couldnt find anything regarding the Hdiv norm for a RT element in the documentation. Can someone help?

You can search this for Raviart or did you find this?

https://doc.freefem.org/documentation/finite-element.html

it does come up in some examples AFAICT,

`````` find .. -type f | xargs -d \\n grep -i Raviart
../plugin/splitmesh6.edp:fespace RT6(Th6,RT0); // Raviart Thomas ordre 0
../plugin/test-suite.log:   11 : fespace RT6(Th6,RT0); // Raviart Thomas ordre 0
../plugin/splitmesh6.edp.log:   11 : fespace RT6(Th6,RT0); // Raviart Thomas ordre 0

I guess the best way to answer specific questions however is make simple test cases
or read the source code :)

``````

My main difficultie is on how to compute the divergent of a vector valued function
This is my RTm space

``````macro div(u,v) ( dx(u)+dy(v) ) //

func bsigExatoX = -1*kappa*dxu;
func bsigExatoY = -1*kappa*dyu;

func RT = RT0;
fespace RTm(Th[K], RT);
RTm [sigmaHx, sigmaHy];

RTm [errorRTx, errorRTy] = [bsigExatoX, bsigExatoY] - [sigmaHx, sigmaHy];

real rsigmaHx, rsigmaHy;
for(int i=0; i<sigmaKHx.n; i++){
rsigmaHx = rsigmaHx + errorRTx[][i]^2;
rsigmaHy = rsigmaHy + errorRTy[][i]^2;
}

L2errorRT[K] = int2d(Th[K])(rsigmaHx + rsigmaHy);
L2diverrorRT[K] = int2d(Th[K])((div(errorRTx, errorRTy))^2);
HdiverrorRT[K] = L2errorRT[K] + L2diverrorRT[K];
``````

This way of using the macro div, it doesn’t seems right

Based on what I can gather from this documentation, it seems like you are doing it right?

``````VhRT(Th, RT0);
VhRT [f1h, f2h] = [f1(x, y), f2(x, y)];
// divf = dx(f1h) + dy(f2h);
VhP2(Th, [P2, P2]);
VhP2 [g1h, g2h] = [g1(x, y), g2(x, y)];
// divg = dx(g1h) + dy(g2h);
``````