I need to compute the local BDM projection of a given set of data in 2D.
The formulation is as follows on a single element K:
Find sigma in BDM_k so that
<sigma.n, mu="">_\dK = F1(mu) for all mu in Pk(\dK)
(\div sigma, v) = F2(v) for all v in P{k-1}(K)/R
(sigma, \curl bubble*w) = F3(w) for all w in P{k-1}(K)
where bubble is the cubic bubble function, and rhs are data.
I am going to set up a 4-componound finite elements for [sigma, mu, v, w] and write a weak formulation to obtain the projection <sigma>, but I don't know how to write the cubic bubble function in to the variational form.
Maybe, there is an alternative easier way to obtain the projection...
Best,
Guosheng
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
there is no direct way to write down a bubble function (good idea, we may add it as special_cf), but you can use this workaround:
Define a H1-finite element space of order 3, and define a GridFunction bub on it.
You can easily set the coefficient-vector to get the element-wise bubbles:
bub.vec[:] = 0
bub.vec[-mesh.ne:] = 1
Now you can use bub as well as its derivative grad(bub)
Best,
Joachim
PS: have you seen already our new site ngsolve.org ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yeah, I saw that fancy NGsolve homepage... I am actually quite interested in your workshop, but need to find financial supports first
I will try your idea then.
Regarding the basis functions for BDM, I am thinking of getting a broken version of the reduced basis that excuding cell-wise curls.
There should be a flag to get the reduced space, right?
Then, my problem can be easily solved by the reduced BDM finite elements...
Best,
Guosheng
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
would be cool if you come over to the workshop ...
HDiv has a flag "hodivfree", then you get the curl-functions only. I think that's the opposite what you want. There is a flag "curlorder", but the code in hdivhofespace.cpp looks like it is not completely functional, you may have to fix a few places - doable, look for SZ hack.
Then you can set curlorder to k, while order to 0.
Best,
Joachim
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried to look for SZ hack... didn't succeed.
It turns out to be quite hard for me to work with the "curlorder" flag .. :<
I worked out the problem by dealing with the rotated Hcurl space, I changed the flag "nograds" in the source code to only clear out "gradientdomain" dofs, but not "gradientboundaries" dofs, this way, my reduced Hcurl space is just a 90 degree rotation of the reduced BDM space I want. My code seems to work now...
Now, I am thinking of how to generate reduced finite element spaces from the available spaces in NGSolve with minimal or no modification of source code, it is definite doable by modifying the source code by adding additional flags, which would be potentially hard for non-experts, like me, to do since details of location of basis functions need to be tracked, where no documentation is available yet except S. Zagmayr's thesis on the construction of basis.
Maybe, we can get new finite element easily by vary the degree for each type of basis as done for a hp-FEM.
By the way, I didn't see any python scripts working on hp-fem, do you support hp-refinement in python right now? It would be great to have a tutorial on hp fem.
As an example, I want to decompose a high order H1 space to trace part and bubble part, I am thinking of doing:
Just to close the discussion on this topic.
I added a two flags to the hdiv space, "hocurlfree" and "onlyhocurl" in the same spirit at "hodivfree" and "onlyhodiv" (well, I am actually not sure what's the usage of onlyhodiv....)
"hocurlfree" gives the subspace of BDM_k without cell-wise curl bubbles, and
"onlyhocurl" gives the subspace of BDM_k with only cell-wise curl bubbles
Using these two spaces, I can then compute the BDM projection easily. Both flags are only implemented for trig and tet. The space is verified for trig, but not tet yet...
Here in the patch, I also included Christoph's RT Hack for trig elements.
Hello,
I need to compute the local BDM projection of a given set of data in 2D.
The formulation is as follows on a single element K:
Find sigma in BDM_k so that
<sigma.n, mu="">_\dK = F1(mu) for all mu in Pk(\dK)
(\div sigma, v) = F2(v) for all v in P{k-1}(K)/R
(sigma, \curl bubble*w) = F3(w) for all w in P{k-1}(K)
where bubble is the cubic bubble function, and rhs are data.
I am going to set up a 4-componound finite elements for [sigma, mu, v, w] and write a weak formulation to obtain the projection <sigma>, but I don't know how to write the cubic bubble function in to the variational form.
Maybe, there is an alternative easier way to obtain the projection...
Best,
Guosheng
Hi Guosheng,
there is no direct way to write down a bubble function (good idea, we may add it as special_cf), but you can use this workaround:
Define a H1-finite element space of order 3, and define a GridFunction bub on it.
You can easily set the coefficient-vector to get the element-wise bubbles:
bub.vec[:] = 0
bub.vec[-mesh.ne:] = 1
Now you can use bub as well as its derivative grad(bub)
Best,
Joachim
PS: have you seen already our new site ngsolve.org ?
Hi Joachim,
Yeah, I saw that fancy NGsolve homepage... I am actually quite interested in your workshop, but need to find financial supports first
I will try your idea then.
Regarding the basis functions for BDM, I am thinking of getting a broken version of the reduced basis that excuding cell-wise curls.
There should be a flag to get the reduced space, right?
Then, my problem can be easily solved by the reduced BDM finite elements...
Best,
Guosheng
Hi again,
would be cool if you come over to the workshop ...
HDiv has a flag "hodivfree", then you get the curl-functions only. I think that's the opposite what you want. There is a flag "curlorder", but the code in hdivhofespace.cpp looks like it is not completely functional, you may have to fix a few places - doable, look for SZ hack.
Then you can set curlorder to k, while order to 0.
Best,
Joachim
Hi Joachim,
I tried to look for SZ hack... didn't succeed.
It turns out to be quite hard for me to work with the "curlorder" flag .. :<
I worked out the problem by dealing with the rotated Hcurl space, I changed the flag "nograds" in the source code to only clear out "gradientdomain" dofs, but not "gradientboundaries" dofs, this way, my reduced Hcurl space is just a 90 degree rotation of the reduced BDM space I want. My code seems to work now...
Now, I am thinking of how to generate reduced finite element spaces from the available spaces in NGSolve with minimal or no modification of source code, it is definite doable by modifying the source code by adding additional flags, which would be potentially hard for non-experts, like me, to do since details of location of basis functions need to be tracked, where no documentation is available yet except S. Zagmayr's thesis on the construction of basis.
Maybe, we can get new finite element easily by vary the degree for each type of basis as done for a hp-FEM.
By the way, I didn't see any python scripts working on hp-fem, do you support hp-refinement in python right now? It would be great to have a tutorial on hp fem.
As an example, I want to decompose a high order H1 space to trace part and bubble part, I am thinking of doing:
Or, I want to have (modified) Raviart-Thomas space rather than BDM Hdiv space,
I can do
here order_triangle_curl shall be order of the cell degrees of freedom that are curls, and
order_triangle_div be the order of non-div free bubbles.
If we can do this, then, my reduced BDM space would smiply be
Please let me know if this would be "easy" to do, maybe just half an hour's work.... :>
Best,
Guosheng
Just to close the discussion on this topic.
I added a two flags to the hdiv space, "hocurlfree" and "onlyhocurl" in the same spirit at "hodivfree" and "onlyhodiv" (well, I am actually not sure what's the usage of onlyhodiv....)
"hocurlfree" gives the subspace of BDM_k without cell-wise curl bubbles, and
"onlyhocurl" gives the subspace of BDM_k with only cell-wise curl bubbles
Using these two spaces, I can then compute the BDM projection easily. Both flags are only implemented for trig and tet. The space is verified for trig, but not tet yet...
Here in the patch, I also included Christoph's RT Hack for trig elements.
Best,
Guosheng