Hi,
I have a H(curl) finite element space solution computed for some order (say order=3) and would like to project this solution on to a low order discretisation for the same mesh, but with order =0 elements. I’m guessing this might be through the projector operator
Projector(mask, range) # mask: bit array; range: bool
Is this possible?
Thanks
Ben
Hi Ben,
yes, it is possible to use the projection operator. However, it just neglects the information about the high order functions
[code]gf_proj = GridFunction(fes_ho)
bt = BitArray(fes_ho.FreeDofs())
bt[:]=True
bt[mesh.nedge:] = False
P = Projector(bt, True)
gf_proj.vec.data = P*gf_ho.vec[/code]
If you use an HCurl space of order 0 and then use the Set method
[code]fes_ho = HCurl(mesh, order=3)
fes_lo = HCurl(mesh, order=0)
gf_ho = GridFunction(fes_ho)
gf_lo = GridFunction(fes_lo)
#Set something
gf_ho.Set( CoefficientFunction( (x2y(1-y),-y3*x**2) ) )
#Interpolate high order solution to low order space
gf_lo.Set(gf_ho)[/code]
also the high order functions will be locally projected yielding to a better approximation, see attached file.
Best,
Michael
https://ngsolve.org/media/kunena/attachments/889/hcurl_projection.py
Attachment: hcurl_projection_2019-12-06.py
Hi Michael,
That’s excellent, thank you.
Kind regards,
Ben