Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Projection of a high order solution on to the lowest order basis.

More
4 years 4 months ago #2177 by BenWilson94
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
More
4 years 4 months ago #2178 by mneunteufel
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

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( (x**2*y*(1-y),-y**3*x**2) ) ) #Interpolate high order solution to low order space gf_lo.Set(gf_ho)
also the high order functions will be locally projected yielding to a better approximation, see attached file.

Best,
Michael

File Attachment:

File Name: hcurl_proj...12-06.py
File Size:1 KB
More
4 years 4 months ago #2181 by BenWilson94
Hi Michael,

That's excellent, thank you.

Kind regards,

Ben
Time to create page: 0.115 seconds