diff --git a/CHANGELOG.md b/CHANGELOG.md index b25ea73..047b383 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,15 @@ All notable changes to CableXSec are recorded in this file. The format follows - `CoreFrictionSpec(central_filler=...)` selects the support of the inward core loads in the bounded core contact estimate: the neighbouring cores of a touching trefoil (default) or a central filler. +- A cylindrical layer defined by its section stiffness: `stiffness: {EA_N, EI_Nm2, GJ_Nm2, + mass_kg_per_m, source}` (optional `poisson_ratio`) replaces `material` for a component whose + properties come from a datasheet. It adds its `EA` to the axial stiffness and the load + sharing, its `EI` to the stick and slip bending stiffness, its `GJ` to the torsional stiffness + and its mass to the section; the radii place it in the bounded contact chain. A stand-in + material, an isotropic solid filling the annulus (`E = EA/A`, `EI/I`, `m/A`, Poisson ratio + 0.3 unless given, no thermal expansion), serves the calculations that read a material. The + coupled radial models refuse the layer. A stiffness block that repeats a material layer's + values reproduces its stiffness, mass and fatigue damage to round-off. - A serving layer: `construction: serving` on a `cylindrical` layer declares a served yarn or a wound tape. It keeps its mass, its radial and hoop stiffness (an annulus of its material in plane stress along the cable axis, in the concentric and the meshed three-core radial diff --git a/doc/file_formats.md b/doc/file_formats.md index da9e73a..eaf315b 100644 --- a/doc/file_formats.md +++ b/doc/file_formats.md @@ -93,7 +93,7 @@ them filled. | --- | --- | --- | | `helical` (armour wires) | `n_wires`, `d_wire_m`, `r_helix_m`, `lay_angle_deg` | `lay_direction` (`right_hand` default, `left_hand`), `manufacturing_clamping`, `bulk_sn`, `fretting_sn`, `transverse_slip_fraction`; flat or profiled wires: `wire_shape` (`round` default, `rectangular`, `profiled`), `wire_width_m`, `wire_thickness_m`, `wire_corner_radius_m`, `wire_area_m2`, `wire_I_normal_m4`, `wire_I_lateral_m4`, `wire_J_m4` | | `helical_stranded` (strand within conductor within cable) | `n_conductors`, `r_cable_m`, `lay_angle_cable_deg`, `n_strands`, `r_strand_m`, `d_strand_m`, `lay_angle_strand_deg` | `bulk_sn`, `fretting_sn` | -| `cylindrical` (polymer annulus, bedding, filler, sheath, serving) | `r_inner_m`, `r_outer_m` | `tape` (helical tape winding), `strain_life`, `extrusion_shrinkage`, `construction` (`serving`) | +| `cylindrical` (polymer annulus, bedding, filler, sheath, serving) | `r_inner_m`, `r_outer_m` | `tape` (helical tape winding), `strain_life`, `extrusion_shrinkage`, `construction` (`serving`), `stiffness` (instead of `material`) | | `cylindrical_offset` (core component: conductor, insulation, screen) | `r_offset_m`, `r_inner_m`, `r_outer_m` | `n_cores` (default 3), `conductor_area_mm2`, `strand_layers`, `n_strands`, `strand_diameter_mm`, `strand_lay_angle_deg`, `construction`, `electrical`, `bulk_sn`, `fretting_sn`, `strain_life`, `outer_face_pressure`, `tape` | | `cylindrical_shell` (lead or corrugated aluminium sheath) | `r_mid_m`, `t_m` | `f_corrugation` (default 1), `scf` (default 1), `construction` (`bonded_laminate`), `bulk_sn`, `fretting_sn`, `strain_life` | @@ -111,6 +111,39 @@ marked `kinematic`. A serving is non-structural and is never an interstitial filler. Without `construction` a `cylindrical` layer is a solid annulus, as before. +A `cylindrical` layer whose properties come from a datasheet is defined by its +section stiffness instead of a material: + +```yaml + - name: datasheet_unit + layer_type: cylindrical + r_inner_m: 0.0 + r_outer_m: 0.012 + stiffness: + EA_N: 2.4e6 # axial stiffness [N] + EI_Nm2: 4.1 # bending stiffness [N m2] + GJ_Nm2: 3.2 # torsional stiffness [N m2] + mass_kg_per_m: 0.21 + poisson_ratio: 0.35 # optional; default 0.3 (model assumption) + source: "manufacturer datasheet, rev. B" +``` + +The layer adds `EA_N` to the axial stiffness and the load sharing, `EI_Nm2` +to the bending stiffness (stick and slip; a concentric layer has no +parallel-axis term) and `GJ_Nm2` to the torsional stiffness, and +`mass_kg_per_m` to the mass. It takes no `material` key: the cable supplies a +stand-in material `" (stiffness)"`, an isotropic solid filling the +annulus (`E = EA/A`, bending modulus `EI/I`, density `m/A`, the Poisson ratio +above, no thermal expansion), for the calculations that read a material: the +shear support of the armour in the finite-support no-slip coefficient, the +hoop restraint of the armour buckling screen and the component stress, which +is that of the stand-in and has no limit. The radii place the layer in the +bounded contact chain. The coupled radial models (`contact_model="qp"`, +`"solved"`, coiling, the solved torque balance) refuse the layer, which has +no radial law, and thermal analyses need the material properties it lacks. +The layer is structural and cannot be a serving or carry a tape winding or an +extrusion shrinkage. + `lay_angle_deg` lies between −90° and 90°. A rectangular or profiled wire fills in `d_wire_m` as the diameter of the round wire of the same area. A given value must agree with it, and a layer whose wires overfill the diff --git a/src/cablexsec/cables/schema.py b/src/cablexsec/cables/schema.py index c941a93..812f881 100644 --- a/src/cablexsec/cables/schema.py +++ b/src/cablexsec/cables/schema.py @@ -96,6 +96,7 @@ "HelicalStrandedLayer", "InitialStateProperties", "Layer", + "LayerStiffness", "ManufacturingClamping", "MaterialValue", "PressureIdentification", @@ -936,9 +937,56 @@ def _documented(self) -> ExtrusionShrinkage: return self +#: Poisson ratio of a stiffness-defined layer whose ``stiffness`` block gives +#: none: the stand-in of an isotropic solid (a model assumption). +STIFFNESS_LAYER_POISSON = 0.3 + + +class LayerStiffness(_Frozen): + """Section stiffness of a cylindrical layer from a datasheet. + + ``EA_N`` axial, ``EI_Nm2`` bending and ``GJ_Nm2`` torsional stiffness of + the layer about its own (the cable) axis, ``mass_kg_per_m`` its mass per + length; ``source`` names the datasheet. ``poisson_ratio`` (optional) sets + the Poisson ratio of the isotropic stand-in that a calculation needing a + material modulus uses (default :data:`STIFFNESS_LAYER_POISSON`). + """ + + EA_N: float + EI_Nm2: float + GJ_Nm2: float + mass_kg_per_m: float + source: str + poisson_ratio: float | None = None + notes: str = "" + + @model_validator(mode="after") + def _stiffness_values(self) -> LayerStiffness: + for name in ("EA_N", "EI_Nm2", "mass_kg_per_m"): + if not getattr(self, name) > 0.0: + raise ValueError(f"stiffness {name} must be > 0") + if not self.GJ_Nm2 >= 0.0: + raise ValueError("stiffness GJ_Nm2 must be >= 0") + if self.poisson_ratio is not None and not 0.0 <= self.poisson_ratio < 0.5: + raise ValueError("stiffness poisson_ratio must lie in [0, 0.5)") + if not self.source.strip(): + raise ValueError("a stiffness-defined layer needs a source") + return self + + +def stiffness_material_name(layer_name: str) -> str: + """Material key of the stand-in material of a stiffness-defined layer.""" + return f"{layer_name} (stiffness)" + + class CylindricalLayer(_LayerBase): """Solid annular layer (bedding, filler, polymer sheath) or a serving. + ``stiffness`` (:class:`LayerStiffness`) defines the layer by its section + stiffness instead of a material: a component whose properties come from a + datasheet. Its ``material`` is then a stand-in that the cable supplies + (:func:`stiffness_material_name`). + ``construction: serving`` declares a served yarn or a wound tape. The layer keeps its mass, its radial and hoop stiffness (an annulus in plane stress along the cable axis, so it transmits contact pressure) and its @@ -958,6 +1006,23 @@ class CylindricalLayer(_LayerBase): # "" (extruded or solid annulus) or "serving" (yarn or tape serving: # radial and hoop stiffness only). construction: Literal["", "serving"] = "" + # Section stiffness from a datasheet instead of a material. + stiffness: LayerStiffness | None = None + + @model_validator(mode="before") + @classmethod + def _stiffness_material(cls, data: Any) -> Any: + """A stiffness-defined layer takes the stand-in material of its name.""" + if not isinstance(data, Mapping) or data.get("stiffness") is None: + return data + expected = stiffness_material_name(str(data.get("name", ""))) + given = data.get("material") + if given not in (None, "", expected): + raise ValueError( + "a stiffness-defined layer takes no material; omit 'material' " + "(its stand-in is named after the layer)" + ) + return {**data, "material": expected} @model_validator(mode="before") @classmethod @@ -1001,6 +1066,21 @@ def _annulus_physical_values(self) -> CylindricalLayer: raise ValueError( "a serving is wound, not extruded: it has no extrusion_shrinkage" ) + if self.stiffness is not None: + if self.is_serving or not self.structural: + raise ValueError( + "a stiffness-defined layer carries its stiffness: it cannot " + "be a serving or non-structural" + ) + if ( + self.tape is not None + or self.strain_life + or self.extrusion_shrinkage is not None + ): + raise ValueError( + "a stiffness-defined layer has no material for a tape " + "winding, strain-life constants or an extrusion shrinkage" + ) return self @@ -1009,6 +1089,11 @@ def is_serving(layer: object) -> bool: return isinstance(layer, CylindricalLayer) and layer.is_serving +def layer_stiffness(layer: object) -> LayerStiffness | None: + """The datasheet stiffness of a stiffness-defined layer (else ``None``).""" + return layer.stiffness if isinstance(layer, CylindricalLayer) else None + + class CoreStrandRing(_Frozen): """One uniform wire ring about a power-core axis, or its straight centre. @@ -1335,6 +1420,48 @@ def yaml_body(self) -> dict[str, Any]: return self.model_dump(mode="json", exclude={"name"}, exclude_defaults=True) +def stiffness_material(layer: CylindricalLayer) -> CableMaterial | None: + """The stand-in material of a stiffness-defined layer (``None`` otherwise). + + An isotropic solid filling the annulus with the datasheet's axial + stiffness and mass: ``E = EA / A``, ``E_eff_bending = EI / I``, density + ``m / A``, Poisson ratio from the block (default + :data:`STIFFNESS_LAYER_POISSON`) and no thermal expansion. It serves the + calculations that read a material (mass, stress recovery, the shear + support of the armour, the hoop restraint of the buckling screen); the + section stiffness itself is taken from the block. ``None`` also while + the radii are withheld. + """ + block = layer.stiffness + if block is None or layer.r_inner_m is None or layer.r_outer_m is None: + return None + ri, ro = layer.r_inner_m, layer.r_outer_m + area = math.pi * (ro**2 - ri**2) + inertia = math.pi * (ro**4 - ri**4) / 4.0 + source = f"stiffness of layer {layer.name!r}: {block.source}" + + def value(number: float, how: str) -> MaterialValue: + return MaterialValue(value=number, source=f"{how} ({source})") + + nu = block.poisson_ratio + return CableMaterial( + name=layer.material, + description=f"stand-in of the stiffness-defined layer {layer.name!r}", + E_Pa=value(block.EA_N / area, "EA over the annulus area"), + E_eff_bending_Pa=value(block.EI_Nm2 / inertia, "EI over the annulus inertia"), + nu=MaterialValue( + value=STIFFNESS_LAYER_POISSON if nu is None else nu, + source="model assumption (isotropic stand-in)" + if nu is None + else f"stiffness block ({source})", + ), + rho_kg_m3=value(block.mass_kg_per_m / area, "mass over the annulus area"), + alpha_T_K=MaterialValue( + value=0.0, source="model assumption: no thermal expansion given" + ), + ) + + @lru_cache(maxsize=64) def material_overlay( materials: tuple[CableMaterial, ...], @@ -1685,10 +1812,24 @@ def _unique_layer_names(self) -> CableData: if len(names) != len(set(names)): raise ValueError("layer names must be unique within a cable") keys = [material.name for material in self.materials] + keys += [material.name for material in self.stiffness_materials] if len(keys) != len(set(keys)): - raise ValueError("material names must be unique within a cable") + raise ValueError( + "material names must be unique within a cable (a stiffness-defined " + "layer reserves the key ' (stiffness)')" + ) return self + @property + def stiffness_materials(self) -> tuple[CableMaterial, ...]: + """Stand-in materials of the stiffness-defined layers.""" + return tuple( + material + for layer in self.layers + if isinstance(layer, CylindricalLayer) + and (material := stiffness_material(layer)) is not None + ) + @model_validator(mode="after") def _radially_ordered(self) -> CableData: _check_radial_order(self.layers) @@ -1720,11 +1861,13 @@ def material_scope(self) -> AbstractContextManager[None]: the library alone answer, also inside the scope of another cable. The scope is local to the current thread (and task). """ - return library.material_scope(material_overlay(self.materials)) + return library.material_scope( + material_overlay(self.materials + self.stiffness_materials) + ) def get_material(self, name: str) -> CableMaterial: - """Return the cable material ``name``.""" - for material in self.materials: + """Return the cable material ``name`` (or a stiffness-defined stand-in).""" + for material in self.materials + self.stiffness_materials: if material.name == name: return material raise CableLookupError( diff --git a/src/cablexsec/mechanics/contact_qp.py b/src/cablexsec/mechanics/contact_qp.py index 926e719..400cc7e 100644 --- a/src/cablexsec/mechanics/contact_qp.py +++ b/src/cablexsec/mechanics/contact_qp.py @@ -31,6 +31,7 @@ CylindricalShellLayer, HelicalLayer, is_serving, + layer_stiffness, ) from cablexsec.exceptions import CableSchemaError from cablexsec.materials import library @@ -145,6 +146,13 @@ def _concentric_layers( initial_wire_strain: Mapping[str, float] | None = None, ) -> list[ElasticAnnulus | ElasticHelicalRing]: """Translate every layer or raise; no silent geometrical homogenisation.""" + stiff = [x.name for x in cable.layers if layer_stiffness(x) is not None] + if stiff: + raise CableSchemaError( + f"{stiff[0]}: a stiffness-defined layer has no radial constitutive law; " + "the coupled radial models ('qp', 'solved') need a material; use the " + "bounded contact model" + ) result: list[ElasticAnnulus | ElasticHelicalRing] = [] for layer in cable.layers: if isinstance(layer, CylindricalOffsetLayer) and ( diff --git a/src/cablexsec/mechanics/radial_cable.py b/src/cablexsec/mechanics/radial_cable.py index 148ffc8..3badc4c 100644 --- a/src/cablexsec/mechanics/radial_cable.py +++ b/src/cablexsec/mechanics/radial_cable.py @@ -60,6 +60,7 @@ CylindricalShellLayer, HelicalLayer, is_serving, + layer_stiffness, ) from cablexsec.exceptions import CableInputError, CableSchemaError from cablexsec.materials import library @@ -290,6 +291,13 @@ def build_radial_section( """ if cable.missing_fields(): raise CableSchemaError("radial solution requires complete geometry") + stiff = [x.name for x in cable.layers if layer_stiffness(x) is not None] + if stiff: + raise CableSchemaError( + f"{stiff[0]}: a stiffness-defined layer has no radial constitutive law; " + "the coupled radial models ('qp', 'solved') need a material; use the " + "bounded contact model" + ) if filler not in {"auto", "solid", "void"}: raise CableSchemaError("filler must be 'auto', 'solid' or 'void'") if loose_layers not in {"declared", "neighbour"}: diff --git a/src/cablexsec/mechanics/stiffness.py b/src/cablexsec/mechanics/stiffness.py index 75060b4..f690a48 100644 --- a/src/cablexsec/mechanics/stiffness.py +++ b/src/cablexsec/mechanics/stiffness.py @@ -16,7 +16,9 @@ K_et += s n_w E_w A_w r_h cos^2(alpha) sin(alpha) (axial-twist coupling) K_tt += n_w E_w A_w r_h^2 cos(alpha) sin^2(alpha) (twist) -(cylindrical layers add ``E A`` to ``K_ee`` only). With both ends rotationally +(cylindrical layers add ``E A`` to ``K_ee`` only; a stiffness-defined layer +adds its datasheet ``E A`` to ``K_ee`` and its ``G J`` to ``K_tt``, the +measured torsion of that component). With both ends rotationally fixed the twist is constrained, so ``EA_fixed = K_ee``; with one end free the twist relaxes and the Schur complement applies, ``EA_free = K_ee - K_et^2 / K_tt`` ([WitzTan1992a]). @@ -51,6 +53,7 @@ CylindricalShellLayer, HelicalLayer, is_serving, + layer_stiffness, ) from cablexsec.exceptions import CableInputError from cablexsec.materials import library @@ -191,6 +194,9 @@ def axial_torsional_matrix( base = lyr.n_wires * e_w * a_w k_et += s * base * r * math.cos(a) ** 2 * math.sin(a) k_tt += base * r**2 * math.cos(a) * math.sin(a) ** 2 + block = layer_stiffness(lyr) + if block is not None and lyr.name in axial: + k_tt += block.GJ_Nm2 return AxialTorsional(K_ee=k_ee, K_et=k_et, K_tt=k_tt) @@ -229,6 +235,9 @@ def _axial_EA_contribution( """ if is_serving(layer): return 0.0 + block = layer_stiffness(layer) + if block is not None: + return block.EA_N if not layer.structural: if isinstance(layer, CylindricalLayer): # interstitial filler area = ( @@ -346,12 +355,16 @@ def _individual_bending_by_layer( ei += lyr.n_cores * _layer_bending_modulus(lyr) * i_core ei *= bending_factor(core_angle(cable, lyr)) elif isinstance(lyr, CylindricalLayer): - if not _has_modulus(lyr.material): + block = layer_stiffness(lyr) + if block is not None: + ei = block.EI_Nm2 + elif not _has_modulus(lyr.material): continue - ro = lyr.r_outer_m or 0.0 - ri = lyr.r_inner_m or 0.0 - i_ann = math.pi * (ro**4 - ri**4) / 4.0 - ei += _layer_bending_modulus(lyr) * i_ann + else: + ro = lyr.r_outer_m or 0.0 + ri = lyr.r_inner_m or 0.0 + i_ann = math.pi * (ro**4 - ri**4) / 4.0 + ei += _layer_bending_modulus(lyr) * i_ann elif isinstance(lyr, CylindricalShellLayer): # Use the same effective thin-wall law as shell stress recovery. # The corrugation SCF amplifies local stress, not section rigidity. diff --git a/tests/test_stiffness_defined_layer.py b/tests/test_stiffness_defined_layer.py new file mode 100644 index 0000000..ad0d7ea --- /dev/null +++ b/tests/test_stiffness_defined_layer.py @@ -0,0 +1,172 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University +"""A cylindrical layer defined by its datasheet stiffness instead of a material. + +A layer whose ``stiffness`` block repeats the ``E A``, ``E I``, mass and +Poisson ratio of a material layer must reproduce that layer's results to +round-off on the fixed-radius and bounded routes; its ``G J`` adds to the +torsional stiffness; the coupled radial models refuse it. +""" + +from __future__ import annotations + +import math +import warnings +from pathlib import Path + +import numpy as np +import pytest +import yaml +from pydantic import ValidationError + +import cablexsec as cx +from cablexsec.cables.schema import ( + STIFFNESS_LAYER_POISSON, + CylindricalLayer, + layer_stiffness, + stiffness_material_name, +) +from cablexsec.exceptions import CableSchemaError +from cablexsec.materials import library + +NAME = "hdpe_bedding" + + +@pytest.fixture(scope="module") +def base() -> cx.CableData: + return cx.load_cable(cx.inter_array_single_core_yaml_path()) + + +def _block(base: cx.CableData, *, poisson: bool = True, gj: float = 0.0) -> dict: + layer = base.get_layer(NAME) + assert isinstance(layer, CylindricalLayer) + ri, ro = float(layer.r_inner_m or 0), float(layer.r_outer_m or 0) + area = math.pi * (ro**2 - ri**2) + with base.material_scope(): + e = library.get_property(layer.material, "E_Pa") + rho = library.get_property(layer.material, "rho_kg_m3") + nu = library.get_property(layer.material, "nu") + block = { + "EA_N": e * area, + "EI_Nm2": e * math.pi * (ro**4 - ri**4) / 4, + "GJ_Nm2": gj, + "mass_kg_per_m": rho * area, + "source": "test datasheet", + } + if poisson: + block["poisson_ratio"] = nu + return block + + +def _with_block(base: cx.CableData, block: dict) -> cx.CableData: + data = base.model_dump(mode="json") + for layer in data["layers"]: + if layer["name"] == NAME: + layer.pop("material") + layer["stiffness"] = block + return cx.CableData.model_validate(data) + + +def test_matches_the_material_layer(base) -> None: + cable = _with_block(base, _block(base)) + layer = cable.get_layer(NAME) + assert layer.material == stiffness_material_name(NAME) + assert layer_stiffness(layer) is not None + for a, b in ((base, base), (base, cable)): + sa, sb = cx.compute_stiffness(a), cx.compute_stiffness(b) + for name in ("ea_fixed_N", "ea_free_N", "ei_min_Nm2", "ei_max_Nm2", "gj_Nm2"): + assert getattr(sa, name) == pytest.approx(getattr(sb, name), rel=1e-13) + assert cx.compute_mass_properties(cable).mass_kg_per_m == pytest.approx( + cx.compute_mass_properties(base).mass_kg_per_m, rel=1e-14 + ) + t = np.linspace(0.0, 20.0, 400) + kx = 0.01 * np.sin(t) + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + damage = [ + cx.compute_fatigue( + c, + kx, + 0.3 * kx, + tension_N=np.full_like(kx, 5.0e4), + friction_model="direction_tied", + n_fibres=4, + ) + for c in (base, cable) + ] + for name, values in damage[0].D_total_per_wire.items(): + np.testing.assert_allclose(values, damage[1].D_total_per_wire[name], rtol=1e-10) + + +def test_gj_adds_to_the_torsional_stiffness(base) -> None: + plain = cx.compute_stiffness(_with_block(base, _block(base))) + torsion = cx.compute_stiffness(_with_block(base, _block(base, gj=150.0))) + assert torsion.gj_Nm2 - plain.gj_Nm2 == pytest.approx(150.0, rel=1e-12) + assert torsion.ea_fixed_N == plain.ea_fixed_N + assert torsion.ei_min_Nm2 == plain.ei_min_Nm2 + + +def test_stand_in_material(base) -> None: + cable = _with_block(base, _block(base, poisson=False)) + material = cable.get_material(stiffness_material_name(NAME)) + layer = cable.get_layer(NAME) + assert isinstance(layer, CylindricalLayer) + ri, ro = float(layer.r_inner_m or 0), float(layer.r_outer_m or 0) + block = _block(base) + assert material.E_Pa is not None and material.E_eff_bending_Pa is not None + assert material.E_Pa.value == pytest.approx( + block["EA_N"] / (math.pi * (ro**2 - ri**2)), rel=1e-14 + ) + assert material.nu is not None and material.nu.value == STIFFNESS_LAYER_POISSON + assert "model assumption" in material.nu.source + assert material.alpha_T_K is not None and material.alpha_T_K.value == 0.0 + assert cable.materials == base.materials # nothing is added to the YAML block + + +def test_yaml_round_trip(base, tmp_path: Path) -> None: + cable = _with_block(base, _block(base, gj=10.0)) + path = tmp_path / "cable.yaml" + path.write_text(yaml.safe_dump(cable.model_dump(mode="json")), encoding="utf-8") + again = cx.load_cable(str(path)) + assert again == cable + + +def test_inputs_are_checked(base) -> None: + good = { + "name": "unit", + "layer_type": "cylindrical", + "r_inner_m": 0.01, + "r_outer_m": 0.02, + "stiffness": _block(base), + } + CylindricalLayer.model_validate(good) + for change, words in ( + ({"material": "hdpe"}, "takes no material"), + ({"structural": False}, "cannot be a serving or non-structural"), + ({"construction": "serving"}, "cannot be a serving"), + ({"strain_life": "x"}, "no material for a tape"), + ( + { + "extrusion_shrinkage": { + "hoop_strain": 0.0, + "basis": "assumed", + "source": "t", + } + }, + "extrusion shrinkage", + ), + ({"stiffness": {**_block(base), "EA_N": 0.0}}, "EA_N must be > 0"), + ({"stiffness": {**_block(base), "GJ_Nm2": -1.0}}, "GJ_Nm2 must be >= 0"), + ({"stiffness": {**_block(base), "source": " "}}, "needs a source"), + ({"stiffness": {**_block(base), "poisson_ratio": 0.5}}, "poisson_ratio"), + ): + with pytest.raises(ValidationError, match=words): + CylindricalLayer.model_validate({**good, **change}) + + +def test_coupled_radial_models_refuse_it(base) -> None: + cable = _with_block(base, _block(base)) + with pytest.raises(CableSchemaError, match="stiffness-defined"): + cx.solve_section_state(cable, tension_N=1.0e5, contact_model="qp") + with pytest.raises(CableSchemaError, match="stiffness-defined"): + cx.solve_cable_radial_state(cable, 1.0e5)