mechanicalStrain static method

double mechanicalStrain(
  1. Pressure stress,
  2. Pressure youngsModulus
)

Calculates the strain from a given Pressure (stress) and Young's modulus.

Both stress and Young's modulus are represented by Pressure. Returns a dimensionless strain value. Usage: final strain = EngineeringConstants.mechanicalStrain(stress, youngsModulus);

Implementation

static double mechanicalStrain(Pressure stress, Pressure youngsModulus) {
  // Convert both to the same base unit (Pascals) for a dimensionless ratio.
  final s = stress.inPa;
  final e = youngsModulus.inPa;
  if (e == 0) {
    throw ArgumentError('Youngs modulus cannot be zero.');
  }
  return s / e; // ε = σ/E
}