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.

Find maximum value of Gridfunction

More
5 years 3 months ago - 5 years 3 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 3 months ago by creativeworker.
More
5 years 3 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.148 seconds