-
Notifications
You must be signed in to change notification settings - Fork 60
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
Lift distribution post-processor #121
Conversation
- Lift distribution post-processor caused error since it was not updated to the latest SHARPy changes - Lift force/ force in z-direction is exported along with x,y, and z coordinates of leading edge and surface id - correction of lift for nodes who share different surface ids (e.g. symmetry plane)
import sharpy.utils.cout_utils as cout | ||
from sharpy.utils.settings import str2bool | ||
from sharpy.utils.solver_interface import solver, BaseSolver | ||
import sharpy.utils.settings as settings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import sharpy.utils.settings as settings | |
import sharpy.utils.settings as settings | |
import sharpy.aero.utils.mapping as mapping |
sharpy/postproc/liftdistribution.py
Outdated
|
||
norm = 1.0 | ||
|
||
tstep = self.data.aero.timestep_info[self.data.ts] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tstep = self.data.aero.timestep_info[self.data.ts] | |
aero_tstep = self.data.aero.timestep_info[self.data.ts] | |
struct_tstep = self.data.structure.timestep_info[self.data.ts] |
sharpy/postproc/liftdistribution.py
Outdated
node_counter = 0 | ||
for i_surf in range(tstep.n_surf): | ||
n_dim, n_m, n_n = tstep.zeta[i_surf].shape | ||
forces = tstep.forces[i_surf] + tstep.dynamic_forces[i_surf] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forces = tstep.forces[i_surf] + tstep.dynamic_forces[i_surf] | |
forces = mapping.aero2struct_force_mapping( | |
aero_tstep.forces, | |
self.data.aero.struct2aero_mapping, | |
aero_tstep.zeta, | |
structural_tstep.pos, | |
structural_tstep.psi, | |
self.data.structure.node_master_elem, | |
self.data.structure.connectivities, | |
structural_tstep.cag(), | |
self.data.aero.aero_dict) | |
forces += mapping.aero2struct_force_mapping( | |
aero_tstep.dynamic_forces, | |
self.data.aero.struct2aero_mapping, | |
aero_tstep.zeta, | |
structural_tstep.pos, | |
structural_tstep.psi, | |
self.data.structure.node_master_elem, | |
self.data.structure.connectivities, | |
structural_tstep.cag(), | |
self.data.aero.aero_dict) | |
sharpy/postproc/liftdistribution.py
Outdated
norm = 1.0 | ||
|
||
tstep = self.data.aero.timestep_info[self.data.ts] | ||
k_total = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k_total = 0 |
sharpy/postproc/liftdistribution.py
Outdated
k_total += n_n | ||
|
||
# get aero forces | ||
lift_distribution = np.zeros((k_total, 5)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lift_distribution = np.zeros((k_total, 5)) | |
lift_distribution = np.zeros((self.data.structure.num_node, 5)) |
sharpy/postproc/liftdistribution.py
Outdated
node_counter = 0 | ||
for i_surf in range(tstep.n_surf): | ||
n_dim, n_m, n_n = tstep.zeta[i_surf].shape |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node_counter = 0 | |
for i_surf in range(tstep.n_surf): | |
n_dim, n_m, n_n = tstep.zeta[i_surf].shape |
sharpy/postproc/liftdistribution.py
Outdated
node_counter = 0 | ||
for i_surf in range(tstep.n_surf): | ||
n_dim, n_m, n_n = tstep.zeta[i_surf].shape | ||
forces = tstep.forces[i_surf] + tstep.dynamic_forces[i_surf] | ||
abs_forces = np.zeros((n_m, n_n)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abs_forces = np.zeros((n_m, n_n)) | |
abs_forces = np.zeros((self.data.structure.num_node)) |
Hi Stef, |
Hi all, and nicely done on this first PR, Stef! One thing I noticed is that the settings for this solver use what was the old convention ( Then, another thought that comes to mind is whether we'd like to merge this postproc with |
Codecov Report
@@ Coverage Diff @@
## develop #121 +/- ##
===========================================
- Coverage 62.56% 62.52% -0.04%
===========================================
Files 124 124
Lines 22655 22679 +24
===========================================
+ Hits 14173 14179 +6
- Misses 8482 8500 +18
Continue to review full report at Codecov.
|
Hi guys! Let me know what you think! |
sharpy/postproc/liftdistribution.py
Outdated
for inode in range(N_nodes): | ||
if self.data.aero.aero_dict['aero_node'][inode]: | ||
# transform forces from B to A frame | ||
lift_distribution[inode,3]=np.dot(rot.T, forces[inode, :3])[2] # lift force |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I believe this will not always be the lift force. In the case, say the fluid is rotated but the wing is straight (i.e. A and G coincident) you will not be capturing the perpendicular to the free stream.
How @ArturoMS13 implemented this was to find the free stream direction at the section and project the force onto it (this would be the drag), then, the remainder of the force is assumed to be the lift (there would be a side force component particularly near tips but it makes the calculation simpler).
If you have a look at the Polars file you may it is done there if you'd like to implement it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, if I'm not mistaken forces
is in B frame. To get them to A
you'll need the local CRV to find cab
and then you can use rot.T
to get them onto G.
This is always so confusing......it's been years for me and still have doubts. I put a little function in algebra
called get_transformation()
that gets you the projection matrix based on the string you give it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good Stef! I left a few comments on getting the lift but I do agree with you in that it is best keeping this one separate from AeroForcesCalculator
.
Let me know if you have any questions about the comments
- local lift is calculated by use a coordinate transformation to the section's local stability coordinate system - similiar to polaraeroforces.py
Co-authored-by: Norberto Goizueta <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution!
Co-authored-by: Arturo Muñoz-Simón <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks!
Lift distribution post-processor was failing due to missing adjustments to previous SHARPy changes. The post-processor now reads aerodynamic forces from aero timestep and adjusts the lift force at nodes shared from two different surfaces (e.g. at symmetry plane). Adjusted lift force along with x-,y-, and z-coordinates of leading are exported to txt format for lift distribution evaluations. Code has no impact on any other SHARPy code.