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

Adding scale factor to generate_vsp_surfaces #419

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions openaerostruct/geometry/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ def generate_mesh(input_dict):
return mesh


def generate_vsp_surfaces(vsp_file, symmetry=False, include=None):
def generate_vsp_surfaces(vsp_file, symmetry=False, include=None, scale=1.0):
"""
Generate a series of VLM surfaces based on geometries in an OpenVSP model.

Expand All @@ -721,6 +721,10 @@ def generate_vsp_surfaces(vsp_file, symmetry=False, include=None):
include : list[str]
List of body names defined in OpenVSP model that should be included in VLM mesh output.
Defaults to all bodies found in model.
scale: float
A global scale factor from the OpenVSP geometry to incoming VLM mesh
geometry. For example, if the OpenVSP model is in inches, and the VLM
in meters, scale=0.0254. Defaults to 1.0.

Returns
-------
Expand Down Expand Up @@ -832,6 +836,7 @@ def generate_vsp_surfaces(vsp_file, symmetry=False, include=None):
mesh[:, :, 0] = np.flipud(x.T)
mesh[:, :, 1] = np.flipud(y.T)
mesh[:, :, 2] = np.flipud(z.T)
mesh *= scale

# Check if the surface has already been added (i.e. symmetry == False)
if surf_name not in surfaces:
Expand All @@ -856,7 +861,7 @@ def generate_vsp_surfaces(vsp_file, symmetry=False, include=None):

# If a half-model was requested, go through and flag each surface as symmetrical
# if a left and right surface was found.
# NOTE: We don't necesarilly want to mark every surface as symmetrical,
# NOTE: We don't necessarily want to mark every surface as symmetrical,
# even if a half-model is requested, since some surfaces, like vertical tails,
# might lie perfectly on the symmetry plane.
if symmetry:
Expand Down
Loading