# 2d Integration over a 2d domain

**URL:** https://community.freefem.org/t/2d-integration-over-a-2d-domain/3229
**Category:** General Discussion
**Created:** [May 7, 2024, 8:45pm UTC](https://community.freefem.org/t/2d-integration-over-a-2d-domain/3229 "2024-05-07T20:45:34Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Walid](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/walid/32/2477_2.png) [@Walid](https://community.freefem.org/u/Walid)
#### Post date: [May 7, 2024, 8:45pm UTC](https://community.freefem.org/t/2d-integration-over-a-2d-domain/3229/1 "2024-05-07T20:45:34Z")

</div>

Hello all,

I need you support to calculate  
I = (1/V) ∬ 2πqr(µe.We+µp.Wp+µn.Wn) EL drdz

where We,n,p and µe, and El are finite element functions and µn, p are real numbers

VE EL;  
Ve Ne, Neold;  
Ve Np, Npold;  
Ve Nn, Nnold;  
Ve We, Wp, Wn;

I tried two times with two different approaches

the first to apply int2d as below

I = int2d(Th)(2_pi_x_q_(mue_We + mup_Wp+ mun_Wn)_((EL)));|  
I = I/abs(Vapp);

and the second is to create a for loop over the mesh number of degree of freedom

```
for (int p=0; p<Vh.ndof; ++p)
{
	I = We[][p]*Ne[][p];
	I = I + Wp[][p]*Np[][p];
	I = I + Wn[][p]*Nn[][p];
	I = I * EL[][p];
	I = I * 2*pi*q;
	I = I /(abs(Vapp));
	Is += I;
	//cout << I << endl;
}	

```

and it is always return zero in the two trails
