Hello there,
Assuming I have a continuous function F represented as a Python function, which can be evaluated at any point (x, y, z) in space and returns the value F(x, y, z) --- i.e., point evaluation is availabe, but nothing else.
In theory, that's enough to do quadrature, integration, etc... . But I don't know how to do that in NgSolve with an object other than a CoefficientFunction...
So, is there a way in NgSolve to have a GridFunction (or CoefficientFunction) represent (a projection of) this function F?
* It's quite easy to get the desired nodal interpolant of that function F in NgSolve for first order elements H1(mesh, order=1) by just setting the nodal values accordingly.
* For general order > 1, it's not that obvious anymore; and potentially gets very messy.
* I guess there is some tool for this in NgSolve, which I just don't know about --> so I am thankful for any hints
Example code:
F = lambda px, py, pz: some_non_standard_formula(px, py, pz) # supports point evaluation
V = H1(mesh, order=5) # general order p > 1
Fh = GridFunction(V) # should represent a discretization of F
Best regards,
Carl