It seems there's a mistake in <class StructureWeightLoads> if I'm right
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 "-"
Thank you for opening the issue, I think you're right. Let me double check then I will fix it.
Hello, may I ask you a question about OpenMDAO? I currently use it to solve optimization problems. I notice that in order to get gradients of objective function and constrain functions wrt design variables, this software calculates derivatives of each components and multiplies them together according to their connnections.
But if I can't write partial functions of each component, if there's a way to make OpenMDAO calculate the derivatives of objective function and constrain functions wrt design variables directly by 'fd' method ? In this way, there's no need to calculate partials of each component by 'fd' method one by one.
------------------ 原始邮件 ------------------ 发件人: "mdolab/OpenAeroStruct" @.>; 发送时间: 2021年3月10日(星期三) 下午2:30 @.>; @.@.>; 主题: Re: [mdolab/OpenAeroStruct] It seems there's a mistake in <class StructureWeightLoads> if I'm right (#358)
Thank you for opening the issue, I think you're right. Let me double check then I will fix it.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
@Iamkiller233 this is a general OpenMDAO question and not something related to this repository. Please check their documentation here.
Yes,I had read that documentation before, I had read class methods in the class:problem(), but I didn't find any method related to that question.
------------------ 原始邮件 ------------------ 发件人: "Neil @.>; 发送时间: 2021年6月16日(星期三) 凌晨0:37 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [mdolab/OpenAeroStruct] It seems there's a mistake in <class StructureWeightLoads> if I'm right (#358)
@Iamkiller233 this is a general OpenMDAO question and not something related to this repository. Please check their documentation here.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Try asking on Stack Overflow, I know the developers check there often. Please keep discussions here relevant to OpenAeroStruct.
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 insetup()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.