Cauchy Continuum Model#

Note

The legacy dataclass-based CauchyContinuumModel has been removed. The Pydantic implementation (formerly named CauchyContinuumModelNew) now carries the canonical class name. A compatibility alias named CauchyContinuumModelNew remains available during the migration window.

class sgio.model.CauchyContinuumModel(name: str = '', *, dim: int = 3, label: str = 'sd1', model_name: str = 'Cauchy continuum model', strain_name: List[str] = ['e11', 'e22', 'e33', 'e23', 'e13', 'e12'], stress_name: List[str] = ['s11', 's22', 's33', 's23', 's13', 's12'], id: int | None = None, isotropy: Literal[0, 1, 2, 3] = 0, density: Annotated[float, Ge(ge=0)] = 0, temperature: float = 0, e1: Annotated[float | None, Gt(gt=0)] = None, e2: Annotated[float | None, Gt(gt=0)] = None, e3: Annotated[float | None, Gt(gt=0)] = None, g12: Annotated[float | None, Gt(gt=0)] = None, g13: Annotated[float | None, Gt(gt=0)] = None, g23: Annotated[float | None, Gt(gt=0)] = None, nu12: float | None = None, nu13: float | None = None, nu23: float | None = None, stff: List[List[float]] | None = None, cmpl: List[List[float]] | None = None, x1t: Annotated[float | None, Ge(ge=0)] = None, x2t: Annotated[float | None, Ge(ge=0)] = None, x3t: Annotated[float | None, Ge(ge=0)] = None, x1c: Annotated[float | None, Ge(ge=0)] = None, x2c: Annotated[float | None, Ge(ge=0)] = None, x3c: Annotated[float | None, Ge(ge=0)] = None, x23: Annotated[float | None, Ge(ge=0)] = None, x13: Annotated[float | None, Ge(ge=0)] = None, x12: Annotated[float | None, Ge(ge=0)] = None, strength_measure: int = 0, strength_constants: List[float] | None = None, char_len: Annotated[float, Ge(ge=0)] = 0, cte: List[float] | None = None, specific_heat: Annotated[float, Ge(ge=0)] = 0, failure_criterion: int = 0, d_thetatheta: float = 0, f_eff: float = 0)#

Bases: BaseModel

Cauchy continuum model with Pydantic validation.

This implementation follows the beam model pattern and provides built-in validation for all material properties.

dim#

Dimension of the model (always 3 for 3D continuum)

Type:

int

label#

Model label identifier

Type:

str

model_name#

Human-readable model name

Type:

str

strain_name#

Names of strain components

Type:

List[str]

stress_name#

Names of stress components

Type:

List[str]

name#

Material name

Type:

str

id#

Material ID

Type:

Optional[int]

isotropy#

Material isotropy type: 0=Isotropic, 1=Orthotropic, 2=Anisotropic, 3=TransverseIsotropic

Type:

Literal[0, 1, 2, 3]

density#

Material density (must be >= 0)

Type:

float

temperature#

Temperature

Type:

float

e1, e2, e3

Young’s moduli in material directions 1, 2, 3 (must be > 0 if set)

Type:

Optional[float]

g12, g13, g23

Shear moduli in material planes 12, 13, 23 (must be > 0 if set)

Type:

Optional[float]

nu12, nu13, nu23

Poisson’s ratios in material planes 12, 13, 23 (must be in range (-1, 0.5))

Type:

Optional[float]

stff#

6x6 stiffness matrix

Type:

Optional[List[List[float]]]

cmpl#

6x6 compliance matrix

Type:

Optional[List[List[float]]]

x1t, x2t, x3t

Tensile strengths in directions 1, 2, 3

Type:

Optional[float]

x1c, x2c, x3c

Compressive strengths in directions 1, 2, 3

Type:

Optional[float]

x23, x13, x12

Shear strengths in planes 23, 13, 12

Type:

Optional[float]

strength_measure#

Strength measure type: 0=stress, 1=strain

Type:

int

strength_constants#

Array of strength constants

Type:

Optional[List[float]]

char_len#

Characteristic length

Type:

float

cte#

Thermal expansion coefficients (6 components)

Type:

Optional[List[float]]

specific_heat#

Specific heat capacity

Type:

float

failure_criterion#

Failure criterion identifier

Type:

int

d_thetatheta#

Thermal property

Type:

float

f_eff#

Effective property

Type:

float

