|
2 | 2 | from ansys.dpf.composites.composite_model import CompositeModel, CompositeScope
|
3 | 3 | from ansys.dpf.composites.server_helpers import connect_to_or_start_server
|
4 | 4 | from ansys.dpf.composites.data_sources import ContinuousFiberCompositesFiles, CompositeDefinitionFiles
|
5 |
| -from ansys.dpf.core import unit_systems |
| 5 | +from ansys.dpf.core import DataSources, Operator, unit_systems |
6 | 6 |
|
7 | 7 | from ansys.dpf.composites.layup_info import AnalysisPlyInfoProvider, get_all_analysis_ply_names
|
8 | 8 | from ansys.dpf.composites.ply_wise_data import SpotReductionStrategy, get_ply_wise_data
|
9 | 9 |
|
10 | 10 | from ansys.dpf.composites.constants import Spot, Sym3x3TensorComponent
|
11 | 11 |
|
12 | 12 | import os
|
| 13 | +import json |
13 | 14 |
|
14 |
| -server = connect_to_or_start_server() |
| 15 | +server = connect_to_or_start_server(ansys_path=r'D:\ANSYSDev\dpf_composites\fake_wb_installation') |
15 | 16 |
|
16 | 17 | solver_dir = r'D:\ANSYSDev\dpf_composites\test_data\lsdyna\shell_model_2'
|
17 | 18 |
|
|
41 | 42 |
|
42 | 43 | stress_operator = composite_model.core_model.results.stress()
|
43 | 44 | stress_operator.inputs.bool_rotate_to_global(False)
|
44 |
| -stress_field_material_coord = stress_operator.get_output( |
| 45 | + |
| 46 | +# %% |
| 47 | +# Prepare data |
| 48 | +# ~~~~~~~~~~~~ |
| 49 | +# The LS Dyna results have to be pre-processed to support |
| 50 | +# filtering and in order make them consistent with the layup |
| 51 | +# model. |
| 52 | + |
| 53 | +keyword_parser = Operator("composite::ls_dyna_keyword_parser") |
| 54 | +keyword_parser.inputs.data_sources(composite_model.data_sources.solver_input_file) |
| 55 | +keyword_parser.inputs.keyword("DATABASE_EXTENT_BINARY") |
| 56 | +keyword_options_as_json = json.loads(keyword_parser.outputs[0].get_data()) |
| 57 | + |
| 58 | +stress_container = stress_operator.get_output( |
| 59 | + pin=0, output_type=dpf.types.fields_container |
| 60 | +) |
| 61 | +strip_operator = Operator("composite::ls_dyna_strip_results") |
| 62 | +strip_operator.inputs.maxint(int(keyword_options_as_json["maxint"])) |
| 63 | +strip_operator.inputs.fields_container(stress_container) |
| 64 | +strip_operator.inputs.mesh(composite_model.get_mesh()) |
| 65 | + |
| 66 | +stripped_stress_field = strip_operator.get_output( |
45 | 67 | pin=0, output_type=dpf.types.fields_container
|
46 | 68 | )[0]
|
47 | 69 |
|
| 70 | + |
| 71 | +# stress_field_material_coord = stress_operator.get_output( |
| 72 | +# pin=0, output_type=dpf.types.fields_container |
| 73 | +# )[0] |
| 74 | + |
48 | 75 | # %%
|
49 | 76 | # Filter data by analysis ply
|
50 | 77 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
57 | 84 | for ply_name in all_ply_names:
|
58 | 85 | print(f"Plotting ply {ply_name}")
|
59 | 86 | elemental_values = get_ply_wise_data(
|
60 |
| - field=stress_field_material_coord, |
| 87 | + field=stripped_stress_field, |
61 | 88 | ply_name=ply_name,
|
62 | 89 | mesh=composite_model.get_mesh(),
|
63 | 90 | component=Sym3x3TensorComponent.TENSOR11,
|
|
0 commit comments