topopt
topopt copied to clipboard
Plotting of Compliance: Force arrow in wrong direction.
Either my understanding of physics of wrong, or the force along the x-direction is wrongly visualized.
I would expect the image below is optimal if the horizontal force is pointing in the other direction.
Thanks for reporting this issue. There seems to be a bug in the plotting of EITHER the horizontal force or the vertical one. If I remember correctly a negative y-force should point upward. Its (probably) solved by removing the negative sign from the following line: https://github.com/AJJLagerweij/topopt/blob/1ad20e0bf961301ebca7a07205d02a51b7827196/src_Compliance/plotting.py#L132-L133 I can have a look at it this Saturday and update the git.
Regards, Bram
Thank you. The solution looks reasonable by changing the sign in https://github.com/AJJLagerweij/topopt/blob/1ad20e0bf961301ebca7a07205d02a51b7827196/src_Compliance/plotting.py#L124-L125
Keep up the good work.
Hello Gillhofer,
I see why your solution would solve the problem. I want to verify that it is working, for this purpose I've been trying to recreate the problem. I was not able to do so yet.
I've plotted the displacement fields of the cantilever beam example.
In both cases the load direction seems to coincide with the displacement direction.
But I agree that the plot you obtained is incorrect, could you share your load class?
Regards, Bram
It is not exactly the same but very similar. The result of the optimization process looks sane if I change the sign like discribed above. It is meant to work with a 128x128
grid.
class Issue1_Load(Load):
def __init__(self, nelx, nely, young, Emin, poisson):
super().__init__(nelx, nely, young, Emin, poisson)
def force(self):
f : 1-D array length covering all degrees of freedom
A -1 is placed at the index of the y direction of the top left node.
"""
f = super().force().reshape([self.nelx + 1, self.nely + 1, 2])
f[70, 30, 0] = -1
f[10,10,1] = -1.0
return f.reshape(-1)
def nodeid_from_coords(self, x, y):
# first id is the node id for the fixdos in x, second for y.
return [x * (self.nely + 1) * self.dim + self.dim * y,
x * (self.nely + 1) * self.dim + self.dim * y + 1]
def fixdofs(self):
return [node for i in range(0, self.nelx) for node in self.nodeid_from_coords(i, self.nelx)]