attach_behavior(channel: PhysicsChannel, behavior: ConstitutiveBehaviorProtocol | None, *, properties: object | None = None) None#

Attach or override one future constitutive behavior slot.

Parameters:
  • channel (PhysicsChannel) – Target physics channel.

  • behavior (ConstitutiveBehaviorProtocol or None) – Behavior implementation to attach. None clears the behavior override while preserving any explicit auxiliary properties.

  • properties (object or None, optional) – Auxiliary channel properties to store alongside the behavior.

clear_behavior(channel: PhysicsChannel) None#

Clear one channel behavior override and auxiliary properties.

get(name: str)#

Compatibility query API retained for legacy string callers.

Parameters:

name (str) – Name of the property to retrieve

Returns:

Value of the specified property

Return type:

int or float or List

Notes

Supported property names: - density, temperature, isotropy - e, nu (isotropic shortcuts for e1, nu12) - e1, e2, e3, g12, g13, g23, nu12, nu13, nu23 - c, s (stiffness/compliance matrices) - cij, sij (matrix components, i,j=1..6) - x (shortcut for x1t) - x1t, x2t, x3t, x1c, x2c, x3c, x23, x13, x12 - strength, char_len, failure_criterion - cte, alpha, alphaij (thermal expansion) - specific_heat

get_behavior(channel: PhysicsChannel) ConstitutiveBehaviorProtocol | None#

Return one channel behavior using the merged constitutive view.

get_matrix(kind: MatrixKind) List[List[float]] | None#

Return one typed linear-elastic matrix view.

get_matrix_component(kind: MatrixKind, component: TensorComponent) float | None#

Return one typed material matrix component.

get_thermal_expansion(component: TensorComponent | None = None) List[float] | float | None#

Return thermal expansion data in typed form.

model_post_init(context: Any, /) None#

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

set(name: str, value, **kwargs)#

Compatibility setter retained for legacy string callers.

Parameters:
  • name (str) – Name of the property to set

  • value (str or int or float or List) – Value to set

  • **kwargs – Additional keyword arguments (e.g., input_type for elastic)

setElastic(consts: Sequence[float] | Sequence[Sequence[float]], input_type: ElasticInputType | str | int = ElasticInputType.AUTO, **kwargs)#

Compatibility wrapper for the legacy elastic setter.

set_elastic(consts: Sequence[float] | Sequence[Sequence[float]], input_type: ElasticInputType | str | int = ElasticInputType.AUTO, **kwargs) None#

Typed main API for updating elastic properties.

set_isotropy(value: str | int) None#

Set isotropy using the typed main API.

set_strength_constants(values: Iterable[float]) None#

Set the grouped strength constants using the typed main API.

classmethod validate_6x6_matrix(v)#

Validate that stiffness/compliance matrices are 6x6.

classmethod validate_cte(v)#

Validate that CTE has 6 components if provided.

classmethod validate_poisson_ratio(v)#

Validate that Poisson’s ratios are in valid range.

write_to_json(file_path: str, *, exclude_none: bool = True, indent: int | None = None) None#

Write the material model to a JSON file.

Parameters:
  • file_path (str) – Path to the JSON file where the material will be saved

  • exclude_none (bool, optional) – Whether to exclude None values from the JSON output. Defaults to True.

  • indent (Optional[int], optional) – Number of spaces for JSON indentation. If None, compact JSON is written. Defaults to None.

Raises:
  • OSError – If the file cannot be written

  • ValueError – If the file path is invalid

Examples

>>> mat = CauchyContinuumModel(name="Steel", isotropy=0, e=200e9, nu=0.3, density=7850)
>>> mat.write_to_json("steel.json")
>>> mat.write_to_json("steel_pretty.json", indent=2)
property constitutive_channels: MaterialBehaviorMap#

Merged constitutive behavior map for current and future channels.

Returns:

Per-channel behavior slots. Current linear elasticity populates the default mechanical slot, thermal properties populate the thermal auxiliary slot, and future custom behaviors can override any slot.

Return type:

MaterialBehaviorMap

property definition: MaterialDefinition#

Grouped view of material identity and inertial metadata.

property e: float | None#

Legacy alias for the isotropic Young’s modulus.

property elastic: LinearElasticBehavior#

Grouped view of the linear-elastic behavior payload.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

property nu: float | None#

Legacy alias for the isotropic Poisson ratio.

property strength: StrengthProperties#

Grouped view of strength and failure properties.

property thermal: ThermalProperties#

Grouped view of thermal properties.