FreeFem / FreeFem-sources

FreeFEM source code
https://freefem.org/
Other
776 stars 191 forks source link

Complement `ExtractDofsonBorder` for vectorial finite element space #184

Open zhaog6 opened 3 years ago

zhaog6 commented 3 years ago

The PR supports extracting DOFs from border for vectorial finite element space.

prj- commented 3 years ago

I'm not really sure that this is needed. You could just get the border with a P_1 finite element space and then multiply and shift to get a "multi-component" border.

zhaog6 commented 3 years ago

I'm not really sure that this is needed. You could just get the border with a P_1 finite element space and then multiply and shift to get a "multi-component" border.

You are right. I ignored the shortcut.

zhaog6 commented 3 years ago

But for [P2, P2, P1], this seems to be more complicated, Could I do it following your suggestion in the case?

prj- commented 3 years ago

It won't be as easy for [P2, P2, P1], but your code won't work either for such a fespace, I guess.

zhaog6 commented 3 years ago

I try it, from the result of plot, it looks like ok when I run the following code, and the number of DOFs on the border seems ok.

include "ExtractDofsonBorder.idp"

macro fe() [P2, P2, P1] //

mesh Th = square(64, 64);
int[int] labs = 1 : 3;
int[int] doflabs;
fespace Vh(Th, fe);
ExtractDofsonBorder(labs, Vh, doflabs, 1, 3);
Vh [uh, vh, ph] = [0, 0, 0];
for (int j = 0; j < doflabs.n; ++j) {
    uh[][doflabs[j]] = 1;
}
plot(uh, cmm="uh", wait=1);
plot(vh, cmm="vh", wait=1);
plot(ph, cmm="ph", wait=1);