-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labeling of coordinates in cylindrical (and spherical) meshes #15
Comments
Funny you mentioned it @mhvwerts. I was working on a software that switches between Cartesian and Cylindrical coordinates, with some strange BCs changing with time. I found myself looking at the source code a couple of times because I was not sure about what x and y means, mostly for |
Oh yeah, Let's give it time. IMO, implementing this feature should be done in one run, and probably best that I make sure that we have a decently working |
Absolutely agree. Let's keep it as an open issue. I usually do some python-therapy when I get to busy with writing tasks. If I come up with a good idea, I will write it here. |
I just tried Co-pilot and it suggests using property decorators: class MyClass:
def __init__(self, xvalue, yvalue):
self.xvalue = xvalue
self.yvalue = yvalue
@property
def rvalue(self):
return self.xvalue
@rvalue.setter
def rvalue(self, value):
self.xvalue = value
@property
def zvalue(self):
return self.yvalue
@zvalue.setter
def zvalue(self, value):
self.yvalue = value The same thing can be done with a subclass. We also need to define subclasses of |
That's an interesting suggestion. It may be wise, perhaps necessary, to combine this with renaming the 'internal'
|
I agree. They cannot be hidden from the user but the underscore can help. This |
The re-labeling strategy might consist of a well-targeted and supervised find-and-replace of |
It will work but needs some work. I wish Python would let us define private attributes but it is not the case. |
The underscore at the beginning of the attribute name should be enough a deterrent for the casual user not to touch these attributes. |
PyFVTool systematically uses the labels
x
,y
andz
to represent the first, second resp. third coordinate, irrespective of the mesh geometry (Cartesian, cylindrical, spherical). This is important especially for internal code consistency and keeping the code base simple and free from Pythonic wizardry which may generate head-aches. Once used to it, this is OK, and one writes, e.g.,However, it would still be nice, one day, to consider the possibilities for adapting the programming interface to
cellcenters
andfacecenters
(andcreateMeshCylindrical
etc.) such that the user would only see and user
,z
(andtheta
,phi
) when working with cylindrical or spherical meshes. This would improve the readability of the user's code and even avoid some errors. Internally, PyFVTool would continue to use labelsx
,y
andz
, but this would be invisible to the user, and translated by the functions and methods for creating and accessing meshes.I have some vague ideas how this could be achieved in a relatively simple manner, but already wondering if @simulkade thinks if this is somewhere remotely feasible and desirable, and what others would think of such a new feature.
The text was updated successfully, but these errors were encountered: