|
249 | 249 | "\n", |
250 | 250 | "\n", |
251 | 251 | "def plot_stress_and_graph(res_idx, mk_res_list, k_list, m_list, **kwargs):\n", |
| 252 | + " \"\"\"Function that plots the animation.\"\"\"\n", |
252 | 253 | " with plotting_context(title=\"Stress\", **kwargs) as (fig, ax):\n", |
253 | 254 | " # plot background\n", |
254 | 255 | " mk_res_list[res_idx].concrete_section.plot_section(\n", |
|
267 | 268 | " conc_sig_max = (\n", |
268 | 269 | " max([max(x) for x in mk_res_list[res_idx].concrete_stresses]) + 1e-12\n", |
269 | 270 | " )\n", |
270 | | - " steel_sig_min = min(mk_res_list[res_idx].lumped_reinforcement_stresses)\n", |
271 | | - " steel_sig_max = max(mk_res_list[res_idx].lumped_reinforcement_stresses)\n", |
| 271 | + " # steel_sig_min = min(mk_res_list[res_idx].lumped_reinforcement_stresses)\n", |
| 272 | + " # steel_sig_max = max(mk_res_list[res_idx].lumped_reinforcement_stresses)\n", |
272 | 273 | "\n", |
273 | 274 | " # set up ticks\n", |
274 | 275 | " v_conc = np.linspace(conc_sig_min, conc_sig_max, 15, endpoint=True)\n", |
275 | | - " v_steel = np.linspace(steel_sig_min, steel_sig_max, 15, endpoint=True)\n", |
276 | | - " ticks_conc = v_conc\n", |
277 | | - " ticks_steel = v_steel\n", |
| 276 | + " # v_steel = np.linspace(steel_sig_min, steel_sig_max, 15, endpoint=True)\n", |
| 277 | + " # ticks_conc = v_conc\n", |
| 278 | + " # ticks_steel = v_steel\n", |
278 | 279 | "\n", |
279 | 280 | " # plot the concrete stresses\n", |
280 | 281 | " for idx, sig in enumerate(mk_res_list[res_idx].concrete_stresses):\n", |
|
294 | 295 | " )\n", |
295 | 296 | "\n", |
296 | 297 | " # plot the filled contour\n", |
297 | | - " trictr = ax.tricontourf(\n", |
298 | | - " triang, sig, v_conc, cmap=cmap_conc, norm=CenteredNorm()\n", |
299 | | - " )\n", |
| 298 | + " ax.tricontourf(triang, sig, v_conc, cmap=cmap_conc, norm=CenteredNorm())\n", |
300 | 299 | "\n", |
301 | 300 | " # plot a zero stress contour, supressing warning\n", |
302 | 301 | " with warnings.catch_warnings():\n", |
|
308 | 307 | " # set zero stress for neutral axis contour\n", |
309 | 308 | " zero_level = 0\n", |
310 | 309 | "\n", |
311 | | - " if min(sig) > 0:\n", |
312 | | - " if min(sig) < 1e-3:\n", |
313 | | - " zero_level = min(sig) + 1e-12\n", |
| 310 | + " if min(sig) > 0 and min(sig) < 1e-3:\n", |
| 311 | + " zero_level = min(sig) + 1e-12\n", |
314 | 312 | "\n", |
315 | | - " if max(sig) < 0:\n", |
316 | | - " if max(sig) > -1e-3:\n", |
317 | | - " zero_level = max(sig) - 1e-12\n", |
| 313 | + " if max(sig) < 0 and max(sig) > -1e-3:\n", |
| 314 | + " zero_level = max(sig) - 1e-12\n", |
318 | 315 | "\n", |
319 | 316 | " if min(sig) == 0:\n", |
320 | 317 | " zero_level = 1e-12\n", |
321 | 318 | "\n", |
322 | 319 | " if max(sig) == 0:\n", |
323 | 320 | " zero_level = -1e-12\n", |
324 | 321 | "\n", |
325 | | - " CS = ax.tricontour(\n", |
| 322 | + " ax.tricontour(\n", |
326 | 323 | " triang, sig, [zero_level], linewidths=1, linestyles=\"dashed\"\n", |
327 | 324 | " )\n", |
328 | 325 | "\n", |
|
409 | 406 | "\n", |
410 | 407 | "from PIL import Image\n", |
411 | 408 | "\n", |
412 | | - "\n", |
413 | 409 | "# filepaths\n", |
414 | 410 | "fp_in = \"anim/*.png\"\n", |
415 | 411 | "fp_out = \"anim.gif\"\n", |
|
444 | 440 | "name": "python", |
445 | 441 | "nbconvert_exporter": "python", |
446 | 442 | "pygments_lexer": "ipython3", |
447 | | - "version": "3.8.12" |
| 443 | + "version": "3.12.7" |
448 | 444 | } |
449 | 445 | }, |
450 | 446 | "nbformat": 4, |
|
0 commit comments