- Thank you received: 0
Find maximum value of Gridfunction
- creativeworker
-
Topic Author
- Offline
- Senior Member
-
Less
More
6 years 7 months ago - 6 years 7 months ago #1402
by creativeworker
Find maximum value of Gridfunction was created 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:
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.
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: 6 years 7 months ago by creativeworker.
6 years 7 months ago #1412
by joachim
Replied by joachim on topic Find maximum value of Gridfunction
Hi,
The reference docu are thy Python doc-strings. For every object you can use help like
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
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.100 seconds