convert Module

defines:
  • convert(model, units_to, units=None)

pyNastran.bdf.mesh_utils.convert.convert(model: BDF, units_to: list[str], units: list[str] | None = None) None[source]

Converts a model from a set of defined units

Parameters:
modelBDF

cross references the model (default=True)

units_tolist[str]

[length, mass, time] length = {in, ft, m, cm, mm} mass = {g, kg, Mg, lbm, slug, slinch} time = {s}

unitslist[str]

overwrites model.units

pyNastran.bdf.mesh_utils.convert.convert_length(length_from: str, length_to: str) tuple[float, float][source]

Determines the length scale factor

We create a gravity_scale_length for any non-standard unit (ft, m)

pyNastran.bdf.mesh_utils.convert.convert_mass(mass_from: str, mass_to: str, log: SimpleLogger) tuple[float, float, float][source]

determines the mass, weight, gravity scale factor

We apply a gravity_scale_mass for any unit not {kg, slug}. Then we convert to N.

So for SI, if we have kg, we have a base unit, and the length is assumed to be m, so we have a consistent system and gravity_scale_mass is 1.0.

For lbm:

F = m*a 1 lbf = 1 lbm * 1 ft/s^2 32 lbf = 1 slug * 32 ft/s^2 gscale = 1/g F = gscale * m * a 1 lbf = gscale * 1 lbm * 32 ft/s^2 –> gscale = 1/32

For slug:

F = gscale * m * a 32 lbf = gscale * 1 slug * 32 ft/s^2 –> gscale = 1

For slinch:

F = gscale * m * a 386 lbf = gscale * 1 slinch * 12*32 in/s^2 1 slinch = 12 slug 12 in = 1 ft 386 lbf = gscale * 12 slug * 32 ft/s^2 –> gscale = 1

TODO: slinch/slug not validated

pyNastran.bdf.mesh_utils.convert.get_scale_factors(units_from, units_to, log)[source]

[length, mass, time] [in, lb, s]

pyNastran.bdf.mesh_utils.convert.scale_by_terms(bdf_filename: BDF | str, terms: list[str], scales: list[float], bdf_filename_out: str | None = None, encoding: str | None = None, log: SimpleLogger | None = None, debug: bool = True) BDF[source]

Scales a BDF based on factors for 3 of the 6 independent terms

Parameters:
bdf_filenamestr / BDF()

a BDF filename

termslist[str]; length=3

the names {M, L, T, F, P, V, A, rho} mass, length, time, force, pressure, velocity, area, mass_density

scaleslist[float]; length=3

the scaling factors

bdf_filename_outstr; default=None

a BDF filename to write

Returns:
modelBDF()

the scaled BDF

pyNastran.bdf.mesh_utils.convert.scale_model(model: BDF, xyz_scale: float, mass_scale: float, time_scale: float, force_scale: float, gravity_scale: float, convert_nodes: bool = True, convert_elements: bool = True, convert_properties: bool = True, convert_materials: bool = True, convert_aero: bool = True, convert_constraints: bool = True, convert_loads: bool = True, convert_optimization: bool = True)[source]

Performs the model scaling