metafold 0.15.dev1__py3-none-any.whl → 0.15.dev2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metafold/materials.py +18 -4
- {metafold-0.15.dev1.dist-info → metafold-0.15.dev2.dist-info}/METADATA +1 -1
- {metafold-0.15.dev1.dist-info → metafold-0.15.dev2.dist-info}/RECORD +6 -6
- {metafold-0.15.dev1.dist-info → metafold-0.15.dev2.dist-info}/WHEEL +0 -0
- {metafold-0.15.dev1.dist-info → metafold-0.15.dev2.dist-info}/licenses/LICENSE +0 -0
- {metafold-0.15.dev1.dist-info → metafold-0.15.dev2.dist-info}/top_level.txt +0 -0
metafold/materials.py
CHANGED
|
@@ -232,11 +232,14 @@ class HyperfoamTerm:
|
|
|
232
232
|
class HyperfoamParams(ParamsBase):
|
|
233
233
|
"""Ogden hyperfoam (mpmgpu only; no Uintah equivalent).
|
|
234
234
|
|
|
235
|
+
The Ogden hyperfoam model is defined entirely by its terms (bulk_modulus is
|
|
236
|
+
not used, so it is not part of this material; a legacy "bulk_modulus"/"K" is
|
|
237
|
+
ignored if present on from_dict).
|
|
238
|
+
|
|
235
239
|
An optional viscoelastic overlay (Prony series) may be supplied via
|
|
236
240
|
terminal_shear_modulus + viscoelastic_series, matching the MaxwellWeichert
|
|
237
241
|
mode structure. Omit both for a purely elastic hyperfoam.
|
|
238
242
|
"""
|
|
239
|
-
bulk_modulus: float
|
|
240
243
|
terms: List[HyperfoamTerm]
|
|
241
244
|
terminal_shear_modulus: Optional[float] = None
|
|
242
245
|
viscoelastic_series: Optional[List[ViscoelasticMode]] = None
|
|
@@ -247,7 +250,6 @@ class HyperfoamParams(ParamsBase):
|
|
|
247
250
|
|
|
248
251
|
def to_dict(self):
|
|
249
252
|
d = {
|
|
250
|
-
"bulk_modulus": float(self.bulk_modulus),
|
|
251
253
|
"terms": [t.to_dict() for t in self.terms],
|
|
252
254
|
}
|
|
253
255
|
if self.terminal_shear_modulus is not None:
|
|
@@ -258,9 +260,9 @@ class HyperfoamParams(ParamsBase):
|
|
|
258
260
|
|
|
259
261
|
@classmethod
|
|
260
262
|
def from_dict(cls, d: dict) -> "HyperfoamParams":
|
|
263
|
+
# A legacy bulk_modulus/K is ignored (older scripts may still send it).
|
|
261
264
|
series = d.get("viscoelastic_series")
|
|
262
265
|
return cls(
|
|
263
|
-
bulk_modulus=d["bulk_modulus"],
|
|
264
266
|
terms=[
|
|
265
267
|
HyperfoamTerm(
|
|
266
268
|
mu=t["mu"], alpha=t["alpha"], poisson_ratio=t["poisson_ratio"])
|
|
@@ -459,7 +461,19 @@ class Material:
|
|
|
459
461
|
]
|
|
460
462
|
PARAMS_CLASSES = {c.get_type(): c for c in params_classes}
|
|
461
463
|
cm = d["constitutive_model"]
|
|
462
|
-
|
|
464
|
+
model_type = cm.get("type")
|
|
465
|
+
if model_type not in PARAMS_CLASSES:
|
|
466
|
+
# ValueError so API callers reject with a 400, not a 500. An
|
|
467
|
+
# unknown type usually means a client newer than the server.
|
|
468
|
+
raise ValueError(
|
|
469
|
+
f"Unknown constitutive model type {model_type!r}. "
|
|
470
|
+
f"Known types: {', '.join(sorted(PARAMS_CLASSES))}.")
|
|
471
|
+
try:
|
|
472
|
+
params = PARAMS_CLASSES[model_type].from_dict(cm["params"])
|
|
473
|
+
except KeyError as e:
|
|
474
|
+
# Missing param -> ValueError (400) rather than an uncaught 500.
|
|
475
|
+
raise ValueError(
|
|
476
|
+
f"{model_type} material is missing required param {e}.")
|
|
463
477
|
return cls(
|
|
464
478
|
density=d["density"],
|
|
465
479
|
thermal_conductivity=d["thermal_conductivity"],
|
|
@@ -5,7 +5,7 @@ metafold/auth.py,sha256=O4B5vGUr2UmHbw_1BfWqZn-GWvmf_eFpZEpKGgBGrQQ,1079
|
|
|
5
5
|
metafold/client.py,sha256=ZFftCr5gbRFkrxgBK7NYspBQEQnNzj2tWCbjPqxg5gw,3714
|
|
6
6
|
metafold/exceptions.py,sha256=dJhBgbryBhJUf20FT3eU1rjQJQ-aDEZ25g-YCn_TwQk,110
|
|
7
7
|
metafold/jobs.py,sha256=y-8LknS9yAO26MEPh73z4rTrXxjZjPff-1qxpIARebM,4642
|
|
8
|
-
metafold/materials.py,sha256=
|
|
8
|
+
metafold/materials.py,sha256=gOvkO9zfnumYtL5Xi_Y-6pTPeT2r97THWx4cK_3Ze3Y,17767
|
|
9
9
|
metafold/projects.py,sha256=uZZOuXe80F53SZ5ZFpxFYhhMnfgd4SpPaFgkKTSZvTo,6384
|
|
10
10
|
metafold/utils.py,sha256=DnsW1Xr9mLpVHBNdPrdxNLLcjxSNMkWVvr7cH7UTAxY,1174
|
|
11
11
|
metafold/workflows.py,sha256=Mhv3n3ChUHw1Vaj3q8HNDbOgljn03AF6WslZfXzexsI,7802
|
|
@@ -13,8 +13,8 @@ metafold/simulation/__init__.py,sha256=tUW4PfyWnI6UFvIR__JKUD2FjNTM74fSeKuee7Ewj
|
|
|
13
13
|
metafold/simulation/compression_experiment.py,sha256=kLtX6V4vc_v2l-mJqpkE29TWE-fb6fCudOqhxv1Bz9U,18442
|
|
14
14
|
metafold/simulation/compression_simulation.py,sha256=69tJPRIXE2G_buqB50gUH2K6790skzRhDLYmc0GZ8ss,121287
|
|
15
15
|
metafold/simulation/run_experiment.py,sha256=ot507fJJra6qZLv_o1hqFoAtwmyE3iBKfhWRR9eNhD0,19930
|
|
16
|
-
metafold-0.15.
|
|
17
|
-
metafold-0.15.
|
|
18
|
-
metafold-0.15.
|
|
19
|
-
metafold-0.15.
|
|
20
|
-
metafold-0.15.
|
|
16
|
+
metafold-0.15.dev2.dist-info/licenses/LICENSE,sha256=LejZXzGwe9t0Ezk6g0bRmWUuFSI9vQSk1wJAc1NrrhE,1059
|
|
17
|
+
metafold-0.15.dev2.dist-info/METADATA,sha256=WVMmhNM44KI_IgoL6IneTSy9_izLz4uRDOq7QOKP50M,3495
|
|
18
|
+
metafold-0.15.dev2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
19
|
+
metafold-0.15.dev2.dist-info/top_level.txt,sha256=0dvwa2N6gvl2x4T9c62V4MbYD2soFedI6hm3-lWgyew,9
|
|
20
|
+
metafold-0.15.dev2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|