convert Module

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

pyNastran.bdf.mesh_utils.convert._convert_aero(model: BDF, xyz_scale: float, time_scale: float, force_scale: float) → None[source]
Converts the aero cards
  • CAEROx, PAEROx, SPLINEx, AECOMP, AELIST, AEPARAM, AESURF

Supports: AERO, AEROS, CAERO1, CAERO2, TRIM*, MONPNT1, FLUTTER FLFACT-rho/vel

GUST, AESURF, PAERO2

Skips: PAERO1, AESTAT, AESURFS, AECOMP, AELIST Doesn’t support:CAERO3-5, PAERO3-5, SPLINEx, AEPARAM, AELINK, AEPRESS, AEFORCE, *probably not done

pyNastran.bdf.mesh_utils.convert._convert_constraints(model: BDF, xyz_scale: float) → None[source]

Converts the spc/mpcs

Supports: SPC1, SPC, SPCAX Implicitly supports: MPC, MPCADD, SPCADD

pyNastran.bdf.mesh_utils.convert._convert_coordinates(model: BDF, xyz_scale: float) → None[source]

Converts the coordinate systems

Supports: CORD1x, CORD2x

pyNastran.bdf.mesh_utils.convert._convert_dconstr(model: BDF, dconstr: DCONSTR, pressure_scale: float) → None[source]

helper for _convert_optimization

pyNastran.bdf.mesh_utils.convert._convert_desvars(desvars, scale)[source]

scales the DVPREL/DVCREL/DVMREL DESVAR values

pyNastran.bdf.mesh_utils.convert._convert_dvcrel1(dvcrel: Union[DVCREL1, DVCREL2], xyz_scale: float) → float[source]

helper for _convert_optimization

pyNastran.bdf.mesh_utils.convert._convert_dvprel1(dvprel, xyz_scale: float, mass_scale: float, force_scale: float, time_scale: float) → float[source]

helper for _convert_optimization

pyNastran.bdf.mesh_utils.convert._convert_elements(model: BDF, xyz_scale: float, time_scale: float, mass_scale: float, force_scale: float) → None[source]

Converts the elements

Supports: CTRIA3, CTRIA6, CTRIAR, CQUAD4, CQUAD8, CQUADR,

CELAS2, CELAS4, CDAMP2, CDAMP4, CBUSH, CONROD, CBAR, CBEAM, GENEL, CONM2, CMASS4

SkipsCELAS1, CELAS3, CDAMP3, CDAMP5, CCONEAX,

CROD, CTUBE, CVISC, CBUSH1D, CQUAD, CSHEAR, CTRIAX, CTRIAX6, CTETRA, CPENTA, CHEXA, CPYRAM, CMASS1, CMASS3,

NX Skips: CTRAX3, CTRAX6, CPLSTN3, CPLSTN6, CPLSTN4’, CPLSTN8, CQUADX4, CQUADX8 *intentionally

pyNastran.bdf.mesh_utils.convert._convert_loads(model: BDF, xyz_scale: float, time_scale: float, force_scale: float, temperature_scale: float) → None[source]

Converts the loads

Supports:
  • dloads: RLOAD1*, TLOAD1*

  • loads: FORCE, FORCE1, FORCE2, MOMENT, MOMENT1, MOMENT2

    GRAV, ACCEL1, PLOAD, PLOAD1, PLOAD2, PLOAD4, RANDPS

  • combinations: DLOAD, LOAD

  • probably not done

pyNastran.bdf.mesh_utils.convert._convert_materials(model: BDF, xyz_scale: float, mass_scale: float, force_scale: float, temperature_scale: float) → None[source]

Converts the materials

Supports: MAT1, MAT2, MAT3, MAT8, MAT9, MAT10, MAT11

pyNastran.bdf.mesh_utils.convert._convert_nodes(model: BDF, xyz_scale: bool) → None[source]

Converts the nodes

Supports: GRID

pyNastran.bdf.mesh_utils.convert._convert_optimization(model: BDF, xyz_scale: float, mass_scale: float, force_scale: float, time_scale: float) → None[source]

Converts the optimization objects

