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.

Space elements order through numpy

More
1 year 5 months ago - 1 year 5 months ago #4529 by alecontri
Hi,

   I was doing a convergence test, feeding the elements of a numpy array as the parameter "order" in the space definition. I noticed that no matter the number I was giving, the convergence was as if order = 1. This is a simple example where I show the order before and after the space definition:

Code:
import numpy as np from ngsolve import * from netgen.geom2d import unit_square from netgen.geom2d import SplineGeometry geo = SplineGeometry() geo.AddRectangle( (0, 0), (1, 1), bcs = ("bottom", "right", "top", "left")) mesh = Mesh(unit_square.GenerateMesh(maxh=0.1)) mesh.Curve(1) order_n = np.array([4]) print(order_n[0]) V = H1(mesh, order=order_n[0], dirichlet="bottom|right|left|top") print(V.globalorder)


Is it a bug or is it supposed to be like this (of course writing
Code:
order=int(order_n[0])
solved the problem)?

Thanks a lot
Last edit: 1 year 5 months ago by alecontri.
More
1 year 5 months ago #4532 by christopher
Hm yes, we expect an int python type here and numpy gives a numpy.int64... But asking for all the possible types would also be too much in the code... I think we have to stick here to convert the parameter to int.
The following user(s) said Thank You: alecontri
Time to create page: 0.160 seconds