Find maximum value of Gridfunction


i have some trouble to find the maximum value of a GridFunction. I assume it must be very simple, but I can’t figure out how it works. Here is my code:

               # - - - - -

                gfB = curl(gfA)

                A_max = max(Norm(gfA))*1e-3     #Conversion from mm to m
                B_max = max(Norm(gfB))*1e-6     #Conversion from mm^2 to m^2

                print('max(|A|)       ', A_max, ' Vs/m')
                print('max(|B|)       ', B_max, ' Vs/m^2')

                # - - - - -

Thank you in advance for your effort!

Is there any official description of the API? I always struggle to find out what methods are available and how they work.


The reference docu are thy Python doc-strings. For every object you can use help like

help (mesh)
help (GridFunction)

Finding the maximum of an arbitrary function you can construct within NGSolve accurately and efficient ist not trivial. Calculating the max in all integration points or so would be easy, I am thinking about this possibility.

Now you can do this workaround:
Interpolate into an H1(order=1) gridfunction, and take the maximal value of the coefficient vector.

Best, Joachim