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

get(name: str)#

Get material properties (backward compatibility with old API).

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

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

Set material properties (backward compatibility with old API).

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: str = '', **kwargs)#

Set elastic properties based on isotropy type.

Parameters:
  • consts (Iterable) – Elastic constants (format depends on isotropy and input_type)

  • input_type (str, optional) – Type of input: - ‘isotropic’ or default for isotropy=0: [E, nu] (2 values) - ‘transverse_isotropic’ or ‘transverse’ for isotropy=3: [E1, E2, G12, nu12, nu23] (5 values) - ‘lamina’ for isotropy=1: [E1, E2, G12, nu12] (4 values) - ‘engineering’ or ‘orthotropic’ or default for isotropy=1: 9 values - ‘anisotropic’ or ‘constants’ for isotropy=2: 21 values (upper triangle) - ‘stiffness’ for isotropy=2: full 6x6 matrix - ‘compliance’ for isotropy=2: full 6x6 compliance matrix

  • **kwargs – Additional keyword arguments

Notes

For anisotropic materials (isotropy=2), the 21 constants represent the upper triangle of the symmetric 6x6 stiffness matrix in the following order: C11, C12, C13, C14, C15, C16, C22, C23, C24, C25, C26, C33, C34, C35, C36, C44, C45, C46, C55, C56, C66

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 e: float | None#

Legacy alias for the isotropic Young’s modulus.

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.