Find maximum value of Gridfunction

More
5 years 10 months ago - 5 years 10 months ago #1402 by creativeworker
Hello,

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:
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('-------------------------------') print('max(|A|) ', A_max, ' Vs/m') print('max(|B|) ', B_max, ' Vs/m^2') print('-------------------------------') # - - - - -

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.
Last edit: 5 years 10 months ago by creativeworker.
More
5 years 9 months ago #1412 by joachim
Hi,

The reference docu are thy Python doc-strings. For every object you can use help like
Code:
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
Time to create page: 0.098 seconds