Skip to content
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

It seems there's a mistake in <class StructureWeightLoads> if I'm right #358

Open
Iamkiller233 opened this issue Mar 8, 2021 · 6 comments

Comments

@Iamkiller233
Copy link

The original code is :
def compute(self, inputs, outputs):

  struct_weights = inputs['element_mass'] * inputs['load_factor'] * grav_constant
  nodes = inputs['nodes']

  element_lengths = norm(nodes[1:, :] - nodes[:-1, :], axis=1)
  outputs['element_lengths'] = element_lengths

  # And we also need the deltas between consecutive nodes
  deltas = nodes[1:, :] - nodes[:-1, :]
  # save these slices cause I use them a lot
  del0 = deltas[: , 0]
  del1 = deltas[: , 1]
  .......
  bm4 = z_moments_for_each * del0 / element_lengths
  loads[:-1, 4] += -bm4
  loads[1:, 4] += bm4

But I think that it should be: del0 = -deltas[: , 0]
Because deltas[: , 0] is negative for a sweepback wing, it should be added with "-"

@kanekosh
Copy link
Contributor

Thank you for opening the issue, I think you're right. Let me double check then I will fix it.

@Iamkiller233
Copy link
Author

Iamkiller233 commented Jun 15, 2021 via email

@ewu63
Copy link
Collaborator

ewu63 commented Jun 15, 2021

@Iamkiller233 this is a general OpenMDAO question and not something related to this repository. Please check their documentation here.

@Iamkiller233
Copy link
Author

Iamkiller233 commented Jun 15, 2021 via email

@ewu63
Copy link
Collaborator

ewu63 commented Jun 15, 2021

Try asking on Stack Overflow, I know the developers check there often. Please keep discussions here relevant to OpenAeroStruct.

@kanekosh
Copy link
Contributor

I second this for future OpenMDAO-related questions

Try asking on Stack Overflow, I know the developers check there often. Please keep discussions here relevant to OpenAeroStruct.

But I can answer real quick for this one.

  • You don't have to implement FD of each component by yourself, OpenMDAO automatically switches to FD if you don't write compute_partials(). You still need to declare the partials in setup() though.
  • If you still want the system-level FD (not component level), for pyOptSparse driver, you can use the option prob.driver.options['gradient method'] = 'pyopt_fd'. By this OpenMDAO does not compute the gradient but the pyOptSparse's finite difference does. I think there is a similar capability for the Scipy driver but I am not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants