|
34 | 34 | "import termtables as tt\n",
|
35 | 35 | "from pypardiso import spsolve\n",
|
36 | 36 | "\n",
|
37 |
| - "import fiberreinforcedrubber as frr" |
| 37 | + "import fiberreinforcedrubber as frr\n", |
| 38 | + "\n", |
| 39 | + "frr.__version__" |
38 | 40 | ]
|
39 | 41 | },
|
40 | 42 | {
|
|
190 | 192 | " color=\"lightgrey\",\n",
|
191 | 193 | " line_width=4,\n",
|
192 | 194 | ")\n",
|
193 |
| - "plotter.camera.tight()\n", |
194 |
| - "# plotter.add_axes(label_size=(0.06, 0.06), viewport=(-0.1, -0.1, 0.2, 0.2))\n", |
195 |
| - "# plotter.camera.zoom(0.8)\n", |
196 |
| - "plotter.show(\"test_specimen_mesh_rubber.png\", scale=2, jupyter_backend=\"static)" |
| 195 | + "plotter.show(jupyter_backend=\"static\")" |
| 196 | + ] |
| 197 | + }, |
| 198 | + { |
| 199 | + "cell_type": "markdown", |
| 200 | + "id": "670ebca4-0b05-4f49-bc8d-d7ca94bce291", |
| 201 | + "metadata": {}, |
| 202 | + "source": [ |
| 203 | + "View the fiber mesh" |
| 204 | + ] |
| 205 | + }, |
| 206 | + { |
| 207 | + "cell_type": "code", |
| 208 | + "execution_count": null, |
| 209 | + "id": "740d2142-5096-42cc-bf4f-8c022e513ac4", |
| 210 | + "metadata": {}, |
| 211 | + "outputs": [], |
| 212 | + "source": [ |
| 213 | + "view = fem.ViewMesh(fem.mesh.concatenate([fibers_1, fibers_2]))\n", |
| 214 | + "plotter = view.plot(\n", |
| 215 | + " notebook=True,\n", |
| 216 | + " theme=\"document\",\n", |
| 217 | + " add_axes=False,\n", |
| 218 | + " color=\"black\",\n", |
| 219 | + " line_width=4,\n", |
| 220 | + ")\n", |
| 221 | + "plotter.show(jupyter_backend=\"static\")" |
| 222 | + ] |
| 223 | + }, |
| 224 | + { |
| 225 | + "cell_type": "markdown", |
| 226 | + "id": "4de0761b-1584-4f30-a44d-ab917885d153", |
| 227 | + "metadata": {}, |
| 228 | + "source": [ |
| 229 | + "Create a numeric region and a displacement field" |
| 230 | + ] |
| 231 | + }, |
| 232 | + { |
| 233 | + "cell_type": "code", |
| 234 | + "execution_count": null, |
| 235 | + "id": "e664a84b-d735-453d-81ec-163e6391eb2f", |
| 236 | + "metadata": {}, |
| 237 | + "outputs": [], |
| 238 | + "source": [ |
| 239 | + "region = fem.RegionQuad(mesh)\n", |
| 240 | + "field = fem.FieldContainer([fem.Field(region, dim=2)])" |
| 241 | + ] |
| 242 | + }, |
| 243 | + { |
| 244 | + "cell_type": "markdown", |
| 245 | + "id": "37925fc3-01de-4167-a71c-2190d00e3f21", |
| 246 | + "metadata": {}, |
| 247 | + "source": [ |
| 248 | + "Setup boundary conditions" |
| 249 | + ] |
| 250 | + }, |
| 251 | + { |
| 252 | + "cell_type": "code", |
| 253 | + "execution_count": null, |
| 254 | + "id": "23e14ba6-d67b-4ed5-b711-222f9d8cd04a", |
| 255 | + "metadata": {}, |
| 256 | + "outputs": [], |
| 257 | + "source": [ |
| 258 | + "bounds, loadcase = fem.dof.shear(field)" |
| 259 | + ] |
| 260 | + }, |
| 261 | + { |
| 262 | + "cell_type": "markdown", |
| 263 | + "id": "a69ceeea-5075-41e0-9ae3-2f57af29c813", |
| 264 | + "metadata": {}, |
| 265 | + "source": [ |
| 266 | + "Constitutive material behavior for rubber and cord" |
| 267 | + ] |
| 268 | + }, |
| 269 | + { |
| 270 | + "cell_type": "code", |
| 271 | + "execution_count": null, |
| 272 | + "id": "ca660c8b-1575-43a3-a968-3e08edcd1acb", |
| 273 | + "metadata": {}, |
| 274 | + "outputs": [], |
| 275 | + "source": [ |
| 276 | + "neohooke, fibermat1, fibermat2, vector1, vector2 = frr.fiber_reinforced_rubber(\n", |
| 277 | + " C10=C10,\n", |
| 278 | + " fiber_angle=fiber_angle,\n", |
| 279 | + " fiber_modulus=fiber_modulus,\n", |
| 280 | + " fiber_area=fiber_area,\n", |
| 281 | + " thickness=thickness,\n", |
| 282 | + " strain_exponent=strain_exponent,\n", |
| 283 | + " axis=fiber_axis,\n", |
| 284 | + " fiber_distance=fiber_distance,\n", |
| 285 | + ")" |
| 286 | + ] |
| 287 | + }, |
| 288 | + { |
| 289 | + "cell_type": "markdown", |
| 290 | + "id": "fe4f68c0-8845-4426-8a00-2b8d43f1acc4", |
| 291 | + "metadata": {}, |
| 292 | + "source": [ |
| 293 | + "Solid bodies" |
| 294 | + ] |
| 295 | + }, |
| 296 | + { |
| 297 | + "cell_type": "code", |
| 298 | + "execution_count": null, |
| 299 | + "id": "32f27770-e91e-4e88-b72c-3caf3242dbaa", |
| 300 | + "metadata": {}, |
| 301 | + "outputs": [], |
| 302 | + "source": [ |
| 303 | + "rubber = fem.SolidBody(neohooke, field)\n", |
| 304 | + "fiber1 = fem.SolidBody(fibermat1, field)\n", |
| 305 | + "fiber2 = fem.SolidBody(fibermat2, field)" |
| 306 | + ] |
| 307 | + }, |
| 308 | + { |
| 309 | + "cell_type": "markdown", |
| 310 | + "id": "7c61f1c5-2907-4298-baf4-b1c8ccd1e6f1", |
| 311 | + "metadata": {}, |
| 312 | + "source": [ |
| 313 | + "Tension and shear at V = 3 mm (Fy = 3 kN)" |
| 314 | + ] |
| 315 | + }, |
| 316 | + { |
| 317 | + "cell_type": "code", |
| 318 | + "execution_count": null, |
| 319 | + "id": "99534f23-7d1d-4618-a9fe-c680a53be7d0", |
| 320 | + "metadata": {}, |
| 321 | + "outputs": [], |
| 322 | + "source": [ |
| 323 | + "fiber_forces = [[], []]\n", |
| 324 | + "\n", |
| 325 | + "\n", |
| 326 | + "def evaluate_fiber_forces(i, j, substep):\n", |
| 327 | + " field = substep.x\n", |
| 328 | + "\n", |
| 329 | + " # get fiber normal forces per undeformed (fiber) area\n", |
| 330 | + " force1 = frr.fiber_force(fiber1, thickness, fiber_area, vector1)\n", |
| 331 | + " force2 = frr.fiber_force(fiber2, thickness, fiber_area, vector2)\n", |
| 332 | + "\n", |
| 333 | + " # interpolate fiber forces to the line-meshes of the fiber families\n", |
| 334 | + " r_1 = frr.interpolate(mesh, force1, fibers_1, mask_points_1)\n", |
| 335 | + " r_2 = frr.interpolate(mesh, force2, fibers_2, mask_points_2)\n", |
| 336 | + "\n", |
| 337 | + " fiber_forces[0].append(r_1)\n", |
| 338 | + " fiber_forces[1].append(r_2)\n", |
| 339 | + "\n", |
| 340 | + "\n", |
| 341 | + "step = fem.Step(\n", |
| 342 | + " items=[rubber, fiber1, fiber2],\n", |
| 343 | + " boundaries=bounds,\n", |
| 344 | + " ramp={\n", |
| 345 | + " bounds[\"compression_top\"]: fem.math.linsteps([3, 3], num=2),\n", |
| 346 | + " bounds[\"move\"]: lateral_max * fem.math.linsteps([-1, 1], num=2),\n", |
| 347 | + " },\n", |
| 348 | + ")\n", |
| 349 | + "job = fem.Job(steps=[step], callback=evaluate_fiber_forces)\n", |
| 350 | + "job.evaluate(solver=spsolve, tol=1e-2)" |
| 351 | + ] |
| 352 | + }, |
| 353 | + { |
| 354 | + "cell_type": "markdown", |
| 355 | + "id": "4e5f97fb-d1e8-4a0f-a255-41e740949500", |
| 356 | + "metadata": {}, |
| 357 | + "source": [ |
| 358 | + "Interpolate displacements to the line-meshes of the fiber families" |
| 359 | + ] |
| 360 | + }, |
| 361 | + { |
| 362 | + "cell_type": "code", |
| 363 | + "execution_count": null, |
| 364 | + "id": "29bcfb45-c182-4839-b0ec-3afa8663ba73", |
| 365 | + "metadata": {}, |
| 366 | + "outputs": [], |
| 367 | + "source": [ |
| 368 | + "u_1 = frr.interpolate(mesh, field[0].values, fibers_1, mask_points_1)\n", |
| 369 | + "u_2 = frr.interpolate(mesh, field[0].values, fibers_2, mask_points_2)" |
| 370 | + ] |
| 371 | + }, |
| 372 | + { |
| 373 | + "cell_type": "markdown", |
| 374 | + "id": "28589f7c-ee4b-4754-92f9-6b9a56f4996a", |
| 375 | + "metadata": {}, |
| 376 | + "source": [ |
| 377 | + "Deformed line mesh for the fibers" |
| 378 | + ] |
| 379 | + }, |
| 380 | + { |
| 381 | + "cell_type": "code", |
| 382 | + "execution_count": null, |
| 383 | + "id": "f1ce9d7c-98b0-43c4-9deb-616495afb20c", |
| 384 | + "metadata": {}, |
| 385 | + "outputs": [], |
| 386 | + "source": [ |
| 387 | + "fibers_1.points += u_1\n", |
| 388 | + "fibers_2.points += u_2" |
| 389 | + ] |
| 390 | + }, |
| 391 | + { |
| 392 | + "cell_type": "markdown", |
| 393 | + "id": "08c9c252-368f-4c7f-9aad-ed5b900d205e", |
| 394 | + "metadata": {}, |
| 395 | + "source": [ |
| 396 | + "## Postprocessing\n", |
| 397 | + "Deformed Views" |
| 398 | + ] |
| 399 | + }, |
| 400 | + { |
| 401 | + "cell_type": "markdown", |
| 402 | + "id": "e25fe2c5-99a9-41b3-998b-b4d9593d10be", |
| 403 | + "metadata": {}, |
| 404 | + "source": [ |
| 405 | + "View on fiber families" |
| 406 | + ] |
| 407 | + }, |
| 408 | + { |
| 409 | + "cell_type": "code", |
| 410 | + "execution_count": null, |
| 411 | + "id": "0fbd325a-20af-42cf-a02b-043072e0d2a9", |
| 412 | + "metadata": {}, |
| 413 | + "outputs": [], |
| 414 | + "source": [ |
| 415 | + "fiberfamilies = [\n", |
| 416 | + " (fiber_forces[0], fibers_1, fibers_2, [400, 900]),\n", |
| 417 | + " (fiber_forces[1], fibers_2, fibers_1, [400, 900]),\n", |
| 418 | + "]\n", |
| 419 | + "for i, (fiberforce, fiberfamily1, fiberfamily2, clim) in enumerate(fiberfamilies):\n", |
| 420 | + " view = fem.ViewSolid(field)\n", |
| 421 | + " plotter = view.plot(\n", |
| 422 | + " notebook=True,\n", |
| 423 | + " theme=\"document\",\n", |
| 424 | + " show_edges=False,\n", |
| 425 | + " add_axes=False,\n", |
| 426 | + " )\n", |
| 427 | + " plotter.add_axes(label_size=(0.06, 0.06))\n", |
| 428 | + "\n", |
| 429 | + " forcerange = np.abs(fiberforce[-1] - fiberforce[-3])\n", |
| 430 | + "\n", |
| 431 | + " fiberview1 = fem.ViewMesh(\n", |
| 432 | + " fiberfamily1,\n", |
| 433 | + " point_data={\n", |
| 434 | + " \"Normal Force (Range) per Undeformed Area (Fibre) in MPa\": forcerange\n", |
| 435 | + " },\n", |
| 436 | + " )\n", |
| 437 | + " fiberview2 = fem.ViewMesh(\n", |
| 438 | + " fiberfamily2,\n", |
| 439 | + " )\n", |
| 440 | + " plotter = fiberview2.plot(\n", |
| 441 | + " plotter=plotter,\n", |
| 442 | + " line_width=3,\n", |
| 443 | + " add_axes=False,\n", |
| 444 | + " )\n", |
| 445 | + " fiberplotter = fiberview1.plot(\n", |
| 446 | + " \"Normal Force (Range) per Undeformed Area (Fibre) in MPa\",\n", |
| 447 | + " label=\"Normal Force (Range) per Undeformed Area (Fibre) in MPa\",\n", |
| 448 | + " plotter=plotter,\n", |
| 449 | + " component=None,\n", |
| 450 | + " clim=clim,\n", |
| 451 | + " below_color=\"darkgrey\",\n", |
| 452 | + " above_color=\"lightgrey\",\n", |
| 453 | + " line_width=3,\n", |
| 454 | + " add_axes=False,\n", |
| 455 | + " )\n", |
| 456 | + " fiberplotter.show(jupyter_backend=\"static\")" |
197 | 457 | ]
|
198 | 458 | }
|
199 | 459 | ],
|
|
0 commit comments