# Number of degrees of freedom

**URL:** https://community.freefem.org/t/number-of-degrees-of-freedom/523
**Category:** General Discussion
**Created:** [July 27, 2020, 5:49pm UTC](https://community.freefem.org/t/number-of-degrees-of-freedom/523 "2020-07-27T17:49:42Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![hamed](https://avatars.discourse-cdn.com/v4/letter/h/d6d6ee/32.png) [@hamed](https://community.freefem.org/u/hamed)
#### Post date: [July 27, 2020, 5:49pm UTC](https://community.freefem.org/t/number-of-degrees-of-freedom/523/1 "2020-07-27T17:49:42Z")

</div>

Dear all

I like to limit my integration over a portion of whole.  
To do this I changed `int2d(Th)` to `int2d(Th,Coil)`

```
varf vPoi(u,v)
    =int2d(Th,Coil) (sig * Grad(u)' * Grad(v))
    +on(CoilTerminalIn, u=0)
    +on(CoilTerminalOut, u=1);
matrix Poi = vPoi(Ph,Ph);
cout << "sizePoi " << Poi.n << endl;

```

The problem is that the size of matrix `Poi` does not vary at all.  
How can i remove extra variables?

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [July 27, 2020, 6:53pm UTC](https://community.freefem.org/t/number-of-degrees-of-freedom/523/2 "2020-07-27T18:53:44Z")

</div>

```auto
mesh ThCoil = trunc(Th, region == Coil);
varf vPoi(u,v)
    =int2d(ThCoil) (sig * Grad(u)' * Grad(v))//'
    +on(CoilTerminalIn, u=0)
    +on(CoilTerminalOut, u=1);
fespace PhCoil(ThCoil, P1);
matrix Poi = vPoi(PhCoil,PhCoil);
cout << "sizePoi " << Poi.n << endl;

```

---

<div class="post-metadata">

### Author: ![hamed](https://avatars.discourse-cdn.com/v4/letter/h/d6d6ee/32.png) [@hamed](https://community.freefem.org/u/hamed)
#### Post date: [July 27, 2020, 10:19pm UTC](https://community.freefem.org/t/number-of-degrees-of-freedom/523/3 "2020-07-27T22:19:13Z")

</div>

It seems I had a misunderstanding about `int2d`

suppose that I have a mixed `fespace` like  
`fespace -> [RT0Orth,P1]`  
I like to have `RT0Orth` to be defined all over the domain and `P1` only inside the `coil`.

In fact I like to make a matrix like `K=[A B; B' C]` which  
A=(RT0Orth,RT0Orth);  
B=(RT0Orth,P1);  
C=(P1,P1);

---

<div class="post-metadata">

### Author: ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)
#### Post date: [July 30, 2020, 2:08pm UTC](https://community.freefem.org/t/number-of-degrees-of-freedom/523/4 "2020-07-30T14:08:29Z")

</div>

just defined VRT and VP1 fespae  
difined you matrix A, B and C with varf, va, vb,vc;  
varf va([u1,u2],[v1,v2]) = … ;  
varf vb(p,[v1,v2]) = …;  
varf vc(p,q) = …;

matrix A = va(VRT,VRT);  
matrix B = vb(VP1,VRT);// warning test function corresponding to row index.  
matrix C = vb(VP1,VP1);

matrix K = [[A,B],[B’,C]];