Limited Support: DESVAR, DCONSTR, DVCREL1, DVPREL1

pyNastran.bdf.mesh_utils.convert._convert_pbar(scales: Set[str], prop: PBAR, xyz_scale: float, area_scale: float, area_moi_scale: float, nsm_bar_scale: float) → None[source]

converts a PBAR

pyNastran.bdf.mesh_utils.convert._convert_pbeam(scales: Set[str], prop: PBEAM, xyz_scale: float, area_scale: float, area_moi_scale: float, nsm_bar_scale: float) → None[source]

converts a PBEAM

pyNastran.bdf.mesh_utils.convert._convert_pbeam3(scales: Set[str], prop: PBEAM3, xyz_scale: float, area_scale: float, area_moi_scale: float, nsm_bar_scale: float) → None[source]

converts a PBEAM3

pyNastran.bdf.mesh_utils.convert._convert_pbush(scales: Set[str], prop: PBUSH, velocity_scale: float, mass_scale: float, stiffness_scale: float, log: SimpleLogger) → None[source]
pyNastran.bdf.mesh_utils.convert._convert_pbush1d(model: BDF, scales: Set[str], prop: PBUSH1D, xyz_scale: float, area_scale: float, mass_scale: float, damping_scale: float, stiffness_scale: float) → None[source]
pyNastran.bdf.mesh_utils.convert._convert_properties(model: BDF, xyz_scale: float, time_scale: float, mass_scale: float, force_scale: float, temperature_scale: float) → None[source]

Converts the properties

Supports: PELAS, PDAMP, PDAMP5, PVISC, PROD, PBAR, PBARL, PBEAM, PBEAML,

PSHELL, PSHEAR, PCOMP, PCOMPG, PELAS, PTUBE, PBUSH, PCONEAX, PGAP, PBUSH1D

Skips : PSOLID, PLSOLID, PLPLANE, PIHEX

Skips are unscaled (intentionally)

pyNastran.bdf.mesh_utils.convert._get_dload_scale(dload, scales: Set[str], xyz_scale: float, velocity_scale: float, accel_scale: float, force_scale: float) → None[source]

LOAD assumes force

pyNastran.bdf.mesh_utils.convert._log_scales(log: SimpleLogger, scale_map: Dict[str, str], scales: Set[str], keys_to_skip={})[source]
pyNastran.bdf.mesh_utils.convert._scale_caero(caero, xyz_scale: float, xyz_aefacts) → None[source]
pyNastran.bdf.mesh_utils.convert._scale_term(name: str, coeffs: List[float], terms: List[float], scales: List[float]) → Tuple[float, str][source]
pyNastran.bdf.mesh_utils.convert._set_wtmass(model: BDF, gravity_scale: float) → None[source]

set the PARAM,WTMASS

ft-lbm-s-lbf-psf : 1. / 32.2 in-lbm-s-lbf-psi : 1. / (32.2*12) m-kg-s-N-Pa : 1. mm-Mg-s-N-Mpa : 1. in-slinch-s-lbf-psi : 1. ft-slug-s-lbf-psf : 1. in-slug-s-lbf-psi : 1 / 12.

1 slug * 1 ft/s^2 = 1 lbf 1 slinch * 1 in/s^2 = 1 lbf 1 slinch = 12 slug

F = m*a 386 lbf = 1 slinch * 386 * in/s^2 32 lbf = 1 slug * 32 * ft/s^2 1 N = 1 kg * 9.8 m/s^2

1 lbf = g_scale * 1 slinch * 1 in/s^2 1 lbf = g_scale * 12 slug * 1 in/s^2 –> g_scale = 1/12.

pyNastran.bdf.mesh_utils.convert._setup_scale_by_terms(scales: List[float], terms: List[str], quiet: bool = False) → Tuple[float, float, float][source]

determines the mass, length, time scaling factors

pyNastran.bdf.mesh_utils.convert.convert(model: BDF, units_to: List[str], units: Optional[List[str]] = 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, length_to)[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: Union[BDF, str], terms: List[float], scales: List[float], bdf_filename_out: Optional[str] = None, encoding: Optional[str] = None, log=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