├── .gitignore ├── LICENSE ├── README.md ├── examples ├── dic │ ├── VIC3D_DIC.csv │ └── input_DIC_2d.yaml ├── energy │ ├── 1D_DIC_inverse.csv │ ├── 2D_DIC_inverse.csv │ ├── input_energy_1D.yaml │ └── input_energy_2D.yaml └── pd │ ├── displ_condition_1D.csv │ ├── displ_condition_2D.csv │ ├── displ_condition_2D_test.csv │ ├── force_condition_1D.csv │ ├── force_condition_2D.csv │ ├── force_condition_2D_test.csv │ ├── geometry_1D.csv │ ├── geometry_2D.csv │ ├── geometry_2D_test.csv │ ├── geometry_3D.csv │ ├── input_elas_1D.yaml │ ├── input_elas_2D.yaml │ ├── input_elas_2D_test.yaml │ ├── input_elas_3D.yaml │ ├── input_visco_1D.yaml │ ├── input_visco_2D.yaml │ └── input_visco_2D_test.yaml ├── pd_dic.py ├── peripydic ├── IO │ ├── __init__.py │ ├── ccm.py │ ├── deck.py │ ├── dic.py │ ├── geometry.py │ ├── output.py │ └── vis.py ├── __init__.py ├── doc │ ├── configuration.doxy │ ├── doc.bat │ └── doc.sh ├── materials │ ├── __init__.py │ ├── elastic.py │ └── viscoelastic.py ├── problem │ ├── __init__.py │ ├── dic.py │ ├── energy.py │ └── pd.py ├── test │ └── compare.sh └── util │ ├── __init__.py │ ├── abstractions.py │ ├── condition.py │ ├── functions.py │ ├── linalgebra.py │ └── neighbor.py ├── requirements.txt ├── setup.py ├── test ├── 1D+.res ├── 1D-.res ├── 2D_x+.res ├── 2D_x-.res ├── 2D_y+.res ├── 2D_y-.res ├── displ_condition_1D_x-.csv ├── displ_condition_1D_x.csv ├── displ_condition_2D_x+.csv ├── displ_condition_2D_x-.csv ├── displ_condition_2D_y+.csv ├── displ_condition_2D_y-.csv ├── force_condition_1D_x-.csv ├── force_condition_1D_x.csv ├── force_condition_2D_x+.csv ├── force_condition_2D_x-.csv ├── force_condition_2D_y+.csv ├── force_condition_2D_y-.csv ├── geometry_1D.csv ├── geometry_2D.csv ├── input_elas_1D_x+.yaml ├── input_elas_1D_x-.yaml ├── input_elas_2D_x+.yaml ├── input_elas_2D_x-.yaml ├── input_elas_2D_y+.yaml └── input_elas_2D_y-.yaml └── tools ├── run_tests_1D.sh └── run_tests_2D.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | 19 | # Compiled Static libraries 20 | *.lai 21 | *.la 22 | *.a 23 | *.lib 24 | 25 | # Executables 26 | *.exe 27 | *.out 28 | *.app 29 | 30 | *.*~ 31 | *.pyc 32 | 33 | #Generated files 34 | *.pdf 35 | *.html 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Basic Usage 2 | 3 | ```python 4 | from peripydic import * 5 | 6 | deck = PD_deck("./input_elas_1D.yaml") 7 | problem = PD_problem(deck) 8 | 9 | ``` 10 | 11 | # The problem 12 | 13 | Consider a 1D bar. The length of the bar and the number of sections in which the bar will be divided (the Peridynamic (PD) nodes are at the edges of each section) are provided by the user. 14 | 15 | A ramp loading is applied at the edges of the bar. The user provides the number of seconds after which the ramp reaches a maximal force value and remains there. 16 | Additional blocks are added at the edges of the block in order to apply the load. The number of blocks added at each edge of the bar is provided as the Horizon Factor. 17 | The user also provides the total duration of the simulation and the total number of time steps desired. 18 | 19 | The problem is then solved using an initial guess vector and the *Newton-Krylov* algorithm provided in the `scipy.optimize` package. 20 | 21 | # Getting started 22 | 23 | ### Dependencies 24 | 25 | The following python packages are **required**: 26 | * `numpy` 27 | * `pyyaml` 28 | * `scipy.optimize` 29 | * `sharedmem` 30 | 31 | The following tools are **optional** 32 | * `doxygen` 33 | * `dot` 34 | 35 | ### Installation 36 | 37 | 38 | ```bash 39 | virtualenv pddic 40 | source pddic/binactivate 41 | pip install -r requirements.txt 42 | python setup.py install 43 | ``` 44 | 45 | ### Testing 46 | 47 | ```bash 48 | cd tools 49 | ./run_tests_1D.sh 50 | ./run_tests_2D.sh 51 | ``` 52 | 53 | ## Usage 54 | ```bash 55 | python pd_dic.py -i input.yaml -t pd 56 | ``` 57 | Where `-i` has to be the configuration in `yaml format` and `-t` is the type, which can be `pd` for peridynamic simulations and `dic` for processing results from digital image correlation. 58 | 59 | ## Input description 60 | 61 | ### Material 62 | 63 | The material parameters are described here 64 | ```yaml 65 | Material: 66 | Type: Elastic 67 | E_Modulus: 4000.0 68 | ``` 69 | The available `Type` are until now `Elastic` and `Viscoelastic`. 70 | 71 | ### Geometry 72 | 73 | The discretization and the nodes are described with 74 | 75 | ```yaml 76 | Discretization: 77 | Dim: 1 78 | Final_Time: 2.0 79 | Time_Steps: 8 80 | Horizon_Factor_m_value: 1.0 81 | Influence_Function: 1.0 82 | Saftety_Factor: 1.001 83 | File: 84 | Name: geometry_dx0_50.csv 85 | Path: ./ 86 | Type: mudic 87 | ``` 88 | where `Dim` is the dimension of the node cloud, `Final_Time` the end time of the simulation, `Time_Steps` the amount of time steps, `Horizon_Factor_m_value` the m value of the horizon, `Influence_Function` the factor to scale the influence of the force with respect to the distance of the horizon and `Saftety_Factor` influences the computation of the horizon, and `Name` the file providing the node information in the CSV format with spaces as delimiter. The `path` is the path to the file in the file system. The `Type` describes if the CSV file was exported by `mudic` or `vic3d`. An example for this file is provided here: 89 | 90 | ``` 91 | #id x y z volume 92 | 0 0.0 0.0 0.0 1.0 93 | 1 1.0 1.0 1.0 1.0 94 | ``` 95 | The shape for the load is given here 96 | 97 | ```yaml 98 | Shape: 99 | Type: Ramp 100 | Values: 101 | - 1.5 102 | - 2.0 103 | - 2.0 104 | ``` 105 | where `Type` describes the shape and `Values` specify the geometry of the shape. 106 | 107 | ### Boundary Conditions 108 | 109 | Boundary conditions can be described with 110 | ```yaml 111 | Boundary: 112 | Condition: 113 | Type: 114 | - Force or Displacement 115 | Value: 116 | - Float 117 | Direction: 118 | - Int 119 | File: 120 | - file.csv 121 | ``` 122 | where the `Type` either can be `Force` or `Displacement`, `Value` describes the value in Newton or Millimeter whis is applied at the nodes 123 | described in `File`, and `Direction` describes the direction (X=1,Y=2,Z=3) where the condition is applied. The file has to be provided in the CSV format with spaces as delimiter with the id of the nodes where the condition 124 | should be applied. Here, is an example for a `file.csv` 125 | ```yaml 126 | #id 127 | 0 128 | 1 129 | ``` 130 | ### Output 131 | 132 | For writing simulation attributes the `Output` tag can be used. 133 | 134 | #### CSV 135 | 136 | For writing the simulation attributes to the CSV format the tag `CSV` is used. 137 | 138 | ```yaml 139 | Output: 140 | CSV: 141 | Type: 142 | - Position 143 | File: 144 | - nodes_positions.csv 145 | ``` 146 | Where `Type` specifies the attribute and `File` the file name of the output file. 147 | 148 | #### VTK 149 | 150 | For writing the simulation attributes to the VTK unstructured grid format the tag `VTK` is used 151 | 152 | ```yaml 153 | VTK: 154 | Path: ./ 155 | Type: 156 | - Displacement 157 | - Neighbors 158 | - Force 159 | - Conditions 160 | - Volume_Force 161 | - Strain 162 | Slice: 1 163 | ``` 164 | Where `Path` is the path for the output, `Type` specify the simulation attributes, which are considered for the output, and `Slice` defines that every n-th time step is written. 165 | 166 | ### Solver 167 | 168 | Here, `Max_Iteration`, `Tolerance` of the solver can be specified. With `Jacobian_Perturbation` the perturbation for assembly the Jacobian matrix is defined. 169 | 170 | ```yaml 171 | Solver: 172 | Max_Iteration: 100 173 | Tolerance: 1.0e-6 174 | Jacobian_Perturbation: 1.0e-6 175 | ``` 176 | 177 | ### Parallel computing 178 | For using multiple threads with `multiprocessing` specify the number of threads with `Threads`. 179 | 180 | ```yaml 181 | Parallel: 182 | Threads: 2 183 | ``` 184 | 185 | 186 | ## Examples 187 | 188 | An example for an elastic material and an viscoelastic material is provided in the example folder 189 | 190 | # Publications 191 | 192 | * Delorme, R., Tabiai, I., Laberge Lebel, L., & Lévesque, M. (2017). **Generalization of the ordinary state-based peridynamic model for isotropic linear viscoelasticity. Mechanics of Time-Dependent Materials.**, _Mechanics of Time-Dependent Materials, 1-27_, 10.1007/s11043-017-9342-3, 193 | * Rolland Delorme, Patrick Diehl, Ilyass Tabiai, Louis Laberge Lebel, and Martin 194 | Lévesque. **Extracting constitutive mechanical parameters in linear elasticity using the virtual fields method within the ordinary state-based peridynamic framework**. Journal of Peridynamics and Nonlocal Modeling, Jan 2020. [Link](https://link.springer.com/article/10.1007%2Fs42102-019-00025-7), [Preprint](https://engrxiv.org/uv8m7/) 195 | 196 | # License 197 | 198 | The code is licensed under the GNU General Public License v3.0 developed by [Patrick Diehl](http://diehlpk.github.io/), [Rolland Delorme](https://orcid.org/0000-0001-7637-3936) and [Ilyass Tabiai](http://iltabiai.github.io/) . Please cite our code with following [![DOI](https://zenodo.org/badge/46075533.svg)](https://zenodo.org/badge/latestdoi/46075533) 199 | 200 | Based on works at http://dx.doi.org/10.1016/S0022-5096(99)00029-0 and https://doi.org/10.1007/s11043-017-9342-3. 201 | -------------------------------------------------------------------------------- /examples/dic/input_DIC_2d.yaml: -------------------------------------------------------------------------------- 1 | Material: 2 | Type: Elastic 3 | Bulk_Modulus: 3333.3333 4 | Shear_Modulus: 1538.4615 5 | Data: 6 | Dimension: 2 7 | Sigma: 16 8 | Type: Plane_Stress 9 | File: 10 | Name: VIC3D_DIC.csv 11 | Path: ./ 12 | Type: vic3d 13 | Discretization: 14 | Horizon_Factor_m_value: 1.0 15 | Influence_Function: 1.0 16 | Saftety_Factor: 1.1 17 | Volume: 0.79375 18 | Output: 19 | VTK: 20 | Path: ./outDIC/ 21 | Type: 22 | - Displacement 23 | - Neighbors 24 | - Strain 25 | -------------------------------------------------------------------------------- /examples/energy/1D_DIC_inverse.csv: -------------------------------------------------------------------------------- 1 | “X”,“Y”,“Z”,“U”,“V”,“W”,“exx”,“eyy”,“exy”,“sigma” 2 | -0.25,0,0,0,0,0,0,0,0,0 3 | 0.25,0,0,0.0025,0,0,0,0,0,0 4 | 0.75,0,0,0.0075,0,0,0,0,0,0 5 | 1.25,0,0,0.0125,0,0,0,0,0,0 6 | 1.75,0,0,0.0175,0,0,0,0,0,0 7 | 2.25,0,0,0.0225,0,0,0,0,0,0 8 | 2.75,0,0,0.0275,0,0,0,0,0,0 9 | 3.25,0,0,0.0325,0,0,0,0,0,0 10 | 3.75,0,0,0.0375,0,0,0,0,0,0 11 | 4.25,0,0,0.0425,0,0,0,0,0,0 12 | 4.75,0,0,0.0475,0,0,0,0,0,0 13 | 5.25,0,0,0.0525,0,0,0,0,0,0 14 | 5.75,0,0,0.0575,0,0,0,0,0,0 15 | 6.25,0,0,0.0625,0,0,0,0,0,0 16 | 6.75,0,0,0.0675,0,0,0,0,0,0 17 | 7.25,0,0,0.0725,0,0,0,0,0,0 18 | 7.75,0,0,0.0775,0,0,0,0,0,0 19 | 8.25,0,0,0.0825,0,0,0,0,0,0 20 | 8.75,0,0,0.0875,0,0,0,0,0,0 21 | 9.25,0,0,0.0925,0,0,0,0,0,0 22 | 9.75,0,0,0.0975,0,0,0,0,0,0 23 | 10.25,0,0,0.1025,0,0,0,0,0,0 24 | 10.75,0,0,0.1075,0,0,0,0,0,0 25 | 11.25,0,0,0.1125,0,0,0,0,0,0 26 | 11.75,0,0,0.1175,0,0,0,0,0,0 27 | 12.25,0,0,0.1225,0,0,0,0,0,0 28 | 12.75,0,0,0.1275,0,0,0,0,0,0 29 | 13.25,0,0,0.1325,0,0,0,0,0,0 30 | 13.75,0,0,0.1375,0,0,0,0,0,0 31 | 14.25,0,0,0.1425,0,0,0,0,0,0 32 | 14.75,0,0,0.1475,0,0,0,0,0,0 33 | 15.25,0,0,0.1525,0,0,0,0,0,0 34 | 15.75,0,0,0.1575,0,0,0,0,0,0 35 | -------------------------------------------------------------------------------- /examples/energy/input_energy_1D.yaml: -------------------------------------------------------------------------------- 1 | Material: 2 | Type: Elastic 3 | Young_Modulus: 1000. 4 | Data: 5 | Dimension: 1 6 | Sigma: 9 7 | File: 8 | Name: 1D_DIC_inverse.csv 9 | Path: ./ 10 | Discretization: 11 | Horizon_Factor_m_value: 1.0 12 | Influence_Function: 1.0 13 | Saftety_Factor: 1.001 14 | Volume: 0.5 15 | Output: 16 | VTK: 17 | Path: ./outDIC/ 18 | Type: 19 | - Displacement 20 | - Neighbors 21 | - Strain 22 | Solver: 23 | Max_Iteration: 5 24 | Tolerance: 1.0e-2 25 | Jacobian_Perturbation: 100 26 | Parallel: 27 | Threads: 3 28 | Energy: 29 | Nodes: 30 | - 15 31 | - 16 32 | - 18 33 | - 17 34 | Measured Energy: 0.2 35 | -------------------------------------------------------------------------------- /examples/energy/input_energy_2D.yaml: -------------------------------------------------------------------------------- 1 | Material: 2 | Type: Elastic 3 | Bulk_Modulus: 3333.333333333333 4 | Shear_Modulus: 1538.4615 5 | Data: 6 | Dimension: 2 7 | Type: Plane_Stress 8 | Sigma: 9 9 | File: 10 | Name: 2D_DIC_inverse.csv 11 | Path: ./ 12 | Discretization: 13 | Horizon_Factor_m_value: 10.0 14 | Influence_Function: 1.0 15 | Saftety_Factor: 1.001 16 | Volume: 1 17 | Output: 18 | VTK: 19 | Path: ./outDIC/ 20 | Type: 21 | - Displacement 22 | - Neighbors 23 | - Strain 24 | Solver: 25 | Max_Iteration: 50 26 | Tolerance: 1.0e-4 27 | Jacobian_Perturbation: 10 28 | Parallel: 29 | Threads: 3 30 | Energy: 31 | Nodes: 32 | - 795 33 | Measured Energy: 2.0 34 | -------------------------------------------------------------------------------- /examples/pd/displ_condition_1D.csv: -------------------------------------------------------------------------------- 1 | #id 2 | 0 -------------------------------------------------------------------------------- /examples/pd/displ_condition_2D.csv: -------------------------------------------------------------------------------- 1 | #id 2 | 50 3 | 51 4 | 52 5 | 53 6 | 54 7 | 105 8 | 106 9 | 107 10 | 108 11 | 109 12 | 160 13 | 161 14 | 162 15 | 163 16 | 164 17 | 215 18 | 216 19 | 217 20 | 218 21 | 219 22 | 270 23 | 271 24 | 272 25 | 273 26 | 274 27 | 325 28 | 326 29 | 327 30 | 328 31 | 329 32 | 380 33 | 381 34 | 382 35 | 383 36 | 384 37 | 435 38 | 436 39 | 437 40 | 438 41 | 439 42 | 490 43 | 491 44 | 492 45 | 493 46 | 494 47 | 545 48 | 546 49 | 547 50 | 548 51 | 549 52 | 600 53 | 601 54 | 602 55 | 603 56 | 604 57 | 655 58 | 656 59 | 657 60 | 658 61 | 659 62 | 710 63 | 711 64 | 712 65 | 713 66 | 714 67 | 765 68 | 766 69 | 767 70 | 768 71 | 769 72 | 820 73 | 821 74 | 822 75 | 823 76 | 824 77 | 875 78 | 876 79 | 877 80 | 878 81 | 879 82 | 930 83 | 931 84 | 932 85 | 933 86 | 934 87 | 985 88 | 986 89 | 987 90 | 988 91 | 989 92 | 1040 93 | 1041 94 | 1042 95 | 1043 96 | 1044 97 | 1095 98 | 1096 99 | 1097 100 | 1098 101 | 1099 102 | 1150 103 | 1151 104 | 1152 105 | 1153 106 | 1154 107 | 1205 108 | 1206 109 | 1207 110 | 1208 111 | 1209 112 | 1260 113 | 1261 114 | 1262 115 | 1263 116 | 1264 117 | 1315 118 | 1316 119 | 1317 120 | 1318 121 | 1319 122 | 1370 123 | 1371 124 | 1372 125 | 1373 126 | 1374 127 | -------------------------------------------------------------------------------- /examples/pd/displ_condition_2D_test.csv: -------------------------------------------------------------------------------- 1 | #id 2 | 0 3 | 1 4 | 2 5 | 10 6 | 11 7 | 12 8 | 20 9 | 21 10 | 22 11 | 30 12 | 31 13 | 32 14 | 40 15 | 41 16 | 42 17 | -------------------------------------------------------------------------------- /examples/pd/force_condition_1D.csv: -------------------------------------------------------------------------------- 1 | #id 2 | 32 -------------------------------------------------------------------------------- /examples/pd/force_condition_2D.csv: -------------------------------------------------------------------------------- 1 | #id 2 | 0 3 | 55 4 | 110 5 | 165 6 | 220 7 | 275 8 | 330 9 | 385 10 | 440 11 | 495 12 | 550 13 | 605 14 | 660 15 | 715 16 | 770 17 | 825 18 | 880 19 | 935 20 | 990 21 | 1045 22 | 1100 23 | 1155 24 | 1210 25 | 1265 26 | 1320 27 | -------------------------------------------------------------------------------- /examples/pd/force_condition_2D_test.csv: -------------------------------------------------------------------------------- 1 | #id 2 | 9 3 | 19 4 | 29 5 | 39 6 | 49 7 | -------------------------------------------------------------------------------- /examples/pd/geometry_1D.csv: -------------------------------------------------------------------------------- 1 | # id x y z volume density 2 | 0 -0.25 0.5 3 | 1 0.25 0.5 4 | 2 0.75 0.5 5 | 3 1.25 0.5 6 | 4 1.75 0.5 7 | 5 2.25 0.5 8 | 6 2.75 0.5 9 | 7 3.25 0.5 10 | 8 3.75 0.5 11 | 9 4.25 0.5 12 | 10 4.75 0.5 13 | 11 5.25 0.5 14 | 12 5.75 0.5 15 | 13 6.25 0.5 16 | 14 6.75 0.5 17 | 15 7.25 0.5 18 | 16 7.75 0.5 19 | 17 8.25 0.5 20 | 18 8.75 0.5 21 | 19 9.25 0.5 22 | 20 9.75 0.5 23 | 21 10.25 0.5 24 | 22 10.75 0.5 25 | 23 11.25 0.5 26 | 24 11.75 0.5 27 | 25 12.25 0.5 28 | 26 12.75 0.5 29 | 27 13.25 0.5 30 | 28 13.75 0.5 31 | 29 14.25 0.5 32 | 30 14.75 0.5 33 | 31 15.25 0.5 34 | 32 15.75 0.5 -------------------------------------------------------------------------------- /examples/pd/geometry_2D_test.csv: -------------------------------------------------------------------------------- 1 | # id x y z volume density 2 | 0 -1.25 0.00 0.25 3 | 1 -0.75 0.00 0.25 4 | 2 -0.25 0.00 0.25 5 | 3 0.25 0.00 0.25 6 | 4 0.75 0.00 0.25 7 | 5 1.25 0.00 0.25 8 | 6 1.75 0.00 0.25 9 | 7 2.25 0.00 0.25 10 | 8 2.75 0.00 0.25 11 | 9 3.25 0.00 0.25 12 | 10 -1.25 -0.50 0.25 13 | 11 -0.75 -0.50 0.25 14 | 12 -0.25 -0.50 0.25 15 | 13 0.25 -0.50 0.25 16 | 14 0.75 -0.50 0.25 17 | 15 1.25 -0.50 0.25 18 | 16 1.75 -0.50 0.25 19 | 17 2.25 -0.50 0.25 20 | 18 2.75 -0.50 0.25 21 | 19 3.25 -0.50 0.25 22 | 20 -1.25 0.50 0.25 23 | 21 -0.75 0.50 0.25 24 | 22 -0.25 0.50 0.25 25 | 23 0.25 0.50 0.25 26 | 24 0.75 0.50 0.25 27 | 25 1.25 0.50 0.25 28 | 26 1.75 0.50 0.25 29 | 27 2.25 0.50 0.25 30 | 28 2.75 0.50 0.25 31 | 29 3.25 0.50 0.25 32 | 30 -1.25 -1.00 0.25 33 | 31 -0.75 -1.00 0.25 34 | 32 -0.25 -1.00 0.25 35 | 33 0.25 -1.00 0.25 36 | 34 0.75 -1.00 0.25 37 | 35 1.25 -1.00 0.25 38 | 36 1.75 -1.00 0.25 39 | 37 2.25 -1.00 0.25 40 | 38 2.75 -1.00 0.25 41 | 39 3.25 -1.00 0.25 42 | 40 -1.25 1.00 0.25 43 | 41 -0.75 1.00 0.25 44 | 42 -0.25 1.00 0.25 45 | 43 0.25 1.00 0.25 46 | 44 0.75 1.00 0.25 47 | 45 1.25 1.00 0.25 48 | 46 1.75 1.00 0.25 49 | 47 2.25 1.00 0.25 50 | 48 2.75 1.00 0.25 51 | 49 3.25 1.00 0.25 52 | -------------------------------------------------------------------------------- /examples/pd/geometry_3D.csv: -------------------------------------------------------------------------------- 1 | # id x y z volume density 2 | 0 -0.25 0.0 0.0 0.5 3 | 1 0.25 0.0 0.0 0.5 4 | 2 0.75 0.0 0.0 0.5 5 | 3 1.25 0.0 0.0 0.5 6 | 4 1.75 0.0 0.0 0.5 7 | 5 2.25 0.0 0.0 0.5 8 | 6 2.75 0.0 0.0 0.5 9 | 7 3.25 0.0 0.0 0.5 10 | 8 3.75 0.0 0.0 0.5 11 | 9 4.25 0.0 0.0 0.5 12 | 10 4.75 0.0 0.0 0.5 13 | 11 5.25 0.0 0.0 0.5 14 | 12 5.75 0.0 0.0 0.5 15 | 13 6.25 0.0 0.0 0.5 16 | 14 6.75 0.0 0.0 0.5 17 | 15 7.25 0.0 0.0 0.5 18 | 16 7.75 0.0 0.0 0.5 19 | 17 8.25 0.0 0.0 0.5 20 | 18 8.75 0.0 0.0 0.5 21 | 19 9.25 0.0 0.0 0.5 22 | 20 9.75 0.0 0.0 0.5 23 | 21 10.25 0.0 0.0 0.5 24 | 22 10.75 0.0 0.0 0.5 25 | 23 11.25 0.0 0.0 0.5 26 | 24 11.75 0.0 0.0 0.5 27 | 25 12.25 0.0 0.0 0.5 28 | 26 12.75 0.0 0.0 0.5 29 | 27 13.25 0.0 0.0 0.5 30 | 28 13.75 0.0 0.0 0.5 31 | 29 14.25 0.0 0.0 0.5 32 | 30 14.75 0.0 0.0 0.5 33 | 31 15.25 0.0 0.0 0.5 34 | 32 15.75 0.0 0.0 0.5 -------------------------------------------------------------------------------- /examples/pd/input_elas_1D.yaml: -------------------------------------------------------------------------------- 1 | Discretization: 2 | Dim: 1 3 | Final_Time: 1.0 4 | Time_Steps: 1 5 | Horizon_Factor_m_value: 1.0 6 | Influence_Function: ONE 7 | File: 8 | Name: geometry_1D.csv 9 | Material: 10 | Type: Elastic 11 | Young_Modulus: 4000.0 12 | Boundary: 13 | Condition: 14 | Type: 15 | - Force 16 | - Displacement 17 | Value: 18 | - 40 19 | - 0.0 20 | Direction: 21 | - 1 22 | - 1 23 | File: 24 | - force_condition_1D.csv 25 | - displ_condition_1D.csv 26 | Shape: 27 | - Ramp 28 | - Fixed 29 | Shape: 30 | Type: Ramp 31 | Values: 32 | - 1.0 33 | - 1.0 34 | - 1.0 35 | Solver: 36 | Max_Iteration: 100 37 | Tolerance: 1.0e-6 38 | Jacobian_Perturbation: 1.0e-6 39 | Parallel: 40 | Threads: 3 41 | -------------------------------------------------------------------------------- /examples/pd/input_elas_2D.yaml: -------------------------------------------------------------------------------- 1 | Discretization: 2 | Dim: 2 3 | Type: Plane_Stress 4 | Final_Time: 1.0 5 | Time_Steps: 1 6 | Horizon_Factor_m_value: 5.0 7 | Influence_Function: 1.0 8 | File: 9 | Name: geometry_2D.csv 10 | Material: 11 | Type: Elastic 12 | Bulk_Modulus: 3333.3333 13 | Shear_Modulus: 1538.4615 14 | Boundary: 15 | Condition: 16 | Type: 17 | - Force 18 | - Displacement 19 | - Displacement 20 | Value: 21 | - -40.0 22 | - 0.0 23 | - 0.0 24 | Direction: 25 | - 2 26 | - 1 27 | - 2 28 | File: 29 | - force_condition_2D.csv 30 | - displ_condition_2D.csv 31 | - displ_condition_2D.csv 32 | Shape: 33 | - Ramp 34 | - Fixed 35 | - Fixed 36 | Shape: 37 | Type: Ramp 38 | Values: 39 | - 1.0 40 | - 1.0 41 | - 1.0 42 | Output: 43 | CSV: 44 | Type: 45 | - Position 46 | File: 47 | - nodes_positions_m_3_75_dx_1_0.csv 48 | VTK: 49 | Path: ./out2/ 50 | Type: 51 | - Displacement 52 | - Neighbors 53 | - Force 54 | - Conditions 55 | - Strain 56 | - Stress 57 | Slice: 1 58 | Solver: 59 | Max_Iteration: 1000 60 | Tolerance: 1.0e-2 61 | Jacobian_Perturbation: 1.0e-6 62 | Parallel: 63 | Threads: 8 64 | -------------------------------------------------------------------------------- /examples/pd/input_elas_2D_test.yaml: -------------------------------------------------------------------------------- 1 | Discretization: 2 | Dim: 2 3 | Type: Plane_Stress 4 | Final_Time: 1.0 5 | Time_Steps: 1 6 | Horizon_Factor_m_value: 3.0 7 | Influence_Function: 1.0 8 | File: 9 | Name: geometry_2D_test.csv 10 | Material: 11 | Type: Elastic 12 | Bulk_Modulus: 3333.3333 13 | Shear_Modulus: 1538.4615 14 | Boundary: 15 | Condition: 16 | Type: 17 | - Force 18 | - Displacement 19 | - Displacement 20 | Value: 21 | - 40.0 22 | - 0.0 23 | - 0.0 24 | Direction: 25 | - 1 26 | - 1 27 | - 2 28 | File: 29 | - force_condition_2D_test.csv 30 | - displ_condition_2D_test.csv 31 | - displ_condition_2D_test.csv 32 | Shape: 33 | - Ramp 34 | - Fixed 35 | - Fixed 36 | Shape: 37 | Type: Ramp 38 | Values: 39 | - 1.0 40 | - 1.0 41 | - 1.0 42 | Output: 43 | CSV: 44 | Type: 45 | - Position 46 | File: 47 | - nodes_positions_m_3_dx_0_5.csv 48 | VTK: 49 | Path: ./out2/ 50 | Type: 51 | - Displacement 52 | - Neighbors 53 | - Force 54 | - Conditions 55 | - Strain 56 | Slice: 1 57 | Solver: 58 | Max_Iteration: 1000 59 | Tolerance: 1.0e-3 60 | Jacobian_Perturbation: 1.0e-6 61 | Parallel: 62 | Threads: 3 63 | -------------------------------------------------------------------------------- /examples/pd/input_elas_3D.yaml: -------------------------------------------------------------------------------- 1 | Discretization: 2 | Dim: 3 3 | Final_Time: 2.0 4 | Time_Steps: 8 5 | Horizon_Factor_m_value: 2.0 6 | Influence_Function: 1.0 7 | File: 8 | Name: geometry_3D.csv 9 | Material: 10 | Type: Elastic 11 | E_Modulus: 4000.0 12 | Boundary: 13 | Condition: 14 | Type: 15 | - Force 16 | - Displacement 17 | Value: 18 | - 40.0 19 | - 0.0 20 | Direction: 21 | - 1 22 | - 1 23 | File: 24 | - force_condition.csv 25 | - displ_condition.csv 26 | Shape: 27 | Type: Ramp 28 | Values: 29 | - 1.5 30 | - 2.0 31 | - 2.0 32 | Output: 33 | CSV: 34 | Type: 35 | - Position 36 | File: 37 | - nodes_positions_m4_dx0_50.csv 38 | Solver: 39 | Type: krylov 40 | Tolerance: 1.0e-12 41 | -------------------------------------------------------------------------------- /examples/pd/input_visco_1D.yaml: -------------------------------------------------------------------------------- 1 | Discretization: 2 | Dim: 1 3 | Final_Time: 20.0 4 | Time_Steps: 40 5 | Horizon_Factor_m_value: 1.0 6 | Influence_Function: ONE 7 | File: 8 | Name: geometry_1D.csv 9 | Material: 10 | Type: Viscoelastic 11 | Relax_Modulus: 12 | - 4000.0 13 | - 2000.0 14 | - 1000.0 15 | Relax_Time: 16 | - NaN 17 | - 1.0 18 | - 100.0 19 | Boundary: 20 | Condition: 21 | Type: 22 | - Force 23 | - Displacement 24 | Value: 25 | - 40 26 | - 0.0 27 | Direction: 28 | - 1 29 | - 1 30 | File: 31 | - force_condition_1D.csv 32 | - displ_condition_1D.csv 33 | Shape: 34 | - Ramp 35 | - Fixed 36 | Shape: 37 | Type: Ramp 38 | Values: 39 | - 1.0 40 | - 8.0 41 | - 11.0 42 | Output: 43 | CSV: 44 | Type: 45 | - Position 46 | File: 47 | - nodes_positions_dx0_50.csv 48 | VTK: 49 | Path: ./out1/ 50 | Type: 51 | - Displacement 52 | - Neighbors 53 | - Force 54 | - Conditions 55 | - Strain 56 | Slice: 1 57 | Solver: 58 | Max_Iteration: 100 59 | Tolerance: 1.0e-6 60 | Jacobian_Perturbation: 1.0e-6 61 | Parallel: 62 | Threads: 3 63 | -------------------------------------------------------------------------------- /examples/pd/input_visco_2D.yaml: -------------------------------------------------------------------------------- 1 | Discretization: 2 | Dim: 2 3 | Type: Plane_Stress 4 | Final_Time: 20.0 5 | Time_Steps: 40 6 | Horizon_Factor_m_value: 1.0 7 | Influence_Function: 5.0 8 | File: 9 | Name: geometry_2D.csv 10 | Material: 11 | Type: Viscoelastic 12 | Relax_Bulk_Modulus: 13 | - 3333.3333 14 | - 1666.6666 15 | - 833.3333 16 | Relax_Shear_Modulus: 17 | - 1538.4615 18 | - 769.23075 19 | - 384.61538 20 | Relax_Time: 21 | - NaN 22 | - 1.0 23 | - 100.0 24 | Boundary: 25 | Condition: 26 | Type: 27 | - Force 28 | - Displacement 29 | - Displacement 30 | Value: 31 | - -40.0 32 | - 0.0 33 | - 0.0 34 | Direction: 35 | - 2 36 | - 1 37 | - 2 38 | File: 39 | - force_condition_2D.csv 40 | - displ_condition_2D.csv 41 | - displ_condition_2D.csv 42 | Shape: 43 | - Ramp 44 | - Fixed 45 | - Fixed 46 | Shape: 47 | Type: Ramp 48 | Values: 49 | - 1.0 50 | - 8.0 51 | - 11.0 52 | Output: 53 | CSV: 54 | Type: 55 | - Position 56 | File: 57 | - nodes_positions_m_3_75_dx_1_0.csv 58 | VTK: 59 | Path: ./out_2d_visco/ 60 | Type: 61 | - Displacement 62 | - Neighbors 63 | - Force 64 | - Conditions 65 | - Strain 66 | - Stress 67 | Slice: 1 68 | Solver: 69 | Max_Iteration: 1000 70 | Tolerance: 1.0e-2 71 | Jacobian_Perturbation: 1.0e-6 72 | Parallel: 73 | Threads: 3 -------------------------------------------------------------------------------- /examples/pd/input_visco_2D_test.yaml: -------------------------------------------------------------------------------- 1 | Discretization: 2 | Dim: 2 3 | Type: Plane_Stress 4 | Final_Time: 3.0 5 | Time_Steps: 6 6 | Horizon_Factor_m_value: 2.0 7 | Influence_Function: 1.0 8 | File: 9 | Name: geometry_2D_test.csv 10 | Material: 11 | Type: Viscoelastic 12 | Relax_Bulk_Modulus: 13 | - 3333.3333 14 | - 1666.6666 15 | - 833.3333 16 | Relax_Shear_Modulus: 17 | - 1538.4615 18 | - 769.23075 19 | - 384.61538 20 | Relax_Time: 21 | - NaN 22 | - 1.0 23 | - 100.0 24 | Boundary: 25 | Condition: 26 | Type: 27 | - Force 28 | - Displacement 29 | - Displacement 30 | Value: 31 | - 20.0 32 | - 0.0 33 | - 0.0 34 | Direction: 35 | - 1 36 | - 1 37 | - 2 38 | File: 39 | - force_condition_2D_test.csv 40 | - displ_condition_2D_test.csv 41 | - displ_condition_2D_test.csv 42 | Shape: 43 | - Ramp 44 | - Fixed 45 | - Fixed 46 | Shape: 47 | Type: Ramp 48 | Values: 49 | - 1.0 50 | - 8.0 51 | - 11.0 52 | Output: 53 | CSV: 54 | Type: 55 | - Position 56 | File: 57 | - nodes_positions_m_3_75_dx_1_0.csv 58 | VTK: 59 | Path: ./out_2d_visco/ 60 | Type: 61 | - Displacement 62 | - Neighbors 63 | - Force 64 | - Conditions 65 | - Strain 66 | - Stress 67 | Slice: 1 68 | Solver: 69 | Max_Iteration: 1000 70 | Tolerance: 1.0e-2 71 | Jacobian_Perturbation: 1.0e-3 72 | Parallel: 73 | Threads: 3 -------------------------------------------------------------------------------- /pd_dic.py: -------------------------------------------------------------------------------- 1 | #-*- coding: utf-8 -*- 2 | #@author: ilyass.tabiai@polymtl.ca 3 | #@author: rolland.delorme@polymtl.ca 4 | #@author: patrickdiehl@lsu.edu 5 | import sys 6 | import getopt 7 | import numpy as np 8 | np.set_printoptions(precision=8, threshold=sys.maxsize, suppress=True) 9 | import time 10 | from peripydic import * 11 | 12 | 13 | 14 | def main(argv): 15 | """ 16 | Main 17 | """ 18 | helptext = sys.argv[0] + " -i input.yaml -t type" 19 | types = ['pd', 'dic' , 'energy'] 20 | 21 | if len(sys.argv) != 5: 22 | print (helptext) 23 | sys.exit(1) 24 | 25 | try: 26 | opts, args = getopt.getopt( 27 | argv, "hi:o:t:", ["ifile=","type="]) 28 | except getopt.GetoptError: 29 | print( helptext) 30 | sys.exit(0) 31 | 32 | for opt, arg in opts: 33 | if opt in ("-i", "--ifile"): 34 | inputFile = arg 35 | elif opt in ("-t", "--type"): 36 | typeIn = arg 37 | if typeIn not in types: 38 | print("Error: Only pd or dic types are supported") 39 | sys.exit(1) 40 | 41 | if typeIn == types[0]: 42 | deck = IO.deck.PD_deck(inputFile) 43 | if deck.material_type == "Elastic": 44 | simulation(deck) 45 | elif deck.material_type == "Viscoelastic": 46 | simulation(deck) 47 | else: 48 | print ("Error in pd_dict.py: Material type unknown, please use Elastic or Viscoelastic") 49 | 50 | if typeIn == types[1]: 51 | deck = IO.deck.DIC_deck(inputFile) 52 | dic(deck) 53 | 54 | if typeIn == types[2]: 55 | deck = IO.deck.DIC_deck(inputFile) 56 | energy(deck) 57 | 58 | def energy(deck): 59 | energy_solver_class = Energy_problem(deck) 60 | energy_solver_class.solver(deck) 61 | 62 | def dic(deck): 63 | dic_solver_class = DIC_problem(deck) 64 | #ccm_class = IO.ccm.CCM_calcul(deck, dic_solver_class) 65 | 66 | if deck.vtk_writer.vtk_enabled == True: 67 | deck.vtk_writer.write_data(deck,dic_solver_class,None) 68 | 69 | def simulation(deck): 70 | t0 = time.time() 71 | y_0 = deck.geometry.nodes.copy() 72 | pb_solver_class = problem.pd.PD_problem(deck) 73 | pb_solver_class.quasi_static_solver(deck, y_0) 74 | ccm_class = IO.ccm.CCM_calcul(deck, pb_solver_class) 75 | 76 | writeCSV(deck,pb_solver_class) 77 | if deck.vtk_writer.vtk_enabled == True: 78 | deck.vtk_writer.write_data(deck,pb_solver_class,ccm_class) 79 | 80 | print ("delta_x = " + str(deck.delta_X)) 81 | print ("Horizon = " + str(pb_solver_class.neighbors.horizon)) 82 | 83 | strain_tensor = ccm_class.global_strain[:,:,deck.time_steps-1] 84 | print ("epsilon_tensor") 85 | print (strain_tensor) 86 | 87 | strain_longi = pb_solver_class.strain_calculation(deck, 5, 7) 88 | print ("strain_longi", strain_longi) 89 | #print "Nodes positions = " 90 | #print pb_solver_class.y 91 | 92 | if deck.material_type == "Elastic": 93 | stress_tensor = ccm_class.global_stress[:,:,deck.time_steps-1] 94 | print ("stress_tensor") 95 | print (stress_tensor) 96 | print ("strain_energy") 97 | print (pb_solver_class.strain_energy) 98 | 99 | print ("Duration:", (time.time() - t0)/60. , "minutes") 100 | 101 | def writeCSV(deck,problem): 102 | for out in deck.outputs: 103 | if out.outType == "CSV": 104 | out.write(deck,problem) 105 | 106 | 107 | # Start the function __main__ at __init__ call 108 | if __name__ == "__main__": 109 | main(sys.argv[1:]) 110 | -------------------------------------------------------------------------------- /peripydic/IO/__init__.py: -------------------------------------------------------------------------------- 1 | ##@package IO 2 | # Handles the input and output 3 | #@author: ilyass.tabiai@polymtl.ca 4 | #@author: rolland.delorme@polymtl.ca 5 | #@author: patrickdiehl@lsu.edu 6 | 7 | from .deck import * 8 | from .dic import * 9 | from .geometry import * 10 | from .output import * 11 | from .vis import * 12 | from .ccm import * 13 | -------------------------------------------------------------------------------- /peripydic/IO/ccm.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | #@author: ilyass.tabiai@polymtl.ca 3 | #@author: rolland.delorme@polymtl.ca 4 | #@author: patrickdiehl@lsu.edu 5 | import sys 6 | import numpy as np 7 | from scipy import linalg 8 | np.set_printoptions(precision=8, threshold=sys.maxsize) 9 | from ..util import functions 10 | 11 | ## Class to compute the well-known strain and stress tensors defined in the classical continuum mechanics 12 | class CCM_calcul(): 13 | 14 | ## Constructor 15 | # @param deck The input deck 16 | # @param data_solver Data from the peridynamic problem/solving class 17 | def __init__(self, deck, data_solver): 18 | 19 | ## Nodes' initial position 20 | self.x = deck.geometry.nodes 21 | 22 | ## Nodes' positions stored for each time step 23 | self.y = data_solver.y 24 | 25 | ## Global internal force density array storing the force density attached to each node for each time step 26 | self.force_int = data_solver.force_int 27 | 28 | ## Extension array storing the extension for each node between itself and its family 29 | self.ext = data_solver.ext 30 | 31 | ## Dimension of the data_solver (1D, 2D or 3D) 32 | self.dim = deck.dim 33 | 34 | ## Amount of nodes in the data_solver 35 | self.num_nodes = deck.num_nodes 36 | 37 | ## Amount of time step 38 | self.time_steps = deck.time_steps 39 | 40 | ## Volume related to each node 41 | self.node_volumes = deck.geometry.volumes 42 | 43 | ## Weighted volume 44 | self.Weighted_Volume = data_solver.weighted_volume 45 | 46 | ## Volume correction factor 47 | self.Volume_Correction = data_solver.volume_correction 48 | 49 | ## Material type 50 | self.material_type = deck.material_type 51 | 52 | if self.material_type == "Elastic": 53 | if deck.dim == 1: 54 | ## Young modulus of the material 55 | self.Young_Modulus = deck.young_modulus 56 | 57 | if deck.dim >= 2: 58 | ## Bulk modulus of the material 59 | self.K = deck.bulk_modulus 60 | ## Shear modulus of the material 61 | self.Mu = deck.shear_modulus 62 | 63 | if deck.dim == 2: 64 | ## Poisson ratio of the material 65 | self.Nu = (3. * self.K - 2. * self.Mu) / (2. * (3. * self.K + self.Mu)) 66 | if deck.type2d == "Plane_Stress": 67 | ## Factor applied for 2D plane stress to compute dilatation and force state 68 | self.factor2d = (2. * self.Nu - 1.) / (self.Nu - 1.) 69 | if deck.type2d == "Plane_Strain": 70 | ## Plane strain 71 | self.factor2d = 1 72 | 73 | if self.material_type == "Viscoelastic": 74 | if deck.dim >= 2: 75 | ## Bulk modulus of the material 76 | self.K = deck.relax_bulk_modulus 77 | ## Shear modulus of the material 78 | self.Mu = deck.relax_shear_modulus 79 | 80 | if deck.dim == 2: 81 | ## Poisson ratio of the material 82 | self.Nu = (3. * self.K - 2. * self.Mu) / (2. * (3. * self.K + self.Mu)) 83 | if deck.type2d == "Plane_Stress": 84 | ## Factor applied for 2D plane stress to compute dilatation and force state 85 | self.factor2d = (2. * self.Nu - 1.) / (self.Nu - 1.) 86 | if deck.type2d == "Plane_Strain": 87 | ## Plane strain 88 | self.factor2d = 1 89 | 90 | ## Compute the global strain tensor storing the strain tensor for each node at each time step 91 | self.compute_global_strain_tensor(deck,data_solver) 92 | 93 | ## Compute the displacement for each node at each time step 94 | #self.compute_u_displacement() 95 | 96 | ## Compute the global stress tensor storing the strain tensor for each node at each time step 97 | if self.material_type == "Elastic": 98 | self.compute_global_stress_tensor(deck,data_solver) 99 | 100 | ## Provide the image of (xi - xp) under the reference position vector state X 101 | # @param data_solver Data from the peridynamic problem/solving class 102 | # @param i Id of Node "i" 103 | # @param p Id of Node "p" with Node "i" family 104 | # @return Image of (xi - xp) under the deformation vector state X 105 | def X_vector_state(self, data_solver, i, p): 106 | X = self.x[p,:] - self.x[i,:] 107 | X = np.reshape(X,(self.dim,1)) 108 | return X 109 | 110 | ## Provide the image of (xi - xp) under the deformation vector state Y 111 | # @param data_solver Data from the peridynamic problem/solving class 112 | # @param i Id of Node "i" 113 | # @param p Id of Node "p" with Node "i" family 114 | # @param t_n Id of the time step 115 | # @return Image of (xi - xp) under the deformation vector state Y 116 | def Y_vector_state(self, data_solver, i, p, t_n): 117 | Y = self.y[p,:,t_n] - self.y[i,:,t_n] 118 | Y = np.reshape(Y,(self.dim,1)) 119 | return Y 120 | 121 | ## Provide the shape tensor K related to Node "i" 122 | # @param data_solver Data from the peridynamic problem/solving class 123 | # @param deck Input deck 124 | # @param i Id of Node "i" 125 | # @return Shape tensor K 126 | def K_shape_tensor(self, deck, data_solver, i): 127 | K = np.zeros((self.dim, self.dim),dtype=np.float64) 128 | index_x_family = data_solver.neighbors.get_index_x_family(i) 129 | n = 0 130 | for p in index_x_family: 131 | X = self.X_vector_state(data_solver, i, p) 132 | K += functions.w(data_solver, X, deck.influence_function) * np.dot(X,X.T) * self.Volume_Correction[i,n] * self.node_volumes[p] 133 | n += 1 134 | return K 135 | 136 | ## Provide the deformation gradient tensor related to Node "i" 137 | # @param deck Input deck 138 | # @param data_solver Data from the peridynamic problem/solving class 139 | # @param i Id of Node "i" 140 | # @param t_n Id of the time step 141 | # @return Deformation gradient tensor related to Node "i" 142 | def deformation_gradient(self, deck, data_solver, i, t_n): 143 | tmp = np.zeros((self.dim, self.dim),dtype=np.float64) 144 | index_x_family = data_solver.neighbors.get_index_x_family(i) 145 | n = 0 146 | for p in index_x_family: 147 | Y = self.Y_vector_state(data_solver, i, p, t_n) 148 | X = self.X_vector_state(data_solver, i, p) 149 | tmp += functions.w(data_solver, X, deck.influence_function) * np.dot(Y,X.T) * self.Volume_Correction[i,n] * self.node_volumes[p] 150 | n += 1 151 | deformation = np.dot(tmp, linalg.inv(self.K_shape_tensor(deck,data_solver, i))) 152 | return deformation 153 | 154 | ## Provide the strain tensor related to Node "i" 155 | # @param data_solver Data from the peridynamic problem/solving class 156 | # @param i Id of Node "i" 157 | # @param t_n Id of the time step 158 | # @return strain tensor related do Node "i" 159 | def strain_tensor(self, deck, data_solver, i, t_n): 160 | F = self.deformation_gradient(deck,data_solver, i, t_n) 161 | strain = (F + F.T)/2 - np.identity(self.dim, dtype=np.float64) 162 | return strain 163 | 164 | ## Compute the global strain tensor storing the strain tensor for each node at each time step 165 | # @param data_solver Data from the peridynamic problem/solving class 166 | def compute_global_strain_tensor(self, deck, data_solver): 167 | ## Golbal strain tensor storing the strain tensor for each node at each time step 168 | self.global_strain = np.zeros((self.num_nodes*self.dim, self.dim, self.time_steps),dtype=np.float64) 169 | for t_n in range(1, self.time_steps): 170 | for i in range(0, self.num_nodes): 171 | tmp = self.strain_tensor(deck,data_solver, i, t_n) 172 | for j in range(0, self.dim): 173 | for r in range(0, self.dim): 174 | self.global_strain[i*self.dim+r,j,t_n] = tmp[r,j] 175 | 176 | ## Provide the image of x under the Dirac Delta Function 177 | # @param x Vector x 178 | # @return 1 if x is a null-vector, otherwise 0 179 | def DiracDelta(self, x, i, q, m): 180 | if linalg.norm(x) == 0.: 181 | delta = 1. / (self.node_volumes[q] * self.Volume_Correction[i,m]) 182 | else: 183 | delta = 0. 184 | return delta 185 | 186 | ## Provide the modulus state K related to Node "i" 187 | # @param data_solver Data from the peridynamic problem/solving class 188 | # @param i Id of Node "i" 189 | # @param p Id of Node "p" with Node "i" family 190 | # @param q Id of Node "q" with Node "i" family 191 | # @param t_n Id of the time step 192 | # @return Shape tensor K 193 | def K_modulus_tensor(self, deck, data_solver, i , p, q, m): 194 | Xp = self.X_vector_state(data_solver, i, p) 195 | M = Xp / linalg.norm(Xp) 196 | Xq = self.X_vector_state(data_solver, i, q) 197 | xp = deck.geometry.nodes[p,:] - deck.geometry.nodes[i,:] 198 | xq = deck.geometry.nodes[q,:] - deck.geometry.nodes[i,:] 199 | if self.material_type == "Elastic": 200 | if self.dim == 1: 201 | # PD material parameter 202 | alpha = self.Young_Modulus / self.Weighted_Volume[i] 203 | K = alpha * functions.w(data_solver, xp, deck.influence_function) * np.dot(M,M.T) * self.DiracDelta(Xq - Xp, i, q, m) 204 | 205 | if self.dim == 2: 206 | # PD material parameter 207 | # Plane stress 208 | alpha_s = (9. / self.Weighted_Volume[i]) * (self.K + ((self.Nu + 1.)/(2. * self.Nu - 1.))**2 * self.Mu / 9.) 209 | # Plane strain 210 | #alpha_s = (9. / self.Weighted_Volume[i]) * (self.K + self.Mu / 9.) 211 | alpha_d = (8. / self.Weighted_Volume[i]) * self.Mu 212 | alpha_sb = (2. * self.factor2d * alpha_s - (3. - 2. * self.factor2d) * alpha_d) /3. 213 | K = ((alpha_sb - alpha_d) / self.Weighted_Volume[i]) * functions.w(data_solver, xp, deck.influence_function) * functions.w(data_solver, xq, deck.influence_function) * np.dot(Xp,Xq.T) + alpha_d * functions.w(data_solver, xp, deck.influence_function) * np.dot(M,M.T) * self.DiracDelta(Xq - Xp, i, q, m) 214 | 215 | if self.dim == 3: 216 | # PD material parameter 217 | alpha_s = (9. / self.Weighted_Volume[i]) * self.K 218 | alpha_d = (15. / self.Weighted_Volume[i]) * self.Mu 219 | K = ((alpha_s - alpha_d) / self.Weighted_Volume[i]) * functions.w(data_solver, xp, deck.influence_function) * functions.w(data_solver, xq, deck.influence_function) * np.dot(Xp,Xq.T) + alpha_d * functions.w(data_solver, xp, deck.influence_function) * np.dot(M,M.T) * self.DiracDelta(Xq - Xp, i, q, m) 220 | 221 | return K 222 | 223 | ## Provide the stress tensor related to Node "i" 224 | # @param data_solver Data from the peridynamic problem/solving class 225 | # @param i Id of Node "i" 226 | # @param t_n Id of the time step 227 | # @return stress tensor related do Node "i" 228 | def stress_tensor(self, deck, data_solver, i, t_n): 229 | #force = np.zeros((self.dim, 1),dtype=np.float64) 230 | stress = np.zeros((self.dim, self.dim),dtype=np.float64) 231 | index_x_family = data_solver.neighbors.get_index_x_family(i) 232 | n = 0 233 | for p in index_x_family: 234 | Xp = self.X_vector_state(data_solver, i, p) 235 | m = 0 236 | for q in index_x_family: 237 | Xq = self.X_vector_state(data_solver, i, q) 238 | stress += np.dot(np.dot(self.K_modulus_tensor(deck,data_solver, i , p, q, m), np.dot(self.strain_tensor(deck,data_solver, i, t_n), Xq)), Xp.T) * self.Volume_Correction[i,m] * self.node_volumes[q] * self.Volume_Correction[i,n] * self.node_volumes[p] 239 | m += 1 240 | n += 1 241 | return stress 242 | 243 | ## Compute the global stress tensor storing the strain tensor for each node at each time step 244 | # @param data_solver Data from the peridynamic problem/solving class 245 | def compute_global_stress_tensor(self, deck, data_solver): 246 | ## Golbal strain tensor storing the strain tensor for each node at each time step 247 | self.global_stress = np.zeros((self.num_nodes*self.dim, self.dim, self.time_steps),dtype=np.float64) 248 | for t_n in range(1, self.time_steps): 249 | for i in range(0, self.num_nodes): 250 | tmp = self.stress_tensor(deck,data_solver, i, t_n) 251 | for j in range(0, self.dim): 252 | for r in range(0, self.dim): 253 | self.global_stress[i*self.dim+r,j,t_n] = tmp[r,j] 254 | 255 | ## Compute the displacement for each node at each time step 256 | def compute_u_displacement(self): 257 | ## Displacement vector between two consecutives time steps for each node 258 | self.u = np.zeros((self.num_nodes, self.dim, self.time_steps),dtype=np.float64) 259 | for t_n in range(1, self.time_steps): 260 | for i in range(0, self.num_nodes): 261 | self.u[i,:,t_n] = self.y[i,:,t_n] - self.y[i,:,t_n-1] 262 | 263 | ## Provide the image of (xi - xp) under the displacement vector state U 264 | # @param i Id of Node "i" 265 | # @param p Id of Node "p" with Node "i" family 266 | # @param t_n Id of the time step 267 | # @return Image of (xi - xp) under the deformation vector state U 268 | def U_vector_state(self, i, p, t_n): 269 | U = self.u[p,:,t_n] - self.u[i,:,t_n] 270 | U = np.reshape(U,(self.dim,1)) 271 | return U 272 | -------------------------------------------------------------------------------- /peripydic/IO/dic.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | #@author: ilyass.tabiai@polymtl.ca 3 | #@author: rolland.delorme@polymtl.ca 4 | #@author: patrickdiehl@lsu.edu 5 | import csv 6 | import numpy as np 7 | from . import deck 8 | import matplotlib.pyplot as plt 9 | 10 | ## A class for reading VIC3D CSV grid exports and converting them into list 11 | # objects usable by other classes 12 | class DICreader2D(): 13 | 14 | ## Constructor 15 | # Reads the CSV file provided, determines the unit horizon of this data and 16 | # and creates node initial and node actual attributes of the class usable 17 | # by the other modules 18 | # @param deck Deck object containing input data from the .yaml file 19 | def __init__(self, deck): 20 | ## Dimension of the problem (2D for DIC) 21 | self.dim = deck.dim 22 | ## Temporary variable internal to this class 23 | self.data = [] 24 | self.sigma_column = deck.sigma_column 25 | 26 | self.read(deck.filepath + "/" + deck.filename) 27 | self.extractData(deck) 28 | self.determineUnitHorizon() 29 | 30 | ## Read the values provided by the dic and stores it to the data array 31 | #`path` Path and appended file name for the csv file to proceed 32 | # @param path The path to the VIC3D CSV export data 33 | def read(self, path): 34 | ## Total number of points in the DIC CSV file 35 | self.length = 0 36 | with open(path, 'r') as csvfile: 37 | csvreader = csv.reader(csvfile, delimiter=',') 38 | next(csvreader, None) 39 | for row in csvreader: 40 | self.data.append(np.array(list(map(float, row)))) 41 | self.length += 1 42 | 43 | ## Find unique values for x 44 | # @param self Object pointer 45 | def determineUnitHorizon(self): 46 | self.delta_x = np.sqrt(np.power(self.x[1]-self.x[0],2)+np.power(self.y[1]-self.y[0],2)) 47 | 48 | ## Stores the data extracted from the CSV file in objects which can be 49 | # manipulated by other modules 50 | # @param self Object pointer 51 | def extractData(self,deck): 52 | ## Vector containing x nodes from DIC 53 | self.x = np.zeros((self.length)) 54 | dx = np.zeros((self.length)) 55 | ## Vector containing y nodes from DIC 56 | self.y = np.zeros((self.length)) 57 | dy = np.zeros((self.length)) 58 | ## Vector containing columes for each point 59 | self.volumes = np.zeros((self.length)) 60 | ## Strain from DIC 61 | self.strain = np.zeros((self.length,3)) 62 | 63 | if deck.filetype == "VIC3D": 64 | for i in range(0, len(self.data)): 65 | # Remove values for which the confidence is -1.0 66 | if self.data[i][self.sigma_column] == -1.: 67 | pass 68 | else: 69 | 70 | self.x[i] = self.data[i][0] 71 | if self.dim == 2: 72 | self.y[i] = self.data[i][1] 73 | 74 | dx[i] = self.data[i][3] 75 | if self.dim == 2: 76 | dy[i] = self.data[i][4] 77 | 78 | self.strain[i][0] = self.data[i][6] 79 | self.strain[i][1] = self.data[i][7] 80 | self.strain[i][2] = self.data[i][8] 81 | 82 | self.volumes[i] = deck.dic_volume * deck.thickness 83 | 84 | del self.data 85 | ## Nodes initial positions 86 | self.nodes = np.empty((self.length, self.dim)) 87 | self.nodes[:,0] = self.x 88 | if self.dim == 2: 89 | self.nodes[:,1] = self.y 90 | ## Nodes actual positions 91 | self.act = np.empty((self.length, self.dim)) 92 | self.act[:,0] = self.x + dx 93 | if self.dim == 2: 94 | self.act[:,1] = self.y + dy 95 | 96 | 97 | if deck.filetype == "mudic": 98 | 99 | for i in range(0, len(self.data)): 100 | self.x[i] = self.data[i][1] 101 | if self.dim == 2: 102 | self.y[i] = self.data[i][2] 103 | 104 | dx[i] = self.data[i][4] 105 | 106 | if self.dim == 2: 107 | dy[i] = self.data[i][5] 108 | 109 | 110 | self.volumes[i] = self.data[i][3] * deck.thickness 111 | 112 | self.strain[i][0] = self.data[i][8] 113 | self.strain[i][1] = self.data[i][9] 114 | self.strain[i][2] = self.data[i][10] 115 | 116 | 117 | del self.data 118 | ## Nodes initial positions 119 | self.nodes = np.empty((self.length, self.dim)) 120 | self.nodes[:,0] = self.x -dx 121 | if self.dim == 2: 122 | self.nodes[:,1] = self.y -dy 123 | ## Nodes actual positions 124 | self.act = np.empty((self.length, self.dim)) 125 | self.act[:,0] = self.x #+ dx 126 | if self.dim == 2: 127 | self.act[:,1] = self.y #+ dy 128 | 129 | 130 | -------------------------------------------------------------------------------- /peripydic/IO/geometry.py: -------------------------------------------------------------------------------- 1 | #-*- coding: utf-8 -*- 2 | #@author: ilyass.tabiai@polymtl.ca 3 | #@author: rolland.delorme@polymtl.ca 4 | #@author: patrickdiehl@lsu.edu 5 | import numpy as np 6 | from numpy import linalg 7 | import csv 8 | import os 9 | import sys 10 | 11 | ## Class handeling the discrete nodes 12 | class Geometry(): 13 | 14 | ## Read the positions, volume, and density of the nodes from the inFile. 15 | # @param dim Dimension of the nodes 16 | # @param inFile CSV file with the geometry 17 | def readNodes(self,dim,inFile): 18 | 19 | if not os.path.exists(inFile): 20 | print ("Error: Could not find " + inFile) 21 | sys.exit(1) 22 | ##Dimension of the problem 23 | self.dim = dim 24 | with open(inFile, 'r') as csvfile: 25 | spamreader = csv.reader(csvfile, delimiter=' ') 26 | #Skip the first line, because is the header 27 | next(spamreader) 28 | length = len(list(spamreader)) 29 | csvfile.seek(0) 30 | next(spamreader) 31 | 32 | ## Amount of nodes 33 | self.amount = length 34 | ## Volume related to each node 35 | self.volumes = np.empty(length,dtype=np.float64) 36 | 37 | if dim >= 1: 38 | pos_x = np.empty(length,dtype=np.float64) 39 | if dim >= 2: 40 | pos_y = np.empty(length,dtype=np.float64) 41 | if dim >= 3: 42 | pos_z = np.empty(length,dtype=np.float64) 43 | 44 | i = 0 45 | 46 | for row in spamreader: 47 | if dim >= 1: 48 | pos_x[i] = np.array(np.array(row[1]),dtype=np.float64) 49 | if dim >= 2: 50 | pos_y[i] = np.array(np.array(row[2]),dtype=np.float64) 51 | if dim >= 3: 52 | pos_z[i] = np.array(np.array(row[3]),dtype=np.float64) 53 | 54 | self.volumes[i] = np.array(np.array(row[dim + 1]),dtype=np.float64) 55 | i +=1 56 | 57 | ## Nodes of the discretization 58 | self.nodes = np.empty((len(pos_x),dim),dtype=np.float64) 59 | if dim == 1: 60 | self.nodes[:,0] = pos_x 61 | del pos_x 62 | if dim == 2: 63 | self.nodes[:,0] = pos_x 64 | self.nodes[:,1] = pos_y 65 | del pos_x 66 | del pos_y 67 | if dim >= 3: 68 | self.nodes[:,0] = pos_x 69 | self.nodes[:,1] = pos_y 70 | self.nodes[:,2] = pos_z 71 | del pos_x 72 | del pos_y 73 | del pos_z 74 | 75 | ## Computes the minimal distance between all nodes 76 | # @return Minimal distance 77 | def getMinDist(self): 78 | tmp = float('inf') 79 | for i in range(0,self.amount): 80 | for j in range(0,self.amount): 81 | if i != j: 82 | #if dim == 1: 83 | val = np.linalg.norm(self.nodes[i,:]-self.nodes[j,:]) 84 | if val < tmp: 85 | 86 | tmp = val 87 | return tmp 88 | -------------------------------------------------------------------------------- /peripydic/IO/output.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | #@author: ilyass.tabiai@polymtl.ca 3 | #@author: rolland.delorme@polymtl.ca 4 | #@author: patrickdiehl@lsu.edu 5 | import csv 6 | import numpy as np 7 | 8 | ## Class handles the output for CSV files 9 | class OutputCSV(): 10 | ## Constructor 11 | # @param outType Type of the output 12 | # @param dataType The data, which is written to the CSV file 13 | # @param inputFile The file where the output is written 14 | def __init__(self, outType, dataType, inputFile): 15 | ## Type of the output 16 | self.outType = outType 17 | ## Filename for the output file 18 | self.inputFile = inputFile 19 | ## Type of the written data 20 | self.dataType = dataType 21 | ## Writes the data to the CSV file 22 | # @param deck The object containing the configuration of the yaml file 23 | # @param problem The object containing the computational values 24 | def write(self, deck, problem): 25 | with open(self.inputFile, 'wb') as csvfile: 26 | spamwriter = csv.writer(csvfile, delimiter=' ', quotechar='|') 27 | header = [] 28 | header.append("#Time") 29 | header.append("ID") 30 | if self.dataType == "Position": 31 | pos = ['X','Y','Z'] 32 | for i in range(0, deck.dim): 33 | header.append(pos[i]) 34 | spamwriter.writerow(header) 35 | for t in range(0, deck.time_steps): 36 | s = [t] 37 | for i in range(0,deck.num_nodes): 38 | s.append(i) 39 | if deck.dim >= 1: 40 | s.append(problem.y[i][0][t]) 41 | if deck.dim >= 2: 42 | s.append(problem.y[i][1][t]) 43 | if deck.dim >= 3: 44 | s.append(problem.y[i][2][t]) 45 | spamwriter.writerow(s) 46 | s = [t] 47 | 48 | -------------------------------------------------------------------------------- /peripydic/IO/vis.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | #@author: ilyass.tabiai@polymtl.ca 3 | #@author: rolland.delorme@polymtl.ca 4 | #@author: patrickdiehl@lsu.edu 5 | 6 | import pkgutil 7 | vtk_loader = pkgutil.find_loader('vtk') 8 | found_vtk = vtk_loader is not None 9 | if found_vtk == True: 10 | import vtk 11 | ## Handles the output of the simulation results to vtk unstrucutred grids 12 | class vtk_writer(): 13 | 14 | if found_vtk == True: 15 | 16 | ## Constructor 17 | # 18 | # @param path The path where the output is written 19 | # @param types The simulation attributes considered as output 20 | # @param slice_length Every n-th time step is written 21 | def __init__(self,path="",types="",slice_length=-1): 22 | ## IS vtk enabled 23 | self.vtk_enabled = True 24 | ## Path for the output 25 | self.path = path 26 | ## Types of the attributes 27 | self.types = types 28 | ## Slice for the time steps 29 | self.slice_length = slice_length 30 | 31 | ## Writes the data to a vtk unstrucutred grid files 32 | # 33 | # @param deck The deck with the input from the yaml file 34 | # @param problem The problem contains the simulation results 35 | # @param ccm_class The results from the computation from ccm 36 | def write_data(self,deck,problem,ccm_class): 37 | num_nodes = deck.num_nodes 38 | for t in range(0,deck.time_steps,self.slice_length): 39 | writer = vtk.vtkXMLUnstructuredGridWriter() 40 | writer.SetFileName(self.path+"output_"+str(t)+".vtu") 41 | grid = vtk.vtkUnstructuredGrid() 42 | points = vtk.vtkPoints() 43 | points.SetNumberOfPoints(num_nodes) 44 | points.SetDataTypeToDouble() 45 | for i in range(0,num_nodes): 46 | act = problem.y 47 | if deck.dim == 1: 48 | points.InsertPoint(i,act[i][0][t],0.,0.) 49 | if deck.dim == 2: 50 | points.InsertPoint(i,act[i][0][t],act[i][1][t],0.) 51 | if deck.dim == 3: 52 | points.InsertPoint(i,act[i][0][t],act[i][1][t],act[i][2][t]) 53 | grid.SetPoints(points) 54 | 55 | dataOut = grid.GetPointData() 56 | 57 | for out_type in self.types: 58 | 59 | if out_type == "Displacement": 60 | array = vtk.vtkDoubleArray() 61 | array.SetName("Displacement") 62 | array.SetNumberOfComponents(deck.dim) 63 | array.SetNumberOfTuples(num_nodes) 64 | 65 | act = problem.y 66 | 67 | for i in range(num_nodes): 68 | if deck.dim == 1: 69 | array.SetTuple1(i,act[i][0][t] - deck.geometry.nodes[i][0]) 70 | if deck.dim == 2: 71 | array.SetTuple2(i,act[i][0][t] - deck.geometry.nodes[i][0],act[i][1][t] - deck.geometry.nodes[i][1]) 72 | array.SetComponentName(0,"d_x") 73 | array.SetComponentName(1,"d_y") 74 | dataOut.AddArray(array) 75 | 76 | if out_type == "Neighbors": 77 | array = vtk.vtkIntArray() 78 | array.SetName("Neighbors") 79 | array.SetNumberOfComponents(1) 80 | array.SetNumberOfTuples(num_nodes) 81 | 82 | for i in range(num_nodes): 83 | array.SetTuple1(i,len(problem.neighbors.get_index_x_family(i))) 84 | dataOut.AddArray(array) 85 | 86 | if out_type == "Force": 87 | array = vtk.vtkDoubleArray() 88 | array.SetName("Volume_Force") 89 | array.SetNumberOfComponents(deck.dim) 90 | array.SetNumberOfTuples(num_nodes) 91 | 92 | force = problem.force_int 93 | #print force 94 | for i in range(num_nodes): 95 | if deck.dim == 1: 96 | array.SetTuple1(i,force[i][0][t]) 97 | if deck.dim == 2: 98 | array.SetTuple2(i,force[i][0][t], force[i][1][t]) 99 | array.SetComponentName(0,"f_x") 100 | array.SetComponentName(1,"f_y") 101 | dataOut.AddArray(array) 102 | 103 | if out_type == "Conditions": 104 | 105 | for con in deck.conditions: 106 | array = vtk.vtkIntArray() 107 | array.SetName("Condition_"+con.type+"_"+str(con.value)+"_"+str(con.direction)) 108 | array.SetNumberOfComponents(1) 109 | array.SetNumberOfTuples(num_nodes) 110 | 111 | for i in range(num_nodes): 112 | if i not in con.id: 113 | array.SetTuple1(i,0) 114 | else: 115 | array.SetTuple1(i,1) 116 | dataOut.AddArray(array) 117 | 118 | if out_type == "Volume_Force": 119 | 120 | force = problem.force_int 121 | for con in deck.conditions: 122 | if con.type == "Force": 123 | result_x = 0. 124 | result_y = 0. 125 | result_z = 0. 126 | for i in con.id: 127 | index = int(i) 128 | 129 | if deck.dim >=1: 130 | result_x += force[index][0][t] * deck.geometry.volumes[index] 131 | if deck.dim >= 2: 132 | result_y += force[index][1][t] * deck.geometry.volumes[index] 133 | array.SetComponentName(0,"f_x") 134 | array.SetComponentName(1,"f_y") 135 | if deck.dim >= 3: 136 | result_z += force[index][2][t] * deck.geometry.volumes[index] 137 | array.SetComponentName(2,"f_z") 138 | 139 | array = vtk.vtkDoubleArray() 140 | array.SetName("Volume_"+con.type+"_"+str(con.value)+"_"+str(con.direction)) 141 | array.SetNumberOfComponents(deck.dim) 142 | array.SetNumberOfTuples(num_nodes) 143 | 144 | 145 | for i in range(num_nodes): 146 | if i in con.id: 147 | if deck.dim ==1: 148 | array.SetTuple1(i,result_x) 149 | if deck.dim == 2: 150 | array.SetTuple2(i,result_x,result_y) 151 | if deck.dim == 3: 152 | array.SetTuple3(i,result_x,result_y,result_z) 153 | else: 154 | if deck.dim ==1: 155 | array.SetTuple1(i,0.) 156 | if deck.dim == 2: 157 | array.SetTuple2(i,0.,0.) 158 | if deck.dim == 3: 159 | array.SetTuple3(i,0.,0.,0.) 160 | dataOut.AddArray(array) 161 | 162 | if out_type == "Strain": 163 | array = vtk.vtkDoubleArray() 164 | array.SetName("Strain") 165 | if deck.dim == 1: 166 | array.SetNumberOfComponents(1) 167 | if deck.dim == 2: 168 | array.SetNumberOfComponents(3) 169 | if deck.dim == 3: 170 | array.SetNumberOfComponents(6) 171 | array.SetNumberOfTuples(num_nodes) 172 | 173 | strain = ccm_class.global_strain[:,:,1] 174 | 175 | for i in range(num_nodes): 176 | if deck.dim ==1: 177 | array.SetComponentName(0,"epsil_xx") 178 | array.SetTuple1(i,strain[i,0]) 179 | if deck.dim == 2: 180 | xx = strain[i*deck.dim,0] 181 | xy = strain[i*deck.dim,1] 182 | yy = strain[i*deck.dim+1,1] 183 | array.SetTuple3(i,xx,yy,xy) 184 | array.SetComponentName(0,"epsil_xx") 185 | array.SetComponentName(1,"epsil_yy") 186 | array.SetComponentName(2,"epsil_xy") 187 | if deck.dim == 3: 188 | xx = strain[i*deck.dim,0] 189 | xy = strain[i*deck.dim,1] 190 | yy = strain[i*deck.dim+1,1] 191 | yz = strain[i*deck.dim+1,2] 192 | xz = strain[i*deck.dim,2] 193 | zz = strain[i*deck.dim+2,2] 194 | array.SetTuple6(i,xx,yy,zz,yz,xz,xy) 195 | array.SetComponentName(0,"epsil_xx") 196 | array.SetComponentName(1,"epsil_yy") 197 | array.SetComponentName(2,"epsil_zz") 198 | array.SetComponentName(3,"epsil_yz") 199 | array.SetComponentName(4,"epsil_xz") 200 | array.SetComponentName(5,"epsil_xy") 201 | dataOut.AddArray(array) 202 | 203 | if out_type == "Stress": 204 | array = vtk.vtkDoubleArray() 205 | array.SetName("Stress") 206 | if deck.dim == 1: 207 | array.SetNumberOfComponents(1) 208 | if deck.dim == 2: 209 | array.SetNumberOfComponents(3) 210 | if deck.dim == 3: 211 | array.SetNumberOfComponents(6) 212 | array.SetNumberOfTuples(num_nodes) 213 | 214 | stress = ccm_class.global_stress[:,:,1] 215 | 216 | for i in range(num_nodes): 217 | if deck.dim ==1: 218 | array.SetComponentName(0,"sigma_xx") 219 | array.SetTuple1(i,strain[i,0]) 220 | if deck.dim == 2: 221 | xx = stress[i*deck.dim,0] 222 | xy = stress[i*deck.dim,1] 223 | yy = stress[i*deck.dim+1,1] 224 | array.SetTuple3(i,xx,yy,xy) 225 | array.SetComponentName(0,"sigma_xx") 226 | array.SetComponentName(1,"sigma_yy") 227 | array.SetComponentName(2,"sigma_xy") 228 | if deck.dim == 3: 229 | xx = stress[i*deck.dim,0] 230 | xy = stress[i*deck.dim,1] 231 | yy = stress[i*deck.dim+1,1] 232 | yz = stress[i*deck.dim+1,2] 233 | xz = stress[i*deck.dim,2] 234 | zz = stress[i*deck.dim+2,2] 235 | array.SetTuple6(i,xx,yy,zz,yz,xz,xy) 236 | array.SetComponentName(0,"sigma_xx") 237 | array.SetComponentName(1,"sigma_yy") 238 | array.SetComponentName(2,"sigma_zz") 239 | array.SetComponentName(3,"sigma_yz") 240 | array.SetComponentName(4,"sigma_xz") 241 | array.SetComponentName(5,"sigma_xy") 242 | dataOut.AddArray(array) 243 | 244 | if out_type == "Strain_DIC": 245 | array = vtk.vtkDoubleArray() 246 | array.SetName("Strain_DIC") 247 | array.SetNumberOfComponents(3) 248 | array.SetNumberOfTuples(num_nodes) 249 | 250 | for i in range(num_nodes): 251 | xx = deck.geometry.strain[i][0] 252 | xy = deck.geometry.strain[i][2] 253 | yy = deck.geometry.strain[i][1] 254 | array.SetTuple3(i,xx,yy,xy) 255 | array.SetComponentName(0,"epsil_xx") 256 | array.SetComponentName(1,"epsil_yy") 257 | array.SetComponentName(2,"epsil_xy") 258 | dataOut.AddArray(array) 259 | 260 | if out_type == "Strain_Error": 261 | array = vtk.vtkDoubleArray() 262 | array.SetName("Strain_Error") 263 | array.SetNumberOfComponents(3) 264 | array.SetNumberOfTuples(num_nodes) 265 | 266 | strain = ccm_class.global_strain[:,:,1] 267 | 268 | for i in range(num_nodes): 269 | xx = abs(deck.geometry.strain[i][0] - strain[i*deck.dim,0]) 270 | xy = abs(deck.geometry.strain[i][2] - strain[i*deck.dim,1]) 271 | yy = abs(deck.geometry.strain[i][1] - strain[i*deck.dim+1,1]) 272 | array.SetTuple3(i,xx,yy,xy) 273 | array.SetComponentName(0,"error_xx") 274 | array.SetComponentName(1,"error_yy") 275 | array.SetComponentName(2,"error_xy") 276 | dataOut.AddArray(array) 277 | 278 | if out_type == "Strain_Energy": 279 | array = vtk.vtkDoubleArray() 280 | array.SetName("Strain_Energy") 281 | array.SetNumberOfComponents(1) 282 | array.SetNumberOfTuples(num_nodes) 283 | 284 | strain_energy = problem.strain_energy 285 | 286 | for i in range(num_nodes): 287 | array.SetTuple1(i,strain_energy[i]) 288 | 289 | dataOut.AddArray(array) 290 | 291 | if out_type == "Volume": 292 | array = vtk.vtkDoubleArray() 293 | array.SetName("Volume") 294 | array.SetNumberOfComponents(1) 295 | array.SetNumberOfTuples(num_nodes) 296 | 297 | for i in range(num_nodes): 298 | array.SetTuple1(i,deck.geometry.volumes[i]) 299 | 300 | dataOut.AddArray(array) 301 | 302 | writer.SetInputData(grid) 303 | 304 | writer.GetCompressor().SetCompressionLevel(0) 305 | writer.SetDataModeToAscii() 306 | writer.Write() 307 | 308 | else: 309 | 310 | ## Constructor 311 | # 312 | # @param path The path where the output is written 313 | # @param types The simulation attributes considered as output 314 | # @param slice_length Every n-th time step is written 315 | def __init__(self,path="",types="",slice_length=-1): 316 | self.vtk_enabled = False 317 | -------------------------------------------------------------------------------- /peripydic/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | #@author: ilyass.tabiai@polymtl.ca 3 | #@author: rolland.delorme@polymtl.ca 4 | #@author: patrickdiehl@lsu.edu 5 | 6 | from .problem import * 7 | from .materials import * 8 | from .util import * 9 | from .IO import * -------------------------------------------------------------------------------- /peripydic/doc/doc.bat: -------------------------------------------------------------------------------- 1 | doxygen.exe configuration.doxy 2 | -------------------------------------------------------------------------------- /peripydic/doc/doc.sh: -------------------------------------------------------------------------------- 1 | sed ' 1 s/.*/&{#mainpage}/' ../README.md > README.md 2 | 3 | doxygen configuration.doxy 4 | -------------------------------------------------------------------------------- /peripydic/materials/__init__.py: -------------------------------------------------------------------------------- 1 | ##@package materials 2 | # Provides the different materials 3 | #@author: ilyass.tabiai@polymtl.ca 4 | #@author: rolland.delorme@polymtl.ca 5 | #@author: patrickdiehl@lsu.edu 6 | 7 | from .elastic import * 8 | from .viscoelastic import * 9 | -------------------------------------------------------------------------------- /peripydic/materials/elastic.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | #@author: ilyass.tabiai@polymtl.ca 3 | #@author: rolland.delorme@polymtl.ca 4 | #@author: patrickdiehl@lsu.edu 5 | import numpy as np 6 | from scipy import linalg 7 | from multiprocessing import Process, Lock 8 | import sharedmem 9 | from ..util import linalgebra 10 | from ..util import functions 11 | 12 | 13 | ## Class to compute the global internal volumic force at each node of an elastic material using its material properties 14 | class Elastic_material(): 15 | 16 | ## Constructor 17 | # @param deck The input deck 18 | # @param data_solver Data from the peridynamic problem/solving class 19 | # @param y Actual nodes' position 20 | def __init__(self, deck, data_solver, y): 21 | 22 | ## Weighted volume 23 | self.Weighted_Volume = data_solver.weighted_volume 24 | 25 | ## Volume correction factor 26 | self.Volume_Correction = data_solver.volume_correction 27 | 28 | if deck.dim == 1: 29 | ## Young modulus of the material 30 | self.Young_Modulus = deck.young_modulus 31 | 32 | if deck.dim >= 2: 33 | ## Bulk modulus of the material 34 | self.K = deck.bulk_modulus 35 | ## Shear modulus of the material 36 | self.Mu = deck.shear_modulus 37 | 38 | if deck.dim == 2: 39 | ## Poisson ratio of the material 40 | self.Nu = (3. * self.K - 2. * self.Mu) / (2. * (3. * self.K + self.Mu)) 41 | if deck.type2d == "Plane_Stress": 42 | ## Factor applied for 2D plane stress to compute dilatation and force state 43 | self.factor2d = (2. * self.Nu - 1.) / (self.Nu - 1.) 44 | if deck.type2d == "Plane_Strain": 45 | ## Plane strain 46 | self.factor2d = 1 47 | 48 | ## Compute the dilatation for each node 49 | self.compute_dilatation(deck, data_solver, y) 50 | 51 | ## Compute the global internal force density at each node 52 | self.compute_f_int(deck, data_solver, y) 53 | 54 | ## Compute the strain energy density at each node 55 | self.compute_strain_energy(deck, data_solver) 56 | 57 | ## Compute the dilatation for each node 58 | # @param deck The input deck 59 | # @param data_solver Data from the peridynamic problem/solving class 60 | # @param y The actual nodes' position 61 | # @param start Starting Id of the loop 62 | # @param end Ending Id of the loop 63 | def compute_dilatation_slice(self, deck, data_solver, y, start, end): 64 | for i in range(start, end): 65 | index_x_family = data_solver.neighbors.get_index_x_family(i) 66 | n = 0 67 | for p in index_x_family: 68 | Y = (y[p,:]) - y[i,:] 69 | X = deck.geometry.nodes[p,:] - deck.geometry.nodes[i,:] 70 | self.e[i,n] = linalgebra.norm(Y) - linalgebra.norm(X) 71 | 72 | if deck.dim == 1: 73 | self.dilatation[i] += (1. / self.Weighted_Volume[i]) * functions.w(data_solver, X, deck.influence_function) * linalgebra.norm(X) * self.e[i,n] * self.Volume_Correction[i,n] * deck.geometry.volumes[p] 74 | 75 | if deck.dim == 2: 76 | self.dilatation[i] += (2. / self.Weighted_Volume[i]) * self.factor2d * functions.w(data_solver, X, deck.influence_function) * linalgebra.norm(X) * self.e[i,n] * self.Volume_Correction[i,n] * deck.geometry.volumes[p] 77 | 78 | if deck.dim == 3: 79 | self.dilatation[i] += (3. / self.Weighted_Volume[i]) * functions.w(data_solver, X, deck.influence_function) * linalgebra.norm(X) * self.e[i,n] * self.Volume_Correction[i,n] * deck.geometry.volumes[p] 80 | n += 1 81 | 82 | ## Compute the dilatation and and also the scalar extension state for each node 83 | # @param deck The input deck 84 | # @param data_solver Data from the peridynamic problem/solving class 85 | # @param y The actual nodes' position 86 | def compute_dilatation(self, deck, data_solver, y): 87 | ## Dilatation at each node 88 | self.dilatation = sharedmem.empty((deck.num_nodes),dtype=np.float64) 89 | ## Extension between Node "i" and Node "p" within its family 90 | self.e = sharedmem.empty((deck.num_nodes, data_solver.neighbors.max_neighbors),dtype=np.float64) 91 | 92 | threads = deck.num_threads 93 | part = int(deck.num_nodes/threads) 94 | 95 | processes = [] 96 | 97 | for i in range(0,threads): 98 | start = i * part 99 | if i < threads - 1: 100 | end = (i+1) * part 101 | else: 102 | end = deck.num_nodes 103 | processes.append(Process(target=self.compute_dilatation_slice, args=(deck, data_solver, y, start, end))) 104 | processes[i].start() 105 | 106 | for p in processes: 107 | p.join() 108 | 109 | ## Compute the global internal force density at each node 110 | # @param deck The input deck 111 | # @param data_solver Data from the peridynamic problem/solving class 112 | # @param y The actual nodes' position 113 | # @param start Starting Id of the loop 114 | # @param end Ending Id of the loop 115 | def compute_f_int_slice(self, deck, data_solver, y, start, end, data): 116 | for i in range(start, end): 117 | index_x_family = data_solver.neighbors.get_index_x_family(i) 118 | n = 0 119 | for p in index_x_family: 120 | Y = y[p,:] - y[i,:] 121 | X = deck.geometry.nodes[p,:] - deck.geometry.nodes[i,:] 122 | 123 | # Compute the direction vector between Node_p and Node_i 124 | M = Y / linalgebra.norm(Y) 125 | 126 | if deck.dim == 1: 127 | # PD material parameter 128 | alpha = self.Young_Modulus / self.Weighted_Volume[i] 129 | ## Scalar force state 130 | self.t = alpha * functions.w(data_solver, X, deck.influence_function) * self.e[i,n] 131 | 132 | if deck.dim == 2: 133 | # PD material parameter 134 | if deck.type2d == "Plane_Stress": 135 | alpha_s = (9. / self.Weighted_Volume[i]) * (self.K + ((self.Nu + 1.)/(2. * self.Nu - 1.))**2 * self.Mu / 9.) 136 | if deck.type2d == "Plane_Strain": 137 | alpha_s = (9. / self.Weighted_Volume[i]) * (self.K + self.Mu / 9.) 138 | 139 | alpha_d = (8. / self.Weighted_Volume[i]) * self.Mu 140 | # Scalar extension states 141 | e_s = self.dilatation[i] * linalgebra.norm(X) / 3. 142 | e_d = self.e[i,n] - e_s 143 | # Scalar force states 144 | t_s = (2. * self.factor2d * alpha_s - (3. - 2. * self.factor2d) * alpha_d) * functions.w(data_solver, X, deck.influence_function) * e_s / 3. 145 | t_d = alpha_d * functions.w(data_solver, X, deck.influence_function) * e_d 146 | self.t = t_s + t_d 147 | 148 | if deck.dim == 3: 149 | # PD material parameter 150 | alpha_s = (9. / self.Weighted_Volume[i]) * self.K 151 | alpha_d = (15. / self.Weighted_Volume[i]) * self.Mu 152 | # Scalar extension states 153 | e_s = self.dilatation[i] * linalgebra.norm(X) / 3. 154 | e_d = self.e[i,n] - e_s 155 | # Scalar force states 156 | t_s = alpha_s * functions.w(data_solver, X, deck.influence_function) * e_s 157 | t_d = alpha_d * functions.w(data_solver, X, deck.influence_function) * e_d 158 | self.t = t_s + t_d 159 | 160 | #lock.acquire() 161 | data[i,:] += self.t * M * self.Volume_Correction[i,n] * deck.geometry.volumes[p] 162 | data[p,:] += -self.t * M * self.Volume_Correction[i,n] * deck.geometry.volumes[i] 163 | #lock.release() 164 | n += 1 165 | 166 | ## Compute the global internal force density at each node 167 | # @param deck The input deck 168 | # @param data_solver Data from the peridynamic problem/solving class 169 | # @param y The actual nodes' position 170 | def compute_f_int(self, deck, data_solver, y): 171 | ## Internal force density at each node 172 | self.f_int = sharedmem.empty((deck.num_nodes, deck.dim),dtype=np.float64) 173 | #self.f_int.fill(0.0) 174 | #lock = Lock() 175 | threads = deck.num_threads 176 | part = int(deck.num_nodes/threads) 177 | 178 | processes = [] 179 | data = [] 180 | for i in range(0,threads): 181 | start = i * part 182 | if i < threads - 1: 183 | end = (i+1) * part 184 | else: 185 | end = deck.num_nodes 186 | data.append(sharedmem.empty((deck.num_nodes, deck.dim),dtype=np.float64)) 187 | #data[i].fill(0) 188 | processes.append(Process(target=self.compute_f_int_slice, args=(deck, data_solver, y, start, end, data[i]))) 189 | processes[i].start() 190 | 191 | for p in processes: 192 | p.join() 193 | 194 | for i in range(0,threads): 195 | self.f_int += data[i] 196 | 197 | ## Computes the strain energy density for each PD node 198 | # @param deck The input deck 199 | # @param data_solver Data from the peridynamic problem/solving class 200 | # @param start Starting Id of the loop 201 | # @param end Ending Id of the loop 202 | def compute_strain_energy_slice(self, deck, data_solver, start, end): 203 | for i in range(start, end): 204 | index_x_family = data_solver.neighbors.get_index_x_family(i) 205 | n = 0 206 | for p in index_x_family: 207 | X = deck.geometry.nodes[p,:] - deck.geometry.nodes[i,:] 208 | if deck.dim == 1: 209 | # PD material parameter 210 | alpha = self.Young_Modulus / self.Weighted_Volume[i] 211 | # Strain energy density 212 | self.strain_energy[i] += 0.5 * alpha * functions.w(data_solver, X, deck.influence_function) * self.e[i,n]**2 * self.Volume_Correction[i,n] * deck.geometry.volumes[p] 213 | 214 | if deck.dim >= 2: 215 | X = deck.geometry.nodes[p,:] - deck.geometry.nodes[i,:] 216 | if deck.dim == 2: 217 | # PD material parameter 218 | if deck.type2d == "Plane_Stress": 219 | alpha_s = (9. / self.Weighted_Volume[i]) * (self.K + ((self.Nu + 1.)/(2. * self.Nu - 1.))**2 * self.Mu / 9.) 220 | if deck.type2d == "Plane_Strain": 221 | alpha_s = (9. / self.Weighted_Volume[i]) * (self.K + self.Mu / 9.) 222 | alpha_d = (8. / self.Weighted_Volume[i]) * self.Mu 223 | 224 | if deck.dim == 3: 225 | # PD material parameter 226 | alpha_s = (9. / self.Weighted_Volume[i]) * self.K 227 | alpha_d = (15. / self.Weighted_Volume[i]) * self.Mu 228 | 229 | # Scalar extension states 230 | e_s = self.dilatation[i] * linalgebra.norm(X) / 3. 231 | e_d = self.e[i,n] - e_s 232 | # Strain energy density 233 | self.strain_energy[i] += 0.5 * functions.w(data_solver, X, deck.influence_function) * (alpha_s * e_s**2 + alpha_d * e_d**2) * self.Volume_Correction[i,n] * deck.geometry.volumes[p] 234 | n += 1 235 | 236 | ## Compute the strain energy density at each node 237 | # @param deck The input deck 238 | # @param data_solver Data from the peridynamic problem/solving class 239 | def compute_strain_energy(self, deck, data_solver): 240 | ## Strain energy density at each node 241 | self.strain_energy = sharedmem.empty((deck.num_nodes),dtype=np.float64) 242 | 243 | threads = deck.num_threads 244 | part = int(deck.num_nodes/threads) 245 | 246 | processes = [] 247 | 248 | for i in range(0,threads): 249 | start = i * part 250 | if i < threads - 1: 251 | end = (i+1) * part 252 | else: 253 | end = deck.num_nodes 254 | processes.append(Process(target=self.compute_strain_energy_slice, args=(deck, data_solver, start, end))) 255 | processes[i].start() 256 | 257 | for p in processes: 258 | p.join() 259 | -------------------------------------------------------------------------------- /peripydic/materials/viscoelastic.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | #@author: ilyass.tabiai@polymtl.ca 3 | #@author: rolland.delorme@polymtl.ca 4 | #@author: patrickdiehl@lsu.edu 5 | import numpy as np 6 | from scipy import linalg 7 | from multiprocessing import Process, Lock 8 | import sharedmem 9 | from ..util import linalgebra 10 | from ..util import functions 11 | #import warnings 12 | #warnings.filterwarnings("error") 13 | 14 | ## Class to compute the global internal volumic force at each node of an elastic material using its material properties 15 | class Viscoelastic_material(): 16 | 17 | ## Constructor 18 | # @param deck The input deck 19 | # @param data_solver Data from the peridynamic problem/solving class 20 | # @param y Actual nodes' position 21 | # @param t_n Id of the time step 22 | def __init__(self, deck, data_solver, y, t_n): 23 | 24 | ## Weighted volume 25 | self.Weighted_Volume = data_solver.weighted_volume 26 | 27 | ## Volume correction factor 28 | self.Volume_Correction = data_solver.volume_correction 29 | 30 | if deck.dim == 1: 31 | ## Relaxation modulus of the material 32 | self.Relax_Modulus = deck.relax_modulus 33 | 34 | if deck.dim >= 2: 35 | ## Bulk modulus of the material 36 | self.K = deck.relax_bulk_modulus 37 | ## Shear modulus of the material 38 | self.Mu = deck.relax_shear_modulus 39 | 40 | if deck.dim == 2: 41 | ## Poisson ratio of the material 42 | self.Nu = (3. * self.K - 2. * self.Mu) / (2. * (3. * self.K + self.Mu)) 43 | if deck.type2d == "Plane_Stress": 44 | ## Factor applied for 2D plane stress to compute dilatation and force state 45 | self.factor2d = (2. * self.Nu - 1.) / (self.Nu - 1.) 46 | if deck.type2d == "Plane_Strain": 47 | ## Plane strain 48 | self.factor2d = 1 49 | 50 | ## Relaxation time of the material 51 | self.Relax_Time = deck.relax_time 52 | 53 | ## Compute the dilatation for each node 54 | self.compute_dilatation(deck, data_solver, y) 55 | 56 | ## Compute the viscoelastic part of the dilatation for each node 57 | self.compute_dilatation_visco(deck, data_solver, y, t_n) 58 | 59 | ## Compute the global internal force density at each node 60 | self.compute_f_int(deck, data_solver, y) 61 | 62 | ## Compute the dilatation for each node 63 | # @param deck The input deck 64 | # @param data_solver Data from the peridynamic problem/solving class 65 | # @param y The actual nodes' position 66 | # @param start Starting Id of the loop 67 | # @param end Ending Id of the loop 68 | def compute_dilatation_slice(self, deck, data_solver, y, start, end): 69 | for i in range(start, end): 70 | index_x_family = data_solver.neighbors.get_index_x_family(i) 71 | n = 0 72 | for p in index_x_family: 73 | Y = (y[p,:]) - y[i,:] 74 | X = deck.geometry.nodes[p,:] - deck.geometry.nodes[i,:] 75 | self.e[i,n] = linalgebra.norm(Y) - linalgebra.norm(X) 76 | 77 | if deck.dim == 1: 78 | self.dilatation[i] += (1. / self.Weighted_Volume[i]) * functions.w( data_solver, X, deck.influence_function) * linalgebra.norm(X) * self.e[i,n] * self.Volume_Correction[i,n] * deck.geometry.volumes[p] 79 | 80 | if deck.dim == 2: 81 | self.dilatation[i] += (2. / self.Weighted_Volume[i]) * self.factor2d[0] * functions.w( data_solver, X, deck.influence_function) * linalgebra.norm(X) * self.e[i,n] * self.Volume_Correction[i,n] * deck.geometry.volumes[p] 82 | 83 | if deck.dim == 3: 84 | self.dilatation[i] += (3. / self.Weighted_Volume[i]) * functions.w( data_solver, X, deck.influence_function) * linalgebra.norm(X) * self.e[i,n] * self.Volume_Correction[i,n] * deck.geometry.volumes[p] 85 | n += 1 86 | 87 | ## Compute the dilatation and also the scalar extension state for each node 88 | # @param deck The input deck 89 | # @param data_solver Data from the peridynamic problem/solving class 90 | # @param y The actual nodes' position 91 | def compute_dilatation(self, deck, data_solver, y): 92 | ## Dilatation at each node 93 | self.dilatation = sharedmem.empty((deck.num_nodes),dtype=np.float64) 94 | ## Extension between Node "i" and Node "p" within its family 95 | self.e = sharedmem.empty((deck.num_nodes, data_solver.neighbors.max_neighbors),dtype=np.float64) 96 | 97 | threads = deck.num_threads 98 | part = int(deck.num_nodes/threads) 99 | 100 | processes = [] 101 | 102 | for i in range(0,threads): 103 | start = i * part 104 | if i < threads - 1: 105 | end = (i+1) * part 106 | else: 107 | end = deck.num_nodes 108 | 109 | processes.append(Process(target=self.compute_dilatation_slice, args=(deck, data_solver, y, start, end))) 110 | processes[i].start() 111 | 112 | for p in processes: 113 | p.join() 114 | 115 | ## Compute the viscoelastic part of the scalar extension state 116 | # @param deck The input deck 117 | # @param data_solver Data from the peridynamic problem/solving class 118 | # @param y The actual nodes' position 119 | # @param t_n Id of the time step 120 | # @param start Starting Id of the loop 121 | # @param end Ending Id of the loop 122 | def compute_dilatation_visco_slice(self, deck, data_solver, y, t_n, start, end): 123 | for i in range(start, end): 124 | index_x_family = data_solver.neighbors.get_index_x_family(i) 125 | n = 0 126 | for p in index_x_family: 127 | X = deck.geometry.nodes[p,:] - deck.geometry.nodes[i,:] 128 | for k in range(1, len(self.Relax_Time)): 129 | tmp_exp = np.exp((- deck.delta_t) / (self.Relax_Time[k])) 130 | #print i, n, p 131 | delta_e = self.e[i, n] - data_solver.ext[i, n, t_n-1] 132 | beta = 1.0 - (self.Relax_Time[k] * (1.0 - tmp_exp)) / deck.delta_t 133 | self.e_visco[i,n,k] = data_solver.ext[i, n, t_n-1] * (1.0 - tmp_exp) + data_solver.ext_visco[i, n, k, t_n-1] * tmp_exp + beta * delta_e 134 | 135 | if deck.dim == 1: 136 | self.dilatation_visco[i,k] += (1. / self.Weighted_Volume[i]) * functions.w( data_solver, X, deck.influence_function) * linalgebra.norm(X) * (self.e[i,n] - self.e_visco[i, n, k]) * self.Volume_Correction[i,n] * deck.geometry.volumes[p] 137 | 138 | if deck.dim == 2: 139 | self.dilatation_visco[i,k] += (2. / self.Weighted_Volume[i]) * self.factor2d[k] * functions.w( data_solver, X, deck.influence_function) * linalgebra.norm(X) * (self.e[i,n] - self.e_visco[i, n, k]) * self.Volume_Correction[i,n] * deck.geometry.volumes[p] 140 | 141 | if deck.dim == 3: 142 | self.dilatation_visco[i,k] += (3. / self.Weighted_Volume[i]) * functions.w( data_solver, X, deck.influence_function) * linalgebra.norm(X) * (self.e[i,n] - self.e_visco[i, n, k]) * self.Volume_Correction[i,n] * deck.geometry.volumes[p] 143 | n +=1 144 | 145 | ## Compute the viscoelastic part of the scalar extension state 146 | # @param deck The input deck 147 | # @param data_solver Data from the peridynamic problem/solving class 148 | # @param y The actual nodes' position 149 | # @param t_n Id of the time step 150 | def compute_dilatation_visco(self, deck, data_solver, y, t_n): 151 | ## Dilatation at each node 152 | self.dilatation_visco = sharedmem.empty((deck.num_nodes, len(self.Relax_Time)),dtype=np.float64) 153 | ## Extension between Node "i" and Node "p" within its family 154 | self.e_visco = sharedmem.empty((deck.num_nodes, data_solver.neighbors.max_neighbors, len(self.Relax_Time)),dtype=np.float64) 155 | 156 | threads = deck.num_threads 157 | part = int(deck.num_nodes/threads) 158 | 159 | processes = [] 160 | 161 | for i in range(0,threads): 162 | start = i * part 163 | if i < threads - 1: 164 | end = (i+1) * part 165 | else: 166 | end = deck.num_nodes 167 | 168 | processes.append(Process(target=self.compute_dilatation_visco_slice, args=(deck, data_solver, y, t_n, start, end))) 169 | processes[i].start() 170 | 171 | for p in processes: 172 | p.join() 173 | 174 | ## Compute the global internal force density at each node 175 | # @param deck The input deck 176 | # @param data_solver Data from the peridynamic problem/solving class 177 | # @param y The actual nodes' position 178 | # @param start Starting Id of the loop 179 | # @param end Ending Id of the loop 180 | def compute_f_int_slice(self, deck, data_solver, y, start, end, data): 181 | #print start , end 182 | for i in range(start, end): 183 | index_x_family = data_solver.neighbors.get_index_x_family(i) 184 | n = 0 185 | for p in index_x_family: 186 | Y = y[p,:] - y[i,:] 187 | X = deck.geometry.nodes[p,:] - deck.geometry.nodes[i,:] 188 | 189 | # Compute the direction vector between Node_p and Node_i 190 | M = Y / linalgebra.norm(Y) 191 | 192 | if deck.dim == 1: 193 | t_visco = 0.0 194 | for k in range(1, len(self.Relax_Time)): 195 | # PD viscoelastic material parameter 196 | alpha_k = self.Relax_Modulus[k] / self.Weighted_Volume[i] 197 | # Viscoelastic part of the scalar force state 198 | t_visco += alpha_k * functions.w( data_solver, X, deck.influence_function) * (self.e[i,n] - self.e_visco[i,n,k]) 199 | 200 | # PD elastic material parameter 201 | alpha_0 = self.Relax_Modulus[0] / self.Weighted_Volume[i] 202 | ## Scalar force state 203 | self.t = alpha_0 * functions.w( data_solver, X, deck.influence_function) * self.e[i,n] + t_visco 204 | 205 | if deck.dim == 2: 206 | # Scalar extension states 207 | e_s = self.dilatation[i] * linalgebra.norm(X) / 3. 208 | e_d = self.e[i,n] - e_s 209 | 210 | t_s_visco = 0.0 211 | t_d_visco = 0.0 212 | for k in range(1, len(self.Relax_Time)): 213 | # Scalar visco extension states 214 | e_s_visco = self.dilatation_visco[i,k] * linalgebra.norm(X) / 3. 215 | e_d_visco = self.e_visco[i,n,k] - e_s_visco 216 | # PD viscoelastic material parameter 217 | if deck.type2d == "Plane_Stress": 218 | alpha_s_k = (9. / self.Weighted_Volume[i]) * (self.K[k] + ((self.Nu[k] + 1.)/(2. * self.Nu[k] - 1.))**2 * self.Mu[k] / 9.) 219 | if deck.type2d == "Plane_Strain": 220 | alpha_s_k = (9. / self.Weighted_Volume[i]) * (self.K[k] + self.Mu[k] / 9.) 221 | alpha_d_k = (8. / self.Weighted_Volume[i]) * self.Mu[k] 222 | # Viscoelastic parts of the scalar force state 223 | t_s_visco += (2. * self.factor2d[k] * alpha_s_k - (3. - 2. * self.factor2d[k]) * alpha_d_k) * functions.w( data_solver, X, deck.influence_function) * (e_s - e_s_visco) / 3. 224 | t_d_visco += alpha_d_k * functions.w( data_solver, X, deck.influence_function) * (e_d - e_d_visco) 225 | 226 | # PD elastic material parameter 227 | if deck.type2d == "Plane_Stress": 228 | alpha_s_0 = (9. / self.Weighted_Volume[i]) * (self.K[0] + ((self.Nu[0] + 1.)/(2. * self.Nu[0] - 1.))**2 * self.Mu[0] / 9.) 229 | if deck.type2d == "Plane_Strain": 230 | alpha_s_0 = (9. / self.Weighted_Volume[i]) * (self.K[0] + self.Mu[0] / 9.) 231 | alpha_d_0 = (8. / self.Weighted_Volume[i]) * self.Mu[0] 232 | # Scalar force states 233 | t_s = (2. * self.factor2d[0] * alpha_s_0 - (3. - 2. * self.factor2d[0]) * alpha_d_0) * functions.w( data_solver, X, deck.influence_function) * e_s / 3. + t_s_visco 234 | t_d = alpha_d_0 * functions.w( data_solver, X, deck.influence_function) * e_d + t_d_visco 235 | self.t = t_s + t_d 236 | 237 | if deck.dim == 3: 238 | # Scalar extension states 239 | e_s = self.dilatation[i] * linalgebra.norm(X) / 3. 240 | e_d = self.e[i,n] - e_s 241 | 242 | t_s_visco = 0.0 243 | t_d_visco = 0.0 244 | for k in range(1, len(self.Relax_Time)): 245 | # Scalar visco extension states 246 | e_s_visco = self.dilatation_visco[i,k] * linalgebra.norm(X) / 3. 247 | e_d_visco = self.e_visco[i,n,k] - e_s_visco 248 | # PD viscoelastic material parameter 249 | alpha_s_k = (9. / self.Weighted_Volume[i]) * self.K[k] 250 | alpha_d_k = (15. / self.Weighted_Volume[i]) * self.Mu[k] 251 | # Viscoelastic parts of the scalar force state 252 | t_s_visco += alpha_s_k * functions.w( data_solver, X, deck.influence_function) * (e_s - e_s_visco) 253 | t_d_visco += alpha_d_k * functions.w( data_solver, X, deck.influence_function) * (e_d - e_d_visco) 254 | 255 | # PD elastic material parameter 256 | alpha_s_0 = (9. / self.Weighted_Volume[i]) * self.K[0] 257 | alpha_d_0 = (15. / self.Weighted_Volume[i]) * self.Mu[0] 258 | # Scalar force states 259 | t_s = alpha_s_0 * functions.w( data_solver, X, deck.influence_function) * e_s + t_s_visco 260 | t_d = alpha_d_0 * functions.w( data_solver, X, deck.influence_function) * e_d + t_d_visco 261 | self.t = t_s + t_d 262 | 263 | #lock.acquire() 264 | data[i,:] += self.t * M * self.Volume_Correction[i,n] * deck.geometry.volumes[p] 265 | data[p,:] += -self.t * M * self.Volume_Correction[i,n] * deck.geometry.volumes[i] 266 | #lock.release() 267 | n += 1 268 | 269 | ## Compute the global internal force density at each node 270 | # @param deck The input deck 271 | # @param data_solver Data from the peridynamic problem/solving class 272 | # @param y The actual nodes' position 273 | def compute_f_int(self, deck, data_solver, y): 274 | ## Internal force density at each node 275 | self.f_int = sharedmem.empty((deck.num_nodes, deck.dim),dtype=np.float64) 276 | #self.f_int.fill(0.0) 277 | #lock = Lock() 278 | threads = deck.num_threads 279 | part = int(deck.num_nodes/threads) 280 | 281 | processes = [] 282 | data = [] 283 | for i in range(0,threads): 284 | start = i * part 285 | if i < threads - 1: 286 | end = (i+1) * part 287 | else: 288 | end = deck.num_nodes 289 | #print start , end , deck.num_nodes 290 | data.append(sharedmem.empty((deck.num_nodes, deck.dim),dtype=np.float64)) 291 | #data[i].fill(0) 292 | processes.append(Process(target=self.compute_f_int_slice, args=(deck, data_solver, y, start, end, data[i]))) 293 | processes[i].start() 294 | 295 | for p in processes: 296 | p.join() 297 | 298 | for i in range(0,threads): 299 | self.f_int += data[i] 300 | -------------------------------------------------------------------------------- /peripydic/problem/__init__.py: -------------------------------------------------------------------------------- 1 | ##@package problem 2 | # Provides the different materials 3 | #@author: ilyass.tabiai@polymtl.ca 4 | #@author: rolland.delorme@polymtl.ca 5 | #@author: patrickdiehl@lsu.edu 6 | 7 | from .dic import * 8 | from .pd import * 9 | from .energy import * 10 | -------------------------------------------------------------------------------- /peripydic/problem/dic.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | #@author: ilyass.tabiai@polymtl.ca 3 | #@author: rolland.delorme@polymtl.ca 4 | #@author: patrickdiehl@lsu.edu 5 | 6 | from ..util import neighbor 7 | from ..util import abstractions 8 | import numpy as np 9 | 10 | ## Copmutes extension and force states out of displacement/nodes data obtained 11 | # from the VIC3D CSV (DIC data) 12 | class DIC_problem(abstractions.Problem): 13 | 14 | ## Constructor 15 | # Find neighbors for DIC data, computes the weighted function, then computes 16 | # actual positions, extension states and force states 17 | # @param deck Deck object containig data from the .yaml file 18 | def __init__(self, deck): 19 | ## NeighborSearch 20 | self.neighbors = neighbor.NeighborSearch(deck) 21 | 22 | # Compute the volume correction factor for each node 23 | self.compute_volume_correction(deck) 24 | 25 | # Compute the weighted volume for each node 26 | self.compute_weighted_volume(deck) 27 | 28 | ## Actual position from DIC result 29 | self.y = np.zeros((deck.num_nodes, deck.dim,2),dtype=np.float32) 30 | self.y[:,:,0] = deck.geometry.nodes[:,:] 31 | 32 | ## Internal forces 33 | self.force_int = np.zeros((deck.num_nodes, deck.dim,2),dtype=np.float32) 34 | 35 | ## Extension state 36 | self.ext = np.zeros( ( deck.num_nodes, self.neighbors.max_neighbors,2),dtype=np.float32 ) 37 | 38 | 39 | if deck.material_type == "Elastic": 40 | from ..materials.elastic import Elastic_material 41 | mat_class = Elastic_material( deck, self, deck.geometry.act ) 42 | self.update_force_data(mat_class) 43 | self.update_ext_state_data(mat_class) 44 | 45 | 46 | self.update_pos(deck.geometry.act) 47 | self.strain_energy = mat_class.strain_energy 48 | 49 | ## Records the force vector at each time step 50 | # @param mat_class Material class object for the elastic/viscoelastic material models 51 | def update_force_data(self, mat_class): 52 | ## Internal forces state 53 | self.force_int[:,:, 1] = mat_class.f_int 54 | 55 | 56 | ## Records the ext_state vector at each time step 57 | # @param mat_class Material class object for the elastic/viscoelastic material models 58 | def update_ext_state_data(self, mat_class): 59 | ## Extension state 60 | self.ext[:, :, 1] = mat_class.e 61 | 62 | ## Records the actual position vector at each time step 63 | # @param act Actual position obtained from DIC data 64 | def update_pos(self,act): 65 | ## Actual position state 66 | self.y[:,:, 1] = act 67 | -------------------------------------------------------------------------------- /peripydic/problem/energy.py: -------------------------------------------------------------------------------- 1 | #-*- coding: utf-8 -*- 2 | #@author: ilyass.tabiai@polymtl.ca 3 | #@author: rolland.delorme@polymtl.ca 4 | #@author: patrickdiehl@lsu.edu 5 | 6 | import numpy as np 7 | from scipy import linalg 8 | 9 | from ..util import neighbor 10 | from ..util import linalgebra 11 | from ..util import abstractions 12 | 13 | import sys 14 | from peripydic.IO import deck 15 | 16 | class Energy_problem(abstractions.Problem): 17 | 18 | ## Constructor 19 | # @param deck The input deck 20 | def __init__(self, deck): 21 | 22 | ## NeighborSearch 23 | self.neighbors = neighbor.NeighborSearch(deck) 24 | 25 | # Compute the volume correction factor for each node 26 | self.compute_volume_correction(deck) 27 | 28 | # Compute the weighted volume for each node 29 | self.compute_weighted_volume(deck) 30 | 31 | 32 | def jacobian_matrix(self, deck, y, p): 33 | eps = deck.solver_perturbation 34 | jacobian = np.zeros((deck.compare_length , deck.dim),dtype=np.float64) 35 | 36 | index = 0 37 | 38 | for i in deck.nodes_compare: 39 | for j in range(0,deck.dim): 40 | 41 | if deck.material_type == "Elastic": 42 | from ..materials.elastic import Elastic_material 43 | 44 | if deck.dim == 1: 45 | 46 | deck.young_modulus = p[j] + eps 47 | mat_class_p = Elastic_material( deck, self, y ) 48 | 49 | deck.young_modulus = p[j] - eps 50 | mat_class_m = Elastic_material( deck, self, y ) 51 | jacobian[index][j] = (mat_class_p.strain_energy[i] - mat_class_m.strain_energy[i]) / (2. * eps) 52 | 53 | if deck.dim == 2: 54 | 55 | if j == 0: 56 | deck.bulk_modulus = p[0] + eps 57 | deck.shear_modulus = p[1] 58 | mat_class_p = Elastic_material( deck, self, y ) 59 | 60 | deck.bulk_modulus = p[0] - eps 61 | deck.shear_modulus = p[1] 62 | mat_class_m = Elastic_material( deck, self, y ) 63 | 64 | jacobian[index][j] = (mat_class_p.strain_energy[i] - mat_class_m.strain_energy[i]) / (2. * eps) 65 | 66 | if j == 1: 67 | deck.bulk_modulus = p[0] 68 | deck.shear_modulus = p[1] + eps 69 | mat_class_p = Elastic_material( deck, self, y ) 70 | 71 | deck.bulk_modulus = p[0] 72 | deck.shear_modulus = p[1] - eps 73 | mat_class_m = Elastic_material( deck, self, y ) 74 | 75 | jacobian[index][j] = (mat_class_p.strain_energy[i] - mat_class_m.strain_energy[i]) / (2. * eps) 76 | 77 | 78 | index +=1 79 | return jacobian 80 | 81 | def newton_step(self, deck, y,p): 82 | 83 | jacobian = self.jacobian_matrix(deck, y,p) 84 | 85 | S = linalg.pinv(jacobian) 86 | 87 | energy = np.zeros((deck.compare_length,deck.dim)) 88 | 89 | for i in range(0,len(energy)): 90 | for j in range(0,deck.dim): 91 | energy[i][j] = deck.measured_energy - jacobian[i][j] 92 | 93 | if deck.dim == 1: 94 | p[0] = np.dot(S,energy)[0] 95 | if deck.dim == 2: 96 | res = np.multiply(S,energy.transpose()) 97 | 98 | p[0] = res[0] 99 | p[1] = res[1] 100 | 101 | energy = np.zeros((deck.compare_length)) 102 | 103 | for i in range(0,len(energy)): 104 | from ..materials.elastic import Elastic_material 105 | if deck.dim == 1: 106 | deck.young_modulus = p[0] 107 | if deck.dim == 2: 108 | deck.bulk_modulus = p[0] 109 | deck.shear_modulus = p[1] 110 | 111 | mat_class = Elastic_material( deck, self, y ) 112 | energy[i] = deck.measured_energy - mat_class.strain_energy[deck.nodes_compare[i]] 113 | 114 | 115 | #ratio = (3.* p[0] - 2. * p[1]) / (2.*(3.*p[0]+p[1])) 116 | 117 | return linalgebra.norm(energy) 118 | 119 | def solver(self,deck): 120 | 121 | 122 | if deck.dim == 1: 123 | p = np.zeros((1)) 124 | p.fill(deck.young_modulus) 125 | 126 | if deck.dim == 2: 127 | p = np.zeros((2)) 128 | p[0] = deck.bulk_modulus 129 | p[1] = deck.shear_modulus 130 | 131 | 132 | res = float('inf') 133 | iteration = 1 134 | 135 | while res >= deck.solver_tolerance and iteration <= deck.solver_max_it : 136 | 137 | res = self.newton_step(deck, deck.geometry.act,p) 138 | print (iteration , res) 139 | iteration += 1 140 | 141 | print (p) 142 | 143 | 144 | -------------------------------------------------------------------------------- /peripydic/problem/pd.py: -------------------------------------------------------------------------------- 1 | #-*- coding: utf-8 -*- 2 | #@author: ilyass.tabiai@polymtl.ca 3 | #@author: rolland.delorme@polymtl.ca 4 | #@author: patrickdiehl@lsu.edu 5 | 6 | import numpy as np 7 | from ..util import neighbor 8 | from scipy.sparse import linalg 9 | from scipy import sparse 10 | from ..util import linalgebra 11 | from ..util import abstractions 12 | 13 | 14 | ## Class to define the peridynamic problem, i.e. applying boundaries conditions to the geometry and solve the problem 15 | class PD_problem(abstractions.Problem): 16 | 17 | ## Constructor 18 | # @param deck The input deck 19 | def __init__(self, deck): 20 | 21 | ## Family of each node 22 | self.neighbors = neighbor.NeighborSearch(deck) 23 | 24 | ## Nodes' positions stored for each time step 25 | self.y = np.zeros((deck.num_nodes, deck.dim, deck.time_steps), dtype=np.float64) 26 | self.y[:,:,0] = deck.geometry.nodes[:,:] 27 | 28 | ## Global internal force density array storing the force density attached to each node 29 | self.force_int = np.zeros((deck.num_nodes, deck.dim, deck.time_steps), dtype=np.float64) 30 | 31 | ## Extension state at each node between the node and its family 32 | self.ext = np.zeros( ( deck.num_nodes, self.neighbors.max_neighbors, deck.time_steps ), dtype=np.float64 ) 33 | 34 | ## Strain energy at each node between the node and its family 35 | self.strain_energy = np.zeros( ( deck.num_nodes, deck.time_steps ), dtype=np.float64 ) 36 | 37 | if deck.material_type == "Viscoelastic": 38 | ## Viscoelastic part of the extension state at each node between the node and its family 39 | self.ext_visco = np.zeros( ( deck.num_nodes, self.neighbors.max_neighbors, len(deck.relax_time), deck.time_steps ), dtype=np.float64 ) 40 | 41 | ## Compute the external force density "b" applied on each node 42 | self.compute_b(deck) 43 | 44 | # Compute the volume correction factor for each node 45 | self.compute_volume_correction(deck) 46 | 47 | # Compute the weighted volume for each node 48 | self.compute_weighted_volume(deck) 49 | 50 | 51 | ## Compute the external force density "b" applied on each node 52 | # @param deck The input deck 53 | def compute_b(self, deck): 54 | ## External force density "b" applied on each node 55 | self.b = np.zeros((deck.num_nodes, deck.dim, deck.time_steps),dtype=np.float64) 56 | for t_n in range(1, deck.time_steps): 57 | for con in deck.conditions: 58 | if con.type == "Force": 59 | if con.shape == "Ramp": 60 | #Madenci approach 61 | for i in con.id: 62 | # x direction 63 | if con.direction == 1: 64 | self.b[int(i), 0, t_n] = self.shape_loading( deck, t_n , con , i ) 65 | # y direction 66 | if con.direction == 2: 67 | self.b[int(i), 1 , t_n] = self.shape_loading( deck, t_n , con , i ) 68 | # z direction 69 | if con.direction == 3: 70 | self.b[int(i), 2, t_n] = self.shape_loading( deck, t_n , con , i ) 71 | #print self.b 72 | 73 | ## Provide the loading shape 74 | # @param deck The input deck 75 | # @param t_n Id of the time step 76 | # @param con Type of loading, "Force" or "Displacement" 77 | # @param i Id of Node "i" 78 | def shape_loading(self, deck, t_n, con, i): 79 | Time_t = deck.delta_t*(t_n) 80 | if deck.shape_type == "Ramp": 81 | 82 | if con.type == "Force": 83 | value = con.value / deck.geometry.volumes[int(i)] 84 | if con.type == "Displacement": 85 | value = con.value 86 | 87 | if Time_t <= deck.shape_values[0]: 88 | result = (value*Time_t)/deck.shape_values[0] 89 | return result 90 | elif Time_t > deck.shape_values[0] and Time_t <= deck.shape_values[1]: 91 | result = value 92 | return result 93 | elif Time_t > deck.shape_values[1] and Time_t <= deck.shape_values[2]: 94 | result = value - value*(Time_t - deck.shape_values[1])/(deck.shape_values[2] - deck.shape_values[1]) 95 | return result 96 | else: 97 | result = 0 98 | return result 99 | 100 | ## Provide the internal force density for each node for a given time step t_n 101 | # @param deck The input deck 102 | # @param ysolver Initial guess for Actual nodes' position 103 | # @param t_n Id of the time step 104 | # @return Internal force density for each node 105 | def internal_force(self, deck, ysolver, t_n): 106 | # Choice of the material class 107 | if deck.material_type == "Elastic": 108 | from ..materials.elastic import Elastic_material 109 | ## Data from the material class 110 | self.mat_class = Elastic_material( deck, self, ysolver ) 111 | self.update_force_data(self.mat_class, t_n) 112 | self.update_ext_state_data(self.mat_class, t_n) 113 | self.update_strain_energy_data(self.mat_class, t_n) 114 | 115 | elif deck.material_type == "Viscoelastic": 116 | from ..materials.viscoelastic import Viscoelastic_material 117 | self.mat_class = Viscoelastic_material( deck, self, ysolver, t_n) 118 | self.update_force_data(self.mat_class, t_n) 119 | self.update_ext_state_data(self.mat_class, t_n) 120 | self.update_ext_state_visco_data(self.mat_class, t_n) 121 | 122 | force = self.mat_class.f_int 123 | #internal_force = np.reshape(internal_force, (deck.num_nodes * deck.dim,-1) ) 124 | return force 125 | 126 | ## Provide the residual for each node after a solving step for a given time step t_n 127 | # @param deck The input deck 128 | # @param ysolver Initial guess for Actual nodes' position 129 | # @param t_n Id of the time step 130 | # @return Residual for each node 131 | def residual_vector(self, deck, ysolver, t_n): 132 | residual = np.zeros((deck.num_nodes, deck.dim),dtype=np.float64) 133 | internal_force = self.internal_force(deck, ysolver, t_n) 134 | for con in deck.conditions: 135 | if con.type == "Displacement" and con.shape == "Fixed": 136 | for id_node in con.id: 137 | # x direction 138 | if con.direction == 1: 139 | ysolver[int(id_node),0] = deck.geometry.nodes[int(id_node),0] + con.value 140 | # y direction 141 | if con.direction == 2: 142 | ysolver[int(id_node),1] = deck.geometry.nodes[int(id_node),1] + con.value 143 | # z direction 144 | if con.direction == 3: 145 | ysolver[int(id_node),2] = deck.geometry.nodes[int(id_node),2] + con.value 146 | 147 | if con.type == "Displacement" and con.shape == "Ramp": 148 | for i in con.id: 149 | # x direction 150 | if con.direction == 1: 151 | ysolver[int(id_node),0] = self.shape_loading( deck, t_n , con , i ) 152 | # y direction 153 | if con.direction == 2: 154 | ysolver[int(id_node),1] = self.shape_loading( deck, t_n , con , i ) 155 | # z direction 156 | if con.direction == 3: 157 | ysolver[int(id_node),2] = self.shape_loading( deck, t_n , con , i ) 158 | 159 | for i in range(0,deck.num_nodes): 160 | found = False 161 | for con in deck.conditions: 162 | if con.type == "Displacement": 163 | if i in con.id: 164 | found = True 165 | if found == False: 166 | residual[i,:] = internal_force[i,:] + self.b[i,:, t_n] 167 | return residual 168 | 169 | ## Provide the Jacobian (stiffness) matrix for a given time step t_n for the Newton's method 170 | # @param deck The input deck 171 | # @param ysolver Initial guess for Actual nodes' position 172 | # @param t_n Id of the time step 173 | # @param perturbation_factor Magnitude of the perturbation factor 174 | # @return Jacobian matrix 175 | def jacobian_matrix(self, deck, ysolver, t_n, perturbation_factor): 176 | eps = perturbation_factor * deck.delta_X 177 | jacobian = np.zeros((deck.num_nodes * deck.dim , deck.num_nodes * deck.dim),dtype=np.float64) 178 | 179 | #ids = [] 180 | #for con in deck.conditions: 181 | # if con.type == "Displacement": 182 | # for i in con.id: 183 | # ids.append(i) 184 | 185 | for i in range(0, deck.num_nodes): 186 | traversal_list = np.append([i],self.neighbors.get_index_x_family(i)) 187 | for j in traversal_list : 188 | for r in range(0, deck.dim): 189 | eps_vector = np.zeros((deck.num_nodes , deck.dim),dtype=np.float64) 190 | eps_vector[j,r] = eps 191 | force_int_p = self.internal_force(deck, ysolver + eps_vector, t_n)[i,:] 192 | force_int_m = self.internal_force(deck, ysolver - eps_vector, t_n)[i,:] 193 | force_int_diff = (force_int_p - force_int_m) 194 | del force_int_p; 195 | del force_int_m; 196 | for s in range(0, deck.dim): 197 | if r==s: 198 | jacobian[i*deck.dim+r,j*deck.dim+s] = force_int_diff[r] / (2.*eps) 199 | #print "Jacobian Matrix Density =", np.count_nonzero(jacobian) / (float(deck.num_nodes) * float(deck.dim))**2 * 100., "%" 200 | return jacobian 201 | 202 | ## Provide the displacement increment resulting for the Newton's method, for each node for a given time step t_n 203 | # @param deck The input deck 204 | # @param ysolver Initial guess for Actual nodes' position 205 | # @param t_n Id of the time step 206 | # @param perturbation_factor Magnitude of the perturbation factor 207 | # @param residual Residual for each node resulting from a solving step 208 | # @return Displacement increment for each node 209 | def newton_step(self, deck, ysolver, t_n, perturbation_factor, residual): 210 | jacobian = self.jacobian_matrix(deck, ysolver, t_n, perturbation_factor) 211 | residual = np.reshape(residual,(deck.dim*deck.num_nodes,1)) 212 | 213 | removeId = [] 214 | for con in deck.conditions: 215 | if con.type == "Displacement": 216 | for i in con.id: 217 | removeId.append(int((i*deck.dim) + con.direction-1)) 218 | removeId.sort() 219 | 220 | jacobian = np.delete(jacobian,removeId,0) 221 | jacobian = np.delete(jacobian,removeId,1) 222 | residual = np.delete(residual,removeId,0) 223 | 224 | #delta_y = linalg.solve(jacobian, -residual, check_finite = "False", assume_a = "sym" ) 225 | #delta_y = linalg.solve(jacobian, -residual, check_finite = "False") 226 | 227 | s = sparse.csr_matrix(jacobian) 228 | delta_y = linalg.spsolve(s, -residual) 229 | 230 | mask = np.ones((deck.num_nodes * deck.dim), dtype=bool) 231 | mask[removeId] = False 232 | 233 | result = np.zeros((deck.num_nodes * deck.dim),dtype=np.float64) 234 | i = 0 235 | j = 0 236 | for m in mask: 237 | if m == True: 238 | result[int(i)] = delta_y[int(j)] 239 | j+= 1 240 | i += 1 241 | return np.reshape(result, (deck.num_nodes,deck.dim)) 242 | 243 | ## Solve the peridynamic problem at each time step using the Newton's method to obtain the actual nodes' position 244 | # @param deck The input deck 245 | # @param ysolver Initial guess for Actual nodes' position 246 | def quasi_static_solver(self, deck, ysolver): 247 | for t_n in range(1, deck.time_steps): 248 | res = float('inf') 249 | iteration = 1 250 | residual = self.residual_vector(deck, ysolver, t_n) 251 | 252 | res = linalgebra.norm(residual) 253 | 254 | while res >= deck.solver_tolerance and iteration <= deck.solver_max_it : 255 | print ("iteration", iteration , res) 256 | if iteration == deck.solver_max_it: 257 | print ("Warning: Solver reached limit of " + str(deck.solver_max_it) + " iterations") 258 | delta_y = self.newton_step(deck, ysolver, t_n, deck.solver_perturbation, residual) 259 | ysolver += delta_y 260 | residual = self.residual_vector(deck, ysolver, t_n) 261 | 262 | res = linalgebra.norm(residual) 263 | 264 | iteration += 1 265 | self.y[:,:,t_n] = ysolver 266 | print ("t_n:" , t_n , "res:" , res , "Iteration #",iteration-1) 267 | 268 | ## Store the internal force density for each node at each time step 269 | # @param mat_class Data from the material class 270 | # @param t_n Id of the time step 271 | def update_force_data(self, mat_class, t_n): 272 | # Global internal force density array storing the force density attached to each node 273 | self.force_int[:,:, t_n] = mat_class.f_int 274 | 275 | ## Store the extension state for each node between itself and its family at each time step 276 | # @param mat_class Data from the material class 277 | # @param t_n Id of the time step 278 | def update_ext_state_data(self, mat_class, t_n): 279 | # Extension state at each node between the node and its family 280 | self.ext[:, :, t_n] = mat_class.e 281 | 282 | ## Store the viscoelastic part of the extension state for each node between itself and its family 283 | # @param mat_class Data from the material class 284 | # @param t_n Id of the time step 285 | def update_ext_state_visco_data(self, mat_class, t_n): 286 | # Viscoelastic part of the extension state at each node between the node and its family 287 | self.ext_visco[:, :, :, t_n] = mat_class.e_visco 288 | 289 | ## Store the strain energy for each node between itself and its family 290 | # @param mat_class Data from the material class 291 | # @param t_n Id of the time step 292 | def update_strain_energy_data(self, mat_class, t_n): 293 | # Viscoelastic part of the extension state at each node between the node and its family 294 | self.strain_energy[:, t_n] = mat_class.strain_energy 295 | 296 | ## Provide the strain between 2 nodes 297 | # @param deck The input deck 298 | # @param id_Node_1 Id of the 1st node 299 | # @param id_Node_2 Id of the 2nd node 300 | def strain_calculation(self, deck, id_Node_1, id_Node_2): 301 | strain = np.zeros( ( deck.time_steps ),dtype=np.float64 ) 302 | for t_n in range(1, deck.time_steps): 303 | actual = linalgebra.norm(self.y[id_Node_2,:,t_n] - self.y[id_Node_1,:,t_n]) 304 | initial = linalgebra.norm(deck.geometry.nodes[id_Node_2,:] - deck.geometry.nodes[id_Node_1,:]) 305 | strain[t_n] = (actual - initial) / initial 306 | return strain 307 | -------------------------------------------------------------------------------- /peripydic/test/compare.sh: -------------------------------------------------------------------------------- 1 | md5_stable=($(md5sum $1)) 2 | md5_new=($(md5sum $1)) 3 | 4 | if [ "$md5_stable" == "$md5_new" ]; then 5 | echo "Test passed" 6 | else 7 | echo "test failed" 8 | fi 9 | -------------------------------------------------------------------------------- /peripydic/util/__init__.py: -------------------------------------------------------------------------------- 1 | ##@package util 2 | # Provides the utils for different tasks 3 | #@author: ilyass.tabiai@polymtl.ca 4 | #@author: rolland.delorme@polymtl.ca 5 | #@author: patrickdiehl@lsu.edu 6 | 7 | from .condition import * 8 | from .linalgebra import * 9 | from .neighbor import * 10 | -------------------------------------------------------------------------------- /peripydic/util/abstractions.py: -------------------------------------------------------------------------------- 1 | #-*- coding: utf-8 -*- 2 | #@author: ilyass.tabiai@polymtl.ca 3 | #@author: rolland.delorme@polymtl.ca 4 | #@author: patrickdiehl@lsu.edu 5 | 6 | from ..util import linalgebra 7 | import numpy as np 8 | from ..util import functions 9 | 10 | 11 | ## Abstract class of the problem classes, which contains common methods 12 | class Problem(): 13 | 14 | # @param deck The input deck 15 | def compute_volume_correction(self,deck): 16 | ## Volume correction factor for each node 17 | self.volume_correction = np.ones( ( deck.num_nodes, self.neighbors.max_neighbors), dtype=np.float64 ) 18 | for i in range(0, deck.num_nodes): 19 | index_x_family = self.neighbors.get_index_x_family(i) 20 | n = 0 21 | for p in index_x_family: 22 | X = deck.geometry.nodes[p,:] - deck.geometry.nodes[i,:] 23 | r = deck.delta_X / 2.0 24 | if linalgebra.norm(X) > self.neighbors.horizon - r: 25 | self.volume_correction[i,n] = (self.neighbors.horizon + r - linalgebra.norm(X)) / (deck.delta_X) 26 | else: 27 | pass 28 | n += 1 29 | 30 | ## Compute the weighted volume for each node 31 | # @param deck The input deck 32 | def compute_weighted_volume(self, deck): 33 | ## Weighted volume for each node 34 | self.weighted_volume = np.zeros((deck.num_nodes),dtype=np.float64) 35 | for i in range(0, deck.num_nodes): 36 | index_x_family = self.neighbors.get_index_x_family(i) 37 | n = 0 38 | for p in index_x_family: 39 | X = deck.geometry.nodes[p,:] - deck.geometry.nodes[i,:] 40 | self.weighted_volume[i] += functions.w(self, X, deck.influence_function) * (linalgebra.norm(X))**2 * self.volume_correction[i,n] * deck.geometry.volumes[p] 41 | n += 1 -------------------------------------------------------------------------------- /peripydic/util/condition.py: -------------------------------------------------------------------------------- 1 | #-*- coding: utf-8 -*- 2 | #@author: ilyass.tabiai@polymtl.ca 3 | #@author: rolland.delorme@polymtl.ca 4 | #@author: patrickdiehl@lsu.edu 5 | import os 6 | import sys 7 | import csv 8 | import numpy as np 9 | 10 | ## Class for storing the conditions from the yaml file 11 | class ConditionFromFile(): 12 | 13 | ## Volume of the boundary elements 14 | boundary_volume = 0. 15 | 16 | ## Constructor 17 | # @param cType Type of the condition, e.g. Force or Displacement 18 | # @param inFile Path to the CSV file with the respective node ids 19 | # @param value The value, which is applied 20 | # @param volume The volume of the nodes 21 | # @param direction The direction where the conditions is applied 22 | # @param shape The shape of the condition 23 | def __init__(self,cType,inFile,value,volume,direction,shape): 24 | ## Ids of the node where this condition is applied 25 | self.id = self.readCondition(inFile,volume) 26 | ## Type of the condition (Force or Displacement) 27 | self.type = cType 28 | ## Value in Newton or Millimeter 29 | self.value = float(value) 30 | ## Direction of the condition 31 | self.direction = direction 32 | ## Shape of condition 33 | self.shape = shape 34 | 35 | ##Reads the ids from the inFile where this condition should be applied. 36 | # @param inFile File name of the CSV file with the ids of the nodes 37 | # @param volume The volume of the nodes 38 | # @return The ids read from the inFile 39 | def readCondition(self, inFile,volume): 40 | if not os.path.exists(inFile): 41 | print ("Error: Could not find " + str(inFile)) 42 | sys.exit(1) 43 | 44 | with open(inFile, 'r') as csvfile: 45 | spamreader = csv.reader(csvfile, delimiter=' ') 46 | # Skip the first line, because is the header 47 | next(spamreader) 48 | length = len(list(spamreader)) 49 | ids = np.empty(length) 50 | csvfile.seek(0) 51 | next(spamreader) 52 | i = 0 53 | for row in spamreader: 54 | ids[i] = int(row[0]) 55 | i += 1 56 | return ids 57 | 58 | -------------------------------------------------------------------------------- /peripydic/util/functions.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from ..util import linalgebra 3 | 4 | def w(problem,X,type): 5 | 6 | if type == "ONE": 7 | return 1. 8 | if type == "EXP": 9 | len = linalgebra.norm(X) 10 | return np.exp(- (len*len) / problem.neighbors.horizon / problem.neighbors.horizon) 11 | if type == "NORM": 12 | return 1. / linalgebra.norm(X) 13 | 14 | return 1. -------------------------------------------------------------------------------- /peripydic/util/linalgebra.py: -------------------------------------------------------------------------------- 1 | from math import sqrt 2 | 3 | def norm(a): 4 | 5 | if len(a.shape) == 1: 6 | if a.shape[0] == 1: 7 | return abs(a) 8 | 9 | if a.shape[0] == 2: 10 | return sqrt(a[0]*a[0]+a[1]*a[1]) 11 | 12 | if a.shape[0] == 3: 13 | return sqrt(a[0]*a[0]+a[1]*a[1]*a[2]*a[2]) 14 | 15 | else: 16 | tmp = 0. 17 | for i in range(0,a.shape[0]): 18 | tmp += a[i]*a[i] 19 | return sqrt(tmp) 20 | 21 | if len(a.shape) == 2: 22 | if a.shape[1] == 2: 23 | tmp = 0. 24 | for i in range(0,a.shape[0]): 25 | tmp += a[i][0]*a[i][0]+a[i][1]*a[i][1] 26 | return sqrt(tmp) 27 | if a.shape[1] == 1: 28 | return sum(abs(a)) 29 | -------------------------------------------------------------------------------- /peripydic/util/neighbor.py: -------------------------------------------------------------------------------- 1 | #-*- coding: utf-8 -*- 2 | #@author: ilyass.tabiai@polymtl.ca 3 | #@author: rolland.delorme@polymtl.ca 4 | #@author: patrickdiehl@lsu.edu 5 | import numpy as np 6 | import scipy.spatial 7 | import sys 8 | 9 | sys.setrecursionlimit(100000) 10 | 11 | ## Class for handling the neighborhood 12 | class NeighborSearch(): 13 | 14 | ## Constructor 15 | # @param deck The input deck 16 | def __init__(self,deck): 17 | ## Safety factor for the search of the neighborhood 18 | self.safety_factor = deck.safety_factor 19 | ## Maximal amount of neighbors 20 | self.max_neighbors = 0 21 | ## Horizon of the neighborhood 22 | self.horizon = deck.horizon_factor_m_value * deck.delta_X * self.safety_factor 23 | self.findNeighbors(deck) 24 | 25 | ## Returns the family of node "i" 26 | # @param i Id of the node 27 | # @return The ids of the neighbors of node "i" 28 | def get_index_x_family(self, i): 29 | return self.family[i] 30 | 31 | ## Generates adjacency lists 32 | # @param deck The input deck 33 | def findNeighbors(self,deck): 34 | tree = scipy.spatial.KDTree(deck.geometry.nodes) 35 | d , ids = tree.query(deck.geometry.nodes, k=150, eps=0.0, p=2, distance_upper_bound=self.horizon) 36 | ## Adjaceny list 37 | self.family = [] 38 | for i in range(0,len(ids)): 39 | self.family.append(np.array(list(filter(lambda x: x != i, np.array(list(filter(lambda x: x < deck.num_nodes, ids[i]))))))) 40 | tmp = len(self.family[i]) 41 | if tmp > self.max_neighbors: 42 | self.max_neighbors = tmp 43 | del d , ids 44 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | sharedmem==0.3.5 2 | pyyaml==5.4 3 | numpy>=1.16 4 | scipy>=1.3 5 | vtk>=9 6 | matplotlib -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup , find_namespace_packages 2 | 3 | setup(name='PeriPyDIC', 4 | version='0.3', 5 | description='Peridynamics (PD) computations for state-based PD in 1D, 2D for elastic and viscoelastic materials. Also possible to import Digital Image Correlation results and compute PD forces for each pixel as a node.', 6 | author='Patrick Diehl, Rolland Delorme, Ilyass Tabiai', 7 | author_email='patrickdiehl@lsu.edu, rolland.delorme@polymtl.ca, ilyass.tabiai@polymtl.ca', 8 | url='https://github.com/lm2-poly/PeriPyDIC', 9 | keywords='material science, peridynamics, digital image correlation', 10 | license='GPL-3.0', 11 | packages=find_namespace_packages(where="./"), 12 | zip_safe=False) 13 | -------------------------------------------------------------------------------- /test/1D+.res: -------------------------------------------------------------------------------- 1 | iteration 1 [80.] 2 | iteration 2 [0.00000593] 3 | t_n: 1 res: [0.] Iteration # 2 4 | delta_x = 0.5 5 | Horizon = 0.5005 6 | epsilon_tensor 7 | [[0.00666667] 8 | [0.00833333] 9 | [0.01 ] 10 | [0.01 ] 11 | [0.01 ] 12 | [0.01 ] 13 | [0.01 ] 14 | [0.01 ] 15 | [0.01 ] 16 | [0.01 ] 17 | [0.01 ] 18 | [0.01 ] 19 | [0.01 ] 20 | [0.01 ] 21 | [0.01 ] 22 | [0.01 ] 23 | [0.01 ] 24 | [0.01 ] 25 | [0.01 ] 26 | [0.01 ] 27 | [0.01 ] 28 | [0.01 ] 29 | [0.01 ] 30 | [0.01 ] 31 | [0.01 ] 32 | [0.01 ] 33 | [0.01 ] 34 | [0.01 ] 35 | [0.01 ] 36 | [0.01 ] 37 | [0.01 ] 38 | [0.00833333] 39 | [0.00666667]] 40 | strain_longi [0. 0.01] 41 | stress_tensor 42 | [[26.66666667] 43 | [33.33333333] 44 | [40. ] 45 | [40. ] 46 | [40. ] 47 | [40. ] 48 | [40. ] 49 | [40. ] 50 | [40. ] 51 | [40. ] 52 | [40. ] 53 | [40. ] 54 | [40. ] 55 | [40. ] 56 | [40. ] 57 | [40. ] 58 | [40. ] 59 | [40. ] 60 | [40. ] 61 | [40. ] 62 | [40. ] 63 | [40. ] 64 | [40. ] 65 | [40. ] 66 | [40. ] 67 | [40. ] 68 | [40. ] 69 | [40. ] 70 | [40. ] 71 | [40. ] 72 | [40. ] 73 | [33.33333333] 74 | [26.66666667]] 75 | strain_energy 76 | [[0. 0.08888889] 77 | [0. 0.14444444] 78 | [0. 0.2 ] 79 | [0. 0.2 ] 80 | [0. 0.2 ] 81 | [0. 0.2 ] 82 | [0. 0.2 ] 83 | [0. 0.2 ] 84 | [0. 0.2 ] 85 | [0. 0.2 ] 86 | [0. 0.2 ] 87 | [0. 0.2 ] 88 | [0. 0.2 ] 89 | [0. 0.2 ] 90 | [0. 0.2 ] 91 | [0. 0.2 ] 92 | [0. 0.2 ] 93 | [0. 0.2 ] 94 | [0. 0.2 ] 95 | [0. 0.2 ] 96 | [0. 0.2 ] 97 | [0. 0.2 ] 98 | [0. 0.2 ] 99 | [0. 0.2 ] 100 | [0. 0.2 ] 101 | [0. 0.2 ] 102 | [0. 0.2 ] 103 | [0. 0.2 ] 104 | [0. 0.2 ] 105 | [0. 0.2 ] 106 | [0. 0.2 ] 107 | [0. 0.14444444] 108 | [0. 0.08888889]] 109 | -------------------------------------------------------------------------------- /test/1D-.res: -------------------------------------------------------------------------------- 1 | iteration 1 [80.] 2 | iteration 2 [0.0000089] 3 | t_n: 1 res: [0.] Iteration # 2 4 | delta_x = 0.5 5 | Horizon = 0.5005 6 | epsilon_tensor 7 | [[0.00666667] 8 | [0.00833333] 9 | [0.01 ] 10 | [0.01 ] 11 | [0.01 ] 12 | [0.01 ] 13 | [0.01 ] 14 | [0.01 ] 15 | [0.01 ] 16 | [0.01 ] 17 | [0.01 ] 18 | [0.01 ] 19 | [0.01 ] 20 | [0.01 ] 21 | [0.01 ] 22 | [0.01 ] 23 | [0.01 ] 24 | [0.01 ] 25 | [0.01 ] 26 | [0.01 ] 27 | [0.01 ] 28 | [0.01 ] 29 | [0.01 ] 30 | [0.01 ] 31 | [0.01 ] 32 | [0.01 ] 33 | [0.01 ] 34 | [0.01 ] 35 | [0.01 ] 36 | [0.01 ] 37 | [0.01 ] 38 | [0.00833333] 39 | [0.00666667]] 40 | strain_longi [0. 0.01] 41 | stress_tensor 42 | [[26.66666667] 43 | [33.33333333] 44 | [40. ] 45 | [40. ] 46 | [40. ] 47 | [40. ] 48 | [40. ] 49 | [40. ] 50 | [40. ] 51 | [40. ] 52 | [40. ] 53 | [40. ] 54 | [40. ] 55 | [40. ] 56 | [40. ] 57 | [40. ] 58 | [40. ] 59 | [40. ] 60 | [40. ] 61 | [40. ] 62 | [40. ] 63 | [40. ] 64 | [40. ] 65 | [40. ] 66 | [40. ] 67 | [40. ] 68 | [40. ] 69 | [40. ] 70 | [40. ] 71 | [40. ] 72 | [40. ] 73 | [33.33333333] 74 | [26.66666667]] 75 | strain_energy 76 | [[0. 0.08888889] 77 | [0. 0.14444444] 78 | [0. 0.2 ] 79 | [0. 0.2 ] 80 | [0. 0.2 ] 81 | [0. 0.2 ] 82 | [0. 0.2 ] 83 | [0. 0.2 ] 84 | [0. 0.2 ] 85 | [0. 0.2 ] 86 | [0. 0.2 ] 87 | [0. 0.2 ] 88 | [0. 0.2 ] 89 | [0. 0.2 ] 90 | [0. 0.2 ] 91 | [0. 0.2 ] 92 | [0. 0.2 ] 93 | [0. 0.2 ] 94 | [0. 0.2 ] 95 | [0. 0.2 ] 96 | [0. 0.2 ] 97 | [0. 0.2 ] 98 | [0. 0.2 ] 99 | [0. 0.2 ] 100 | [0. 0.2 ] 101 | [0. 0.2 ] 102 | [0. 0.2 ] 103 | [0. 0.2 ] 104 | [0. 0.2 ] 105 | [0. 0.2 ] 106 | [0. 0.2 ] 107 | [0. 0.14444444] 108 | [0. 0.08888889]] 109 | -------------------------------------------------------------------------------- /test/2D_x+.res: -------------------------------------------------------------------------------- 1 | iteration 1 480.0 2 | iteration 2 181.07000384157334 3 | iteration 3 59.636424840709864 4 | iteration 4 18.325941614029727 5 | iteration 5 8.53559774032431 6 | iteration 6 3.136792300960094 7 | iteration 7 1.7610234895189327 8 | iteration 8 0.8917794432632375 9 | iteration 9 0.5232015770677 10 | iteration 10 0.30305647457652546 11 | iteration 11 0.17920088945022972 12 | iteration 12 0.10694656849113686 13 | iteration 13 0.06363763879820206 14 | iteration 14 0.0381448402074845 15 | iteration 15 0.022802259482808895 16 | iteration 16 0.013663298615793896 17 | iteration 17 0.008189910876827319 18 | iteration 18 0.0049037619864449695 19 | iteration 19 0.0029436292243933773 20 | iteration 20 0.0017616215435858075 21 | iteration 21 0.0010582415535765734 22 | t_n: 1 res: 0.0006331305723840281 Iteration # 21 23 | delta_x = 0.5 24 | Horizon = 1.5014999999999998 25 | epsilon_tensor 26 | [[ 0.01003764 0.00160773] 27 | [ 0.00160773 -0.00146895] 28 | [ 0.00895114 0.00110709] 29 | [ 0.00110709 -0.00115588] 30 | [ 0.00827904 0.0008978 ] 31 | [ 0.0008978 -0.00079774] 32 | [ 0.00798176 0.00040912] 33 | [ 0.00040912 -0.00042029] 34 | [ 0.00791137 -0. ] 35 | [-0. -0.0003668 ] 36 | [ 0.00798176 -0.00040912] 37 | [-0.00040912 -0.00042029] 38 | [ 0.00827904 -0.0008978 ] 39 | [-0.0008978 -0.00079774] 40 | [ 0.00895114 -0.00110709] 41 | [-0.00110709 -0.00115588] 42 | [ 0.01003764 -0.00160773] 43 | [-0.00160773 -0.00146895] 44 | [ 0.01469399 0.00446765] 45 | [ 0.00446765 0.0002258 ] 46 | [ 0.01481659 0.00300497] 47 | [ 0.00300497 -0.00108781] 48 | [ 0.01457015 0.00153209] 49 | [ 0.00153209 -0.00167606] 50 | [ 0.01418112 0.0007265 ] 51 | [ 0.0007265 -0.00102519] 52 | [ 0.01406354 -0. ] 53 | [-0. -0.00093576] 54 | [ 0.01418112 -0.0007265 ] 55 | [-0.0007265 -0.00102519] 56 | [ 0.01457015 -0.00153209] 57 | [-0.00153209 -0.00167606] 58 | [ 0.01481659 -0.00300497] 59 | [-0.00300497 -0.00108781] 60 | [ 0.01469399 -0.00446765] 61 | [-0.00446765 0.0002258 ] 62 | [ 0.01401315 0.0008302 ] 63 | [ 0.0008302 -0.00608402] 64 | [ 0.01401622 0.00153823] 65 | [ 0.00153823 -0.00282522] 66 | [ 0.01400285 0.00118209] 67 | [ 0.00118209 -0.00267236] 68 | [ 0.01385112 0.00051992] 69 | [ 0.00051992 -0.00224369] 70 | [ 0.01379774 -0. ] 71 | [-0. -0.00201725] 72 | [ 0.01385112 -0.00051992] 73 | [-0.00051992 -0.00224369] 74 | [ 0.01400285 -0.00118209] 75 | [-0.00118209 -0.00267236] 76 | [ 0.01401622 -0.00153823] 77 | [-0.00153823 -0.00282522] 78 | [ 0.01401315 -0.0008302 ] 79 | [-0.0008302 -0.00608402] 80 | [ 0.01613065 0.0014596 ] 81 | [ 0.0014596 -0.00741699] 82 | [ 0.01639611 0.0015412 ] 83 | [ 0.0015412 -0.00428135] 84 | [ 0.01651997 0.00099025] 85 | [ 0.00099025 -0.00395828] 86 | [ 0.0166282 0.0005181 ] 87 | [ 0.0005181 -0.00341688] 88 | [ 0.01667089 -0. ] 89 | [-0. -0.00322757] 90 | [ 0.0166282 -0.0005181 ] 91 | [-0.0005181 -0.00341688] 92 | [ 0.01651997 -0.00099025] 93 | [-0.00099025 -0.00395828] 94 | [ 0.01639611 -0.0015412 ] 95 | [-0.0015412 -0.00428135] 96 | [ 0.01613065 -0.0014596 ] 97 | [-0.0014596 -0.00741699] 98 | [ 0.01612157 0.00080715] 99 | [ 0.00080715 -0.00757669] 100 | [ 0.01653035 0.00074589] 101 | [ 0.00074589 -0.00535756] 102 | [ 0.01691583 0.00060943] 103 | [ 0.00060943 -0.00503057] 104 | [ 0.01735792 0.00039991] 105 | [ 0.00039991 -0.00443572] 106 | [ 0.01750382 -0. ] 107 | [-0. -0.0043245 ] 108 | [ 0.01735792 -0.00039991] 109 | [-0.00039991 -0.00443572] 110 | [ 0.01691583 -0.00060943] 111 | [-0.00060943 -0.00503057] 112 | [ 0.01653035 -0.00074589] 113 | [-0.00074589 -0.00535756] 114 | [ 0.01612157 -0.00080715] 115 | [-0.00080715 -0.00757669] 116 | [ 0.01546421 -0.00025009] 117 | [-0.00025009 -0.00719633] 118 | [ 0.01579478 0.00021968] 119 | [ 0.00021968 -0.00537605] 120 | [ 0.0163454 0.00037629] 121 | [ 0.00037629 -0.00530081] 122 | [ 0.0168949 0.00025359] 123 | [ 0.00025359 -0.00491956] 124 | [ 0.01708042 -0. ] 125 | [-0. -0.00491545] 126 | [ 0.0168949 -0.00025359] 127 | [-0.00025359 -0.00491956] 128 | [ 0.0163454 -0.00037629] 129 | [-0.00037629 -0.00530081] 130 | [ 0.01579478 -0.00021968] 131 | [-0.00021968 -0.00537605] 132 | [ 0.01546421 0.00025009] 133 | [ 0.00025009 -0.00719633] 134 | [ 0.0166062 0.00021041] 135 | [ 0.00021041 -0.00734047] 136 | [ 0.01734997 0.00016327] 137 | [ 0.00016327 -0.00535816] 138 | [ 0.0178578 0.00041577] 139 | [ 0.00041577 -0.00526681] 140 | [ 0.01850847 0.00033676] 141 | [ 0.00033676 -0.00496027] 142 | [ 0.01884639 -0. ] 143 | [-0. -0.00497383] 144 | [ 0.01850847 -0.00033676] 145 | [-0.00033676 -0.00496027] 146 | [ 0.0178578 -0.00041577] 147 | [-0.00041577 -0.00526681] 148 | [ 0.01734997 -0.00016327] 149 | [-0.00016327 -0.00535816] 150 | [ 0.0166062 -0.00021041] 151 | [-0.00021041 -0.00734047] 152 | [ 0.01492187 0.00232317] 153 | [ 0.00232317 -0.00523822] 154 | [ 0.01486589 0.00145527] 155 | [ 0.00145527 -0.00481154] 156 | [ 0.01549842 0.00051904] 157 | [ 0.00051904 -0.00514485] 158 | [ 0.01612508 0.00048735] 159 | [ 0.00048735 -0.00475357] 160 | [ 0.01649521 -0. ] 161 | [-0. -0.00477912] 162 | [ 0.01612508 -0.00048735] 163 | [-0.00048735 -0.00475357] 164 | [ 0.01549842 -0.00051904] 165 | [-0.00051904 -0.00514485] 166 | [ 0.01486589 -0.00145527] 167 | [-0.00145527 -0.00481154] 168 | [ 0.01492187 -0.00232317] 169 | [-0.00232317 -0.00523822] 170 | [ 0.02092183 -0.00012632] 171 | [-0.00012632 -0.00614744] 172 | [ 0.02001114 0.00021127] 173 | [ 0.00021127 -0.00462239] 174 | [ 0.02345409 0.00017735] 175 | [ 0.00017735 -0.004801 ] 176 | [ 0.02533854 0.00045346] 177 | [ 0.00045346 -0.00455936] 178 | [ 0.02576872 -0. ] 179 | [-0. -0.00448055] 180 | [ 0.02533854 -0.00045346] 181 | [-0.00045346 -0.00455936] 182 | [ 0.02345409 -0.00017735] 183 | [-0.00017735 -0.004801 ] 184 | [ 0.02001114 -0.00021127] 185 | [-0.00021127 -0.00462239] 186 | [ 0.02092183 0.00012632] 187 | [ 0.00012632 -0.00614744]] 188 | strain_longi [0. 0.] 189 | stress_tensor 190 | [[ 46.82133136 12.46225405] 191 | [ 12.46225405 2.81310801] 192 | [ 40.0883594 5.23961168] 193 | [ 5.23961168 3.50202802] 194 | [ 29.98125054 2.59060958] 195 | [ 2.59060958 3.56918485] 196 | [ 27.39092542 1.09620205] 197 | [ 1.09620205 4.10102343] 198 | [ 27.18799613 -0. ] 199 | [ -0. 4.31256978] 200 | [ 27.39092542 -1.09620205] 201 | [ -1.09620205 4.10102343] 202 | [ 29.98125054 -2.59060958] 203 | [ -2.59060958 3.56918485] 204 | [ 40.0883594 -5.23961168] 205 | [ -5.23961168 3.50202802] 206 | [ 46.82133136 -12.46225405] 207 | [-12.46225405 2.81310801] 208 | [ 65.72484308 21.88715236] 209 | [ 21.88715236 15.06357479] 210 | [ 61.20391757 12.26428103] 211 | [ 12.26428103 10.41821472] 212 | [ 46.46842234 4.85066713] 213 | [ 4.85066713 7.00214239] 214 | [ 43.55284075 2.16727297] 215 | [ 2.16727297 8.13403544] 216 | [ 43.26734493 -0. ] 217 | [ -0. 8.47060412] 218 | [ 43.55284075 -2.16727297] 219 | [ -2.16727297 8.13403544] 220 | [ 46.46842234 -4.85066713] 221 | [ -4.85066713 7.00214239] 222 | [ 61.20391757 -12.26428103] 223 | [-12.26428103 10.41821472] 224 | [ 65.72484308 -21.88715236] 225 | [-21.88715236 15.06357479] 226 | [ 58.53448335 2.39554646] 227 | [ 2.39554646 -10.3509557 ] 228 | [ 62.44870969 4.87013249] 229 | [ 4.87013249 4.90917545] 230 | [ 50.92908807 4.06981011] 231 | [ 4.06981011 5.72337127] 232 | [ 48.99364223 1.7114863 ] 233 | [ 1.7114863 5.51229711] 234 | [ 49.03789509 -0. ] 235 | [ -0. 6.39475153] 236 | [ 48.99364223 -1.7114863 ] 237 | [ -1.7114863 5.51229711] 238 | [ 50.92908807 -4.06981011] 239 | [ -4.06981011 5.72337127] 240 | [ 62.44870969 -4.87013249] 241 | [ -4.87013249 4.90917545] 242 | [ 58.53448335 -2.39554646] 243 | [ -2.39554646 -10.3509557 ] 244 | [ 74.5093246 3.91084698] 245 | [ 3.91084698 -13.24150071] 246 | [ 77.85318851 4.59768485] 247 | [ 4.59768485 1.88390243] 248 | [ 64.31062143 3.25973053] 249 | [ 3.25973053 2.99076987] 250 | [ 63.09993027 1.63380018] 251 | [ 1.63380018 2.95664706] 252 | [ 63.45998906 -0. ] 253 | [ -0. 3.75662846] 254 | [ 63.09993027 -1.63380018] 255 | [ -1.63380018 2.95664706] 256 | [ 64.31062143 -3.25973053] 257 | [ -3.25973053 2.99076987] 258 | [ 77.85318851 -4.59768485] 259 | [ -4.59768485 1.88390243] 260 | [ 74.5093246 -3.91084698] 261 | [ -3.91084698 -13.24150071] 262 | [ 74.34023613 2.16268162] 263 | [ 2.16268162 -13.80311758] 264 | [ 77.51764832 2.22512728] 265 | [ 2.22512728 -1.36859297] 266 | [ 64.80572867 2.00613572] 267 | [ 2.00613572 -0.56433756] 268 | [ 65.0003135 1.26108264] 269 | [ 1.26108264 -0.3893333 ] 270 | [ 65.69515215 -0. ] 271 | [ -0. 0.20146282] 272 | [ 65.0003135 -1.26108264] 273 | [ -1.26108264 -0.3893333 ] 274 | [ 64.80572867 -2.00613572] 275 | [ -2.00613572 -0.56433756] 276 | [ 77.51764832 -2.22512728] 277 | [ -2.22512728 -1.36859297] 278 | [ 74.34023613 -2.16268162] 279 | [ -2.16268162 -13.80311758] 280 | [ 71.36442301 -0.67007757] 281 | [ -0.67007757 -12.99228926] 282 | [ 73.82819249 0.65534114] 283 | [ 0.65534114 -2.11401429] 284 | [ 62.14963075 1.23866953] 285 | [ 1.23866953 -2.17750699] 286 | [ 62.66439364 0.79967697] 287 | [ 0.79967697 -2.78772411] 288 | [ 63.41065176 -0. ] 289 | [ -0. -2.58577155] 290 | [ 62.66439364 -0.79967697] 291 | [ -0.79967697 -2.78772411] 292 | [ 62.14963075 -1.23866953] 293 | [ -1.23866953 -2.17750699] 294 | [ 73.82819249 -0.65534114] 295 | [ -0.65534114 -2.11401429] 296 | [ 71.36442301 0.67007757] 297 | [ 0.67007757 -12.99228926] 298 | [ 69.25226613 0.60714709] 299 | [ 0.60714709 -12.75036077] 300 | [ 75.4101106 0.51692864] 301 | [ 0.51692864 -0.07595692] 302 | [ 62.82232615 1.43144818] 303 | [ 1.43144818 0.13261609] 304 | [ 63.367755 1.10853688] 305 | [ 1.10853688 -0.77579297] 306 | [ 64.60708179 -0. ] 307 | [ -0. -0.47045657] 308 | [ 63.367755 -1.10853688] 309 | [ -1.10853688 -0.77579297] 310 | [ 62.82232615 -1.43144818] 311 | [ -1.43144818 0.13261609] 312 | [ 75.4101106 -0.51692864] 313 | [ -0.51692864 -0.07595692] 314 | [ 69.25226613 -0.60714709] 315 | [ -0.60714709 -12.75036077] 316 | [ 53.09690775 -2.58749717] 317 | [ -2.58749717 -14.12510307] 318 | [ 55.83154512 1.80084448] 319 | [ 1.80084448 -7.00212102] 320 | [ 46.01085612 1.64332119] 321 | [ 1.64332119 -8.22002051] 322 | [ 46.17029797 1.45385963] 323 | [ 1.45385963 -8.66250519] 324 | [ 47.3081719 -0. ] 325 | [ -0. -8.4441596 ] 326 | [ 46.17029797 -1.45385963] 327 | [ -1.45385963 -8.66250519] 328 | [ 46.01085612 -1.64332119] 329 | [ -1.64332119 -8.22002051] 330 | [ 55.83154512 -1.80084448] 331 | [ -1.80084448 -7.00212102] 332 | [ 53.09690775 2.58749717] 333 | [ 2.58749717 -14.12510307] 334 | [ 88.96745073 -15.86983932] 335 | [-15.86983932 -14.56192123] 336 | [ 86.19740204 -3.36041418] 337 | [ -3.36041418 -4.15848888] 338 | [ 82.72462428 0.5117425 ] 339 | [ 0.5117425 -1.46275553] 340 | [ 84.45199516 1.21500678] 341 | [ 1.21500678 -3.02876156] 342 | [ 86.00693444 -0. ] 343 | [ -0. -2.30284653] 344 | [ 84.45199516 -1.21500678] 345 | [ -1.21500678 -3.02876156] 346 | [ 82.72462428 -0.5117425 ] 347 | [ -0.5117425 -1.46275553] 348 | [ 86.19740204 3.36041418] 349 | [ 3.36041418 -4.15848888] 350 | [ 88.96745073 15.86983932] 351 | [ 15.86983932 -14.56192123]] 352 | strain_energy 353 | [[0. 0.30710519] 354 | [0. 0.22481028] 355 | [0. 0.1579566 ] 356 | [0. 0.14709893] 357 | [0. 0.14748753] 358 | [0. 0.14709893] 359 | [0. 0.1579566 ] 360 | [0. 0.22481028] 361 | [0. 0.30710519] 362 | [0. 0.73956924] 363 | [0. 0.5712543 ] 364 | [0. 0.40774595] 365 | [0. 0.37847999] 366 | [0. 0.37689826] 367 | [0. 0.37847999] 368 | [0. 0.40774595] 369 | [0. 0.5712543 ] 370 | [0. 0.73956924] 371 | [0. 0.46288998] 372 | [0. 0.49806534] 373 | [0. 0.40898036] 374 | [0. 0.37968978] 375 | [0. 0.37199399] 376 | [0. 0.37968978] 377 | [0. 0.40898036] 378 | [0. 0.49806534] 379 | [0. 0.46288998] 380 | [0. 0.63250731] 381 | [0. 0.70355618] 382 | [0. 0.6073146 ] 383 | [0. 0.5824065 ] 384 | [0. 0.57634328] 385 | [0. 0.5824065 ] 386 | [0. 0.6073146 ] 387 | [0. 0.70355618] 388 | [0. 0.63250731] 389 | [0. 0.60844689] 390 | [0. 0.66285325] 391 | [0. 0.60022254] 392 | [0. 0.61108169] 393 | [0. 0.61295226] 394 | [0. 0.61108169] 395 | [0. 0.60022254] 396 | [0. 0.66285325] 397 | [0. 0.60844689] 398 | [0. 0.58683228] 399 | [0. 0.62349926] 400 | [0. 0.58517585] 401 | [0. 0.60623194] 402 | [0. 0.61299345] 403 | [0. 0.60623194] 404 | [0. 0.58517585] 405 | [0. 0.62349926] 406 | [0. 0.58683228] 407 | [0. 0.64488432] 408 | [0. 0.73325852] 409 | [0. 0.68074465] 410 | [0. 0.72306372] 411 | [0. 0.74402403] 412 | [0. 0.72306372] 413 | [0. 0.68074465] 414 | [0. 0.73325852] 415 | [0. 0.64488432] 416 | [0. 0.44798902] 417 | [0. 0.462848 ] 418 | [0. 0.43864109] 419 | [0. 0.47164665] 420 | [0. 0.48616723] 421 | [0. 0.47164665] 422 | [0. 0.43864109] 423 | [0. 0.462848 ] 424 | [0. 0.44798902] 425 | [0. 0.99078788] 426 | [0. 0.85482742] 427 | [0. 0.94424155] 428 | [0. 1.02677049] 429 | [0. 1.04634826] 430 | [0. 1.02677049] 431 | [0. 0.94424155] 432 | [0. 0.85482742] 433 | [0. 0.99078788]] 434 | Duration: 246.6991222381592 minutes 435 | -------------------------------------------------------------------------------- /test/2D_x-.res: -------------------------------------------------------------------------------- 1 | iteration 1 480.0 2 | iteration 2 181.070003820859 3 | iteration 3 59.63642483703567 4 | iteration 4 18.3259416136047 5 | iteration 5 8.535597742167006 6 | iteration 6 3.1367923033091625 7 | iteration 7 1.761023491200188 8 | iteration 8 0.8917794445596613 9 | iteration 9 0.523201577881178 10 | iteration 10 0.3030564751174158 11 | iteration 11 0.17920088977805923 12 | iteration 12 0.10694656869770572 13 | iteration 13 0.06363763892383822 14 | iteration 14 0.03814484028653959 15 | iteration 15 0.02280225953153786 16 | iteration 16 0.013663298646362433 17 | iteration 17 0.008189910892807436 18 | iteration 18 0.0049037619952641475 19 | iteration 19 0.00294362923200884 20 | iteration 20 0.0017616215471746414 21 | iteration 21 0.0010582415545012567 22 | t_n: 1 res: 0.0006331305737201885 Iteration # 21 23 | delta_x = 0.5 24 | Horizon = 1.5014999999999998 25 | epsilon_tensor 26 | [[ 0.02092183 0.00012632] 27 | [ 0.00012632 -0.00614744] 28 | [ 0.02001114 -0.00021127] 29 | [-0.00021127 -0.00462239] 30 | [ 0.02345409 -0.00017735] 31 | [-0.00017735 -0.004801 ] 32 | [ 0.02533854 -0.00045346] 33 | [-0.00045346 -0.00455936] 34 | [ 0.02576872 0. ] 35 | [ 0. -0.00448055] 36 | [ 0.02533854 0.00045346] 37 | [ 0.00045346 -0.00455936] 38 | [ 0.02345409 0.00017735] 39 | [ 0.00017735 -0.004801 ] 40 | [ 0.02001114 0.00021127] 41 | [ 0.00021127 -0.00462239] 42 | [ 0.02092183 -0.00012632] 43 | [-0.00012632 -0.00614744] 44 | [ 0.01492187 -0.00232317] 45 | [-0.00232317 -0.00523822] 46 | [ 0.01486589 -0.00145527] 47 | [-0.00145527 -0.00481154] 48 | [ 0.01549842 -0.00051904] 49 | [-0.00051904 -0.00514485] 50 | [ 0.01612508 -0.00048735] 51 | [-0.00048735 -0.00475357] 52 | [ 0.01649521 0. ] 53 | [ 0. -0.00477912] 54 | [ 0.01612508 0.00048735] 55 | [ 0.00048735 -0.00475357] 56 | [ 0.01549842 0.00051904] 57 | [ 0.00051904 -0.00514485] 58 | [ 0.01486589 0.00145527] 59 | [ 0.00145527 -0.00481154] 60 | [ 0.01492187 0.00232317] 61 | [ 0.00232317 -0.00523822] 62 | [ 0.0166062 -0.00021041] 63 | [-0.00021041 -0.00734047] 64 | [ 0.01734997 -0.00016327] 65 | [-0.00016327 -0.00535816] 66 | [ 0.0178578 -0.00041577] 67 | [-0.00041577 -0.00526681] 68 | [ 0.01850847 -0.00033676] 69 | [-0.00033676 -0.00496027] 70 | [ 0.01884639 0. ] 71 | [ 0. -0.00497383] 72 | [ 0.01850847 0.00033676] 73 | [ 0.00033676 -0.00496027] 74 | [ 0.0178578 0.00041577] 75 | [ 0.00041577 -0.00526681] 76 | [ 0.01734997 0.00016327] 77 | [ 0.00016327 -0.00535816] 78 | [ 0.0166062 0.00021041] 79 | [ 0.00021041 -0.00734047] 80 | [ 0.01546421 0.00025009] 81 | [ 0.00025009 -0.00719633] 82 | [ 0.01579478 -0.00021968] 83 | [-0.00021968 -0.00537605] 84 | [ 0.0163454 -0.00037629] 85 | [-0.00037629 -0.00530081] 86 | [ 0.0168949 -0.00025359] 87 | [-0.00025359 -0.00491956] 88 | [ 0.01708042 0. ] 89 | [ 0. -0.00491545] 90 | [ 0.0168949 0.00025359] 91 | [ 0.00025359 -0.00491956] 92 | [ 0.0163454 0.00037629] 93 | [ 0.00037629 -0.00530081] 94 | [ 0.01579478 0.00021968] 95 | [ 0.00021968 -0.00537605] 96 | [ 0.01546421 -0.00025009] 97 | [-0.00025009 -0.00719633] 98 | [ 0.01612157 -0.00080715] 99 | [-0.00080715 -0.00757669] 100 | [ 0.01653035 -0.00074589] 101 | [-0.00074589 -0.00535756] 102 | [ 0.01691583 -0.00060943] 103 | [-0.00060943 -0.00503057] 104 | [ 0.01735792 -0.00039991] 105 | [-0.00039991 -0.00443572] 106 | [ 0.01750382 0. ] 107 | [ 0. -0.0043245 ] 108 | [ 0.01735792 0.00039991] 109 | [ 0.00039991 -0.00443572] 110 | [ 0.01691583 0.00060943] 111 | [ 0.00060943 -0.00503057] 112 | [ 0.01653035 0.00074589] 113 | [ 0.00074589 -0.00535756] 114 | [ 0.01612157 0.00080715] 115 | [ 0.00080715 -0.00757669] 116 | [ 0.01613065 -0.0014596 ] 117 | [-0.0014596 -0.00741699] 118 | [ 0.01639611 -0.0015412 ] 119 | [-0.0015412 -0.00428135] 120 | [ 0.01651997 -0.00099025] 121 | [-0.00099025 -0.00395828] 122 | [ 0.0166282 -0.0005181 ] 123 | [-0.0005181 -0.00341688] 124 | [ 0.01667089 0. ] 125 | [ 0. -0.00322757] 126 | [ 0.0166282 0.0005181 ] 127 | [ 0.0005181 -0.00341688] 128 | [ 0.01651997 0.00099025] 129 | [ 0.00099025 -0.00395828] 130 | [ 0.01639611 0.0015412 ] 131 | [ 0.0015412 -0.00428135] 132 | [ 0.01613065 0.0014596 ] 133 | [ 0.0014596 -0.00741699] 134 | [ 0.01401315 -0.0008302 ] 135 | [-0.0008302 -0.00608402] 136 | [ 0.01401622 -0.00153823] 137 | [-0.00153823 -0.00282522] 138 | [ 0.01400285 -0.00118209] 139 | [-0.00118209 -0.00267236] 140 | [ 0.01385112 -0.00051992] 141 | [-0.00051992 -0.00224369] 142 | [ 0.01379774 0. ] 143 | [ 0. -0.00201725] 144 | [ 0.01385112 0.00051992] 145 | [ 0.00051992 -0.00224369] 146 | [ 0.01400285 0.00118209] 147 | [ 0.00118209 -0.00267236] 148 | [ 0.01401622 0.00153823] 149 | [ 0.00153823 -0.00282522] 150 | [ 0.01401315 0.0008302 ] 151 | [ 0.0008302 -0.00608402] 152 | [ 0.01469399 -0.00446765] 153 | [-0.00446765 0.0002258 ] 154 | [ 0.01481659 -0.00300497] 155 | [-0.00300497 -0.00108781] 156 | [ 0.01457015 -0.00153209] 157 | [-0.00153209 -0.00167606] 158 | [ 0.01418112 -0.0007265 ] 159 | [-0.0007265 -0.00102519] 160 | [ 0.01406354 0. ] 161 | [ 0. -0.00093576] 162 | [ 0.01418112 0.0007265 ] 163 | [ 0.0007265 -0.00102519] 164 | [ 0.01457015 0.00153209] 165 | [ 0.00153209 -0.00167606] 166 | [ 0.01481659 0.00300497] 167 | [ 0.00300497 -0.00108781] 168 | [ 0.01469399 0.00446765] 169 | [ 0.00446765 0.0002258 ] 170 | [ 0.01003764 -0.00160773] 171 | [-0.00160773 -0.00146895] 172 | [ 0.00895114 -0.00110709] 173 | [-0.00110709 -0.00115588] 174 | [ 0.00827904 -0.0008978 ] 175 | [-0.0008978 -0.00079774] 176 | [ 0.00798176 -0.00040912] 177 | [-0.00040912 -0.00042029] 178 | [ 0.00791137 0. ] 179 | [ 0. -0.0003668 ] 180 | [ 0.00798176 0.00040912] 181 | [ 0.00040912 -0.00042029] 182 | [ 0.00827904 0.0008978 ] 183 | [ 0.0008978 -0.00079774] 184 | [ 0.00895114 0.00110709] 185 | [ 0.00110709 -0.00115588] 186 | [ 0.01003764 0.00160773] 187 | [ 0.00160773 -0.00146895]] 188 | strain_longi [ 0. -0.00369031] 189 | stress_tensor 190 | [[ 88.96745073 15.86983932] 191 | [ 15.86983932 -14.56192123] 192 | [ 86.19740204 3.36041418] 193 | [ 3.36041418 -4.15848888] 194 | [ 82.72462428 -0.5117425 ] 195 | [ -0.5117425 -1.46275553] 196 | [ 84.45199516 -1.21500678] 197 | [ -1.21500678 -3.02876156] 198 | [ 86.00693444 0. ] 199 | [ 0. -2.30284653] 200 | [ 84.45199516 1.21500678] 201 | [ 1.21500678 -3.02876156] 202 | [ 82.72462428 0.5117425 ] 203 | [ 0.5117425 -1.46275553] 204 | [ 86.19740204 -3.36041418] 205 | [ -3.36041418 -4.15848888] 206 | [ 88.96745073 -15.86983932] 207 | [-15.86983932 -14.56192123] 208 | [ 53.09690775 2.58749717] 209 | [ 2.58749717 -14.12510307] 210 | [ 55.83154512 -1.80084448] 211 | [ -1.80084448 -7.00212102] 212 | [ 46.01085612 -1.64332119] 213 | [ -1.64332119 -8.22002051] 214 | [ 46.17029797 -1.45385963] 215 | [ -1.45385963 -8.66250519] 216 | [ 47.3081719 0. ] 217 | [ 0. -8.4441596 ] 218 | [ 46.17029797 1.45385963] 219 | [ 1.45385963 -8.66250519] 220 | [ 46.01085612 1.64332119] 221 | [ 1.64332119 -8.22002051] 222 | [ 55.83154512 1.80084448] 223 | [ 1.80084448 -7.00212102] 224 | [ 53.09690775 -2.58749717] 225 | [ -2.58749717 -14.12510307] 226 | [ 69.25226613 -0.60714709] 227 | [ -0.60714709 -12.75036077] 228 | [ 75.4101106 -0.51692864] 229 | [ -0.51692864 -0.07595692] 230 | [ 62.82232615 -1.43144818] 231 | [ -1.43144818 0.13261609] 232 | [ 63.367755 -1.10853688] 233 | [ -1.10853688 -0.77579297] 234 | [ 64.60708179 0. ] 235 | [ 0. -0.47045657] 236 | [ 63.367755 1.10853688] 237 | [ 1.10853688 -0.77579297] 238 | [ 62.82232615 1.43144818] 239 | [ 1.43144818 0.13261609] 240 | [ 75.4101106 0.51692864] 241 | [ 0.51692864 -0.07595692] 242 | [ 69.25226613 0.60714709] 243 | [ 0.60714709 -12.75036077] 244 | [ 71.36442301 0.67007757] 245 | [ 0.67007757 -12.99228926] 246 | [ 73.82819249 -0.65534114] 247 | [ -0.65534114 -2.11401429] 248 | [ 62.14963075 -1.23866953] 249 | [ -1.23866953 -2.17750699] 250 | [ 62.66439364 -0.79967697] 251 | [ -0.79967697 -2.78772411] 252 | [ 63.41065176 0. ] 253 | [ 0. -2.58577155] 254 | [ 62.66439364 0.79967697] 255 | [ 0.79967697 -2.78772411] 256 | [ 62.14963075 1.23866953] 257 | [ 1.23866953 -2.17750699] 258 | [ 73.82819249 0.65534114] 259 | [ 0.65534114 -2.11401429] 260 | [ 71.36442301 -0.67007757] 261 | [ -0.67007757 -12.99228926] 262 | [ 74.34023613 -2.16268162] 263 | [ -2.16268162 -13.80311758] 264 | [ 77.51764832 -2.22512728] 265 | [ -2.22512728 -1.36859297] 266 | [ 64.80572867 -2.00613572] 267 | [ -2.00613572 -0.56433756] 268 | [ 65.0003135 -1.26108264] 269 | [ -1.26108264 -0.3893333 ] 270 | [ 65.69515215 0. ] 271 | [ 0. 0.20146282] 272 | [ 65.0003135 1.26108264] 273 | [ 1.26108264 -0.3893333 ] 274 | [ 64.80572867 2.00613572] 275 | [ 2.00613572 -0.56433756] 276 | [ 77.51764832 2.22512728] 277 | [ 2.22512728 -1.36859297] 278 | [ 74.34023613 2.16268162] 279 | [ 2.16268162 -13.80311758] 280 | [ 74.5093246 -3.91084698] 281 | [ -3.91084698 -13.24150071] 282 | [ 77.85318851 -4.59768485] 283 | [ -4.59768485 1.88390243] 284 | [ 64.31062143 -3.25973053] 285 | [ -3.25973053 2.99076987] 286 | [ 63.09993027 -1.63380018] 287 | [ -1.63380018 2.95664706] 288 | [ 63.45998906 0. ] 289 | [ 0. 3.75662846] 290 | [ 63.09993027 1.63380018] 291 | [ 1.63380018 2.95664706] 292 | [ 64.31062143 3.25973053] 293 | [ 3.25973053 2.99076987] 294 | [ 77.85318851 4.59768485] 295 | [ 4.59768485 1.88390243] 296 | [ 74.5093246 3.91084698] 297 | [ 3.91084698 -13.24150071] 298 | [ 58.53448335 -2.39554646] 299 | [ -2.39554646 -10.3509557 ] 300 | [ 62.44870969 -4.87013249] 301 | [ -4.87013249 4.90917545] 302 | [ 50.92908807 -4.06981011] 303 | [ -4.06981011 5.72337127] 304 | [ 48.99364223 -1.7114863 ] 305 | [ -1.7114863 5.51229711] 306 | [ 49.03789509 0. ] 307 | [ 0. 6.39475153] 308 | [ 48.99364223 1.7114863 ] 309 | [ 1.7114863 5.51229711] 310 | [ 50.92908807 4.06981011] 311 | [ 4.06981011 5.72337127] 312 | [ 62.44870969 4.87013249] 313 | [ 4.87013249 4.90917545] 314 | [ 58.53448335 2.39554646] 315 | [ 2.39554646 -10.3509557 ] 316 | [ 65.72484308 -21.88715236] 317 | [-21.88715236 15.06357479] 318 | [ 61.20391757 -12.26428103] 319 | [-12.26428103 10.41821472] 320 | [ 46.46842234 -4.85066713] 321 | [ -4.85066713 7.00214239] 322 | [ 43.55284075 -2.16727297] 323 | [ -2.16727297 8.13403544] 324 | [ 43.26734493 0. ] 325 | [ 0. 8.47060412] 326 | [ 43.55284075 2.16727297] 327 | [ 2.16727297 8.13403544] 328 | [ 46.46842234 4.85066713] 329 | [ 4.85066713 7.00214239] 330 | [ 61.20391757 12.26428103] 331 | [ 12.26428103 10.41821472] 332 | [ 65.72484308 21.88715236] 333 | [ 21.88715236 15.06357479] 334 | [ 46.82133136 -12.46225405] 335 | [-12.46225405 2.81310801] 336 | [ 40.0883594 -5.23961168] 337 | [ -5.23961168 3.50202802] 338 | [ 29.98125054 -2.59060958] 339 | [ -2.59060958 3.56918485] 340 | [ 27.39092542 -1.09620205] 341 | [ -1.09620205 4.10102343] 342 | [ 27.18799613 0. ] 343 | [ 0. 4.31256978] 344 | [ 27.39092542 1.09620205] 345 | [ 1.09620205 4.10102343] 346 | [ 29.98125054 2.59060958] 347 | [ 2.59060958 3.56918485] 348 | [ 40.0883594 5.23961168] 349 | [ 5.23961168 3.50202802] 350 | [ 46.82133136 12.46225405] 351 | [ 12.46225405 2.81310801]] 352 | strain_energy 353 | [[0. 0.99078788] 354 | [0. 0.85482742] 355 | [0. 0.94424155] 356 | [0. 1.02677049] 357 | [0. 1.04634826] 358 | [0. 1.02677049] 359 | [0. 0.94424155] 360 | [0. 0.85482742] 361 | [0. 0.99078788] 362 | [0. 0.44798902] 363 | [0. 0.462848 ] 364 | [0. 0.43864109] 365 | [0. 0.47164665] 366 | [0. 0.48616723] 367 | [0. 0.47164665] 368 | [0. 0.43864109] 369 | [0. 0.462848 ] 370 | [0. 0.44798902] 371 | [0. 0.64488432] 372 | [0. 0.73325852] 373 | [0. 0.68074465] 374 | [0. 0.72306372] 375 | [0. 0.74402403] 376 | [0. 0.72306372] 377 | [0. 0.68074465] 378 | [0. 0.73325852] 379 | [0. 0.64488432] 380 | [0. 0.58683228] 381 | [0. 0.62349926] 382 | [0. 0.58517585] 383 | [0. 0.60623194] 384 | [0. 0.61299345] 385 | [0. 0.60623194] 386 | [0. 0.58517585] 387 | [0. 0.62349926] 388 | [0. 0.58683228] 389 | [0. 0.60844689] 390 | [0. 0.66285325] 391 | [0. 0.60022254] 392 | [0. 0.61108169] 393 | [0. 0.61295226] 394 | [0. 0.61108169] 395 | [0. 0.60022254] 396 | [0. 0.66285325] 397 | [0. 0.60844689] 398 | [0. 0.63250731] 399 | [0. 0.70355618] 400 | [0. 0.6073146 ] 401 | [0. 0.5824065 ] 402 | [0. 0.57634328] 403 | [0. 0.5824065 ] 404 | [0. 0.6073146 ] 405 | [0. 0.70355618] 406 | [0. 0.63250731] 407 | [0. 0.46288998] 408 | [0. 0.49806534] 409 | [0. 0.40898036] 410 | [0. 0.37968978] 411 | [0. 0.37199399] 412 | [0. 0.37968978] 413 | [0. 0.40898036] 414 | [0. 0.49806534] 415 | [0. 0.46288998] 416 | [0. 0.73956924] 417 | [0. 0.5712543 ] 418 | [0. 0.40774595] 419 | [0. 0.37847999] 420 | [0. 0.37689826] 421 | [0. 0.37847999] 422 | [0. 0.40774595] 423 | [0. 0.5712543 ] 424 | [0. 0.73956924] 425 | [0. 0.30710519] 426 | [0. 0.22481028] 427 | [0. 0.1579566 ] 428 | [0. 0.14709893] 429 | [0. 0.14748753] 430 | [0. 0.14709893] 431 | [0. 0.1579566 ] 432 | [0. 0.22481028] 433 | [0. 0.30710519]] 434 | Duration: 173.48742953936258 minutes 435 | -------------------------------------------------------------------------------- /test/2D_y+.res: -------------------------------------------------------------------------------- 1 | iteration 1 480.0 2 | iteration 2 181.07000384157303 3 | iteration 3 59.63642484045434 4 | iteration 4 18.325941614227748 5 | iteration 5 8.535597740624068 6 | iteration 6 3.13679230095609 7 | iteration 7 1.761023489409903 8 | iteration 8 0.8917794431792232 9 | iteration 9 0.5232015770348074 10 | iteration 10 0.303056474571264 11 | iteration 11 0.1792008894421149 12 | iteration 12 0.10694656848489803 13 | iteration 13 0.06363763879196457 14 | iteration 14 0.03814484020422977 15 | iteration 15 0.022802259479790303 16 | iteration 16 0.01366329861363433 17 | iteration 17 0.008189910876961401 18 | iteration 18 0.004903761987440003 19 | iteration 19 0.0029436292247025375 20 | iteration 20 0.0017616215427076207 21 | iteration 21 0.0010582415527062617 22 | t_n: 1 res: 0.0006331305719290145 Iteration # 21 23 | delta_x = 0.5 24 | Horizon = 1.5014999999999998 25 | epsilon_tensor 26 | [[-0.00146895 0.00160773] 27 | [ 0.00160773 0.01003764] 28 | [ 0.0002258 0.00446765] 29 | [ 0.00446765 0.01469399] 30 | [-0.00608402 0.0008302 ] 31 | [ 0.0008302 0.01401315] 32 | [-0.00741699 0.0014596 ] 33 | [ 0.0014596 0.01613065] 34 | [-0.00757669 0.00080715] 35 | [ 0.00080715 0.01612157] 36 | [-0.00719633 -0.00025009] 37 | [-0.00025009 0.01546421] 38 | [-0.00734047 0.00021041] 39 | [ 0.00021041 0.0166062 ] 40 | [-0.00523822 0.00232317] 41 | [ 0.00232317 0.01492187] 42 | [-0.00614744 -0.00012632] 43 | [-0.00012632 0.02092183] 44 | [-0.00115588 0.00110709] 45 | [ 0.00110709 0.00895114] 46 | [-0.00108781 0.00300497] 47 | [ 0.00300497 0.01481659] 48 | [-0.00282522 0.00153823] 49 | [ 0.00153823 0.01401622] 50 | [-0.00428135 0.0015412 ] 51 | [ 0.0015412 0.01639611] 52 | [-0.00535756 0.00074589] 53 | [ 0.00074589 0.01653035] 54 | [-0.00537605 0.00021968] 55 | [ 0.00021968 0.01579478] 56 | [-0.00535816 0.00016327] 57 | [ 0.00016327 0.01734997] 58 | [-0.00481154 0.00145527] 59 | [ 0.00145527 0.01486589] 60 | [-0.00462239 0.00021127] 61 | [ 0.00021127 0.02001114] 62 | [-0.00079774 0.0008978 ] 63 | [ 0.0008978 0.00827904] 64 | [-0.00167606 0.00153209] 65 | [ 0.00153209 0.01457015] 66 | [-0.00267236 0.00118209] 67 | [ 0.00118209 0.01400285] 68 | [-0.00395828 0.00099025] 69 | [ 0.00099025 0.01651997] 70 | [-0.00503057 0.00060943] 71 | [ 0.00060943 0.01691583] 72 | [-0.00530081 0.00037629] 73 | [ 0.00037629 0.0163454 ] 74 | [-0.00526681 0.00041577] 75 | [ 0.00041577 0.0178578 ] 76 | [-0.00514485 0.00051904] 77 | [ 0.00051904 0.01549842] 78 | [-0.004801 0.00017735] 79 | [ 0.00017735 0.02345409] 80 | [-0.00042029 0.00040912] 81 | [ 0.00040912 0.00798176] 82 | [-0.00102519 0.0007265 ] 83 | [ 0.0007265 0.01418112] 84 | [-0.00224369 0.00051992] 85 | [ 0.00051992 0.01385112] 86 | [-0.00341688 0.0005181 ] 87 | [ 0.0005181 0.0166282 ] 88 | [-0.00443572 0.00039991] 89 | [ 0.00039991 0.01735792] 90 | [-0.00491956 0.00025359] 91 | [ 0.00025359 0.0168949 ] 92 | [-0.00496027 0.00033676] 93 | [ 0.00033676 0.01850847] 94 | [-0.00475357 0.00048735] 95 | [ 0.00048735 0.01612508] 96 | [-0.00455936 0.00045346] 97 | [ 0.00045346 0.02533854] 98 | [-0.0003668 -0. ] 99 | [-0. 0.00791137] 100 | [-0.00093576 -0. ] 101 | [-0. 0.01406354] 102 | [-0.00201725 -0. ] 103 | [-0. 0.01379774] 104 | [-0.00322757 -0. ] 105 | [-0. 0.01667089] 106 | [-0.0043245 -0. ] 107 | [-0. 0.01750382] 108 | [-0.00491545 -0. ] 109 | [-0. 0.01708042] 110 | [-0.00497383 -0. ] 111 | [-0. 0.01884639] 112 | [-0.00477912 -0. ] 113 | [-0. 0.01649521] 114 | [-0.00448055 -0. ] 115 | [-0. 0.02576872] 116 | [-0.00042029 -0.00040912] 117 | [-0.00040912 0.00798176] 118 | [-0.00102519 -0.0007265 ] 119 | [-0.0007265 0.01418112] 120 | [-0.00224369 -0.00051992] 121 | [-0.00051992 0.01385112] 122 | [-0.00341688 -0.0005181 ] 123 | [-0.0005181 0.0166282 ] 124 | [-0.00443572 -0.00039991] 125 | [-0.00039991 0.01735792] 126 | [-0.00491956 -0.00025359] 127 | [-0.00025359 0.0168949 ] 128 | [-0.00496027 -0.00033676] 129 | [-0.00033676 0.01850847] 130 | [-0.00475357 -0.00048735] 131 | [-0.00048735 0.01612508] 132 | [-0.00455936 -0.00045346] 133 | [-0.00045346 0.02533854] 134 | [-0.00079774 -0.0008978 ] 135 | [-0.0008978 0.00827904] 136 | [-0.00167606 -0.00153209] 137 | [-0.00153209 0.01457015] 138 | [-0.00267236 -0.00118209] 139 | [-0.00118209 0.01400285] 140 | [-0.00395828 -0.00099025] 141 | [-0.00099025 0.01651997] 142 | [-0.00503057 -0.00060943] 143 | [-0.00060943 0.01691583] 144 | [-0.00530081 -0.00037629] 145 | [-0.00037629 0.0163454 ] 146 | [-0.00526681 -0.00041577] 147 | [-0.00041577 0.0178578 ] 148 | [-0.00514485 -0.00051904] 149 | [-0.00051904 0.01549842] 150 | [-0.004801 -0.00017735] 151 | [-0.00017735 0.02345409] 152 | [-0.00115588 -0.00110709] 153 | [-0.00110709 0.00895114] 154 | [-0.00108781 -0.00300497] 155 | [-0.00300497 0.01481659] 156 | [-0.00282522 -0.00153823] 157 | [-0.00153823 0.01401622] 158 | [-0.00428135 -0.0015412 ] 159 | [-0.0015412 0.01639611] 160 | [-0.00535756 -0.00074589] 161 | [-0.00074589 0.01653035] 162 | [-0.00537605 -0.00021968] 163 | [-0.00021968 0.01579478] 164 | [-0.00535816 -0.00016327] 165 | [-0.00016327 0.01734997] 166 | [-0.00481154 -0.00145527] 167 | [-0.00145527 0.01486589] 168 | [-0.00462239 -0.00021127] 169 | [-0.00021127 0.02001114] 170 | [-0.00146895 -0.00160773] 171 | [-0.00160773 0.01003764] 172 | [ 0.0002258 -0.00446765] 173 | [-0.00446765 0.01469399] 174 | [-0.00608402 -0.0008302 ] 175 | [-0.0008302 0.01401315] 176 | [-0.00741699 -0.0014596 ] 177 | [-0.0014596 0.01613065] 178 | [-0.00757669 -0.00080715] 179 | [-0.00080715 0.01612157] 180 | [-0.00719633 0.00025009] 181 | [ 0.00025009 0.01546421] 182 | [-0.00734047 -0.00021041] 183 | [-0.00021041 0.0166062 ] 184 | [-0.00523822 -0.00232317] 185 | [-0.00232317 0.01492187] 186 | [-0.00614744 0.00012632] 187 | [ 0.00012632 0.02092183]] 188 | strain_longi [0. 0.010704] 189 | stress_tensor 190 | [[ 2.81310801 12.46225405] 191 | [ 12.46225405 46.82133136] 192 | [ 15.06357479 21.88715236] 193 | [ 21.88715236 65.72484308] 194 | [-10.3509557 2.39554646] 195 | [ 2.39554646 58.53448335] 196 | [-13.24150071 3.91084698] 197 | [ 3.91084698 74.5093246 ] 198 | [-13.80311758 2.16268162] 199 | [ 2.16268162 74.34023613] 200 | [-12.99228926 -0.67007757] 201 | [ -0.67007757 71.36442301] 202 | [-12.75036077 0.60714709] 203 | [ 0.60714709 69.25226613] 204 | [-14.12510307 -2.58749717] 205 | [ -2.58749717 53.09690775] 206 | [-14.56192123 -15.86983932] 207 | [-15.86983932 88.96745073] 208 | [ 3.50202802 5.23961168] 209 | [ 5.23961168 40.0883594 ] 210 | [ 10.41821472 12.26428103] 211 | [ 12.26428103 61.20391757] 212 | [ 4.90917545 4.87013249] 213 | [ 4.87013249 62.44870969] 214 | [ 1.88390243 4.59768485] 215 | [ 4.59768485 77.85318851] 216 | [ -1.36859297 2.22512728] 217 | [ 2.22512728 77.51764832] 218 | [ -2.11401429 0.65534114] 219 | [ 0.65534114 73.82819249] 220 | [ -0.07595692 0.51692864] 221 | [ 0.51692864 75.4101106 ] 222 | [ -7.00212102 1.80084448] 223 | [ 1.80084448 55.83154512] 224 | [ -4.15848888 -3.36041418] 225 | [ -3.36041418 86.19740204] 226 | [ 3.56918485 2.59060958] 227 | [ 2.59060958 29.98125054] 228 | [ 7.00214239 4.85066713] 229 | [ 4.85066713 46.46842234] 230 | [ 5.72337127 4.06981011] 231 | [ 4.06981011 50.92908807] 232 | [ 2.99076987 3.25973053] 233 | [ 3.25973053 64.31062143] 234 | [ -0.56433756 2.00613572] 235 | [ 2.00613572 64.80572867] 236 | [ -2.17750699 1.23866953] 237 | [ 1.23866953 62.14963075] 238 | [ 0.13261609 1.43144818] 239 | [ 1.43144818 62.82232615] 240 | [ -8.22002051 1.64332119] 241 | [ 1.64332119 46.01085612] 242 | [ -1.46275553 0.5117425 ] 243 | [ 0.5117425 82.72462428] 244 | [ 4.10102343 1.09620205] 245 | [ 1.09620205 27.39092542] 246 | [ 8.13403544 2.16727297] 247 | [ 2.16727297 43.55284075] 248 | [ 5.51229711 1.7114863 ] 249 | [ 1.7114863 48.99364223] 250 | [ 2.95664706 1.63380018] 251 | [ 1.63380018 63.09993027] 252 | [ -0.3893333 1.26108264] 253 | [ 1.26108264 65.0003135 ] 254 | [ -2.78772411 0.79967697] 255 | [ 0.79967697 62.66439364] 256 | [ -0.77579297 1.10853688] 257 | [ 1.10853688 63.367755 ] 258 | [ -8.66250519 1.45385963] 259 | [ 1.45385963 46.17029797] 260 | [ -3.02876156 1.21500678] 261 | [ 1.21500678 84.45199516] 262 | [ 4.31256978 -0. ] 263 | [ -0. 27.18799613] 264 | [ 8.47060412 -0. ] 265 | [ -0. 43.26734493] 266 | [ 6.39475153 -0. ] 267 | [ -0. 49.03789509] 268 | [ 3.75662846 -0. ] 269 | [ -0. 63.45998906] 270 | [ 0.20146282 -0. ] 271 | [ -0. 65.69515215] 272 | [ -2.58577155 -0. ] 273 | [ -0. 63.41065176] 274 | [ -0.47045657 -0. ] 275 | [ -0. 64.60708179] 276 | [ -8.4441596 -0. ] 277 | [ -0. 47.3081719 ] 278 | [ -2.30284653 -0. ] 279 | [ -0. 86.00693444] 280 | [ 4.10102343 -1.09620205] 281 | [ -1.09620205 27.39092542] 282 | [ 8.13403544 -2.16727297] 283 | [ -2.16727297 43.55284075] 284 | [ 5.51229711 -1.7114863 ] 285 | [ -1.7114863 48.99364223] 286 | [ 2.95664706 -1.63380018] 287 | [ -1.63380018 63.09993027] 288 | [ -0.3893333 -1.26108264] 289 | [ -1.26108264 65.0003135 ] 290 | [ -2.78772411 -0.79967697] 291 | [ -0.79967697 62.66439364] 292 | [ -0.77579297 -1.10853688] 293 | [ -1.10853688 63.367755 ] 294 | [ -8.66250519 -1.45385963] 295 | [ -1.45385963 46.17029797] 296 | [ -3.02876156 -1.21500678] 297 | [ -1.21500678 84.45199516] 298 | [ 3.56918485 -2.59060958] 299 | [ -2.59060958 29.98125054] 300 | [ 7.00214239 -4.85066713] 301 | [ -4.85066713 46.46842234] 302 | [ 5.72337127 -4.06981011] 303 | [ -4.06981011 50.92908807] 304 | [ 2.99076987 -3.25973053] 305 | [ -3.25973053 64.31062143] 306 | [ -0.56433756 -2.00613572] 307 | [ -2.00613572 64.80572867] 308 | [ -2.17750699 -1.23866953] 309 | [ -1.23866953 62.14963075] 310 | [ 0.13261609 -1.43144818] 311 | [ -1.43144818 62.82232615] 312 | [ -8.22002051 -1.64332119] 313 | [ -1.64332119 46.01085612] 314 | [ -1.46275553 -0.5117425 ] 315 | [ -0.5117425 82.72462428] 316 | [ 3.50202802 -5.23961168] 317 | [ -5.23961168 40.0883594 ] 318 | [ 10.41821472 -12.26428103] 319 | [-12.26428103 61.20391757] 320 | [ 4.90917545 -4.87013249] 321 | [ -4.87013249 62.44870969] 322 | [ 1.88390243 -4.59768485] 323 | [ -4.59768485 77.85318851] 324 | [ -1.36859297 -2.22512728] 325 | [ -2.22512728 77.51764832] 326 | [ -2.11401429 -0.65534114] 327 | [ -0.65534114 73.82819249] 328 | [ -0.07595692 -0.51692864] 329 | [ -0.51692864 75.4101106 ] 330 | [ -7.00212102 -1.80084448] 331 | [ -1.80084448 55.83154512] 332 | [ -4.15848888 3.36041418] 333 | [ 3.36041418 86.19740204] 334 | [ 2.81310801 -12.46225405] 335 | [-12.46225405 46.82133136] 336 | [ 15.06357479 -21.88715236] 337 | [-21.88715236 65.72484308] 338 | [-10.3509557 -2.39554646] 339 | [ -2.39554646 58.53448335] 340 | [-13.24150071 -3.91084698] 341 | [ -3.91084698 74.5093246 ] 342 | [-13.80311758 -2.16268162] 343 | [ -2.16268162 74.34023613] 344 | [-12.99228926 0.67007757] 345 | [ 0.67007757 71.36442301] 346 | [-12.75036077 -0.60714709] 347 | [ -0.60714709 69.25226613] 348 | [-14.12510307 2.58749717] 349 | [ 2.58749717 53.09690775] 350 | [-14.56192123 15.86983932] 351 | [ 15.86983932 88.96745073]] 352 | strain_energy 353 | [[0. 0.30710519] 354 | [0. 0.73956924] 355 | [0. 0.46288998] 356 | [0. 0.63250731] 357 | [0. 0.60844689] 358 | [0. 0.58683228] 359 | [0. 0.64488432] 360 | [0. 0.44798902] 361 | [0. 0.99078788] 362 | [0. 0.22481028] 363 | [0. 0.5712543 ] 364 | [0. 0.49806534] 365 | [0. 0.70355618] 366 | [0. 0.66285325] 367 | [0. 0.62349926] 368 | [0. 0.73325852] 369 | [0. 0.462848 ] 370 | [0. 0.85482742] 371 | [0. 0.1579566 ] 372 | [0. 0.40774595] 373 | [0. 0.40898036] 374 | [0. 0.6073146 ] 375 | [0. 0.60022254] 376 | [0. 0.58517585] 377 | [0. 0.68074465] 378 | [0. 0.43864109] 379 | [0. 0.94424155] 380 | [0. 0.14709893] 381 | [0. 0.37847999] 382 | [0. 0.37968978] 383 | [0. 0.5824065 ] 384 | [0. 0.61108169] 385 | [0. 0.60623194] 386 | [0. 0.72306372] 387 | [0. 0.47164665] 388 | [0. 1.02677049] 389 | [0. 0.14748753] 390 | [0. 0.37689826] 391 | [0. 0.37199399] 392 | [0. 0.57634328] 393 | [0. 0.61295226] 394 | [0. 0.61299345] 395 | [0. 0.74402403] 396 | [0. 0.48616723] 397 | [0. 1.04634826] 398 | [0. 0.14709893] 399 | [0. 0.37847999] 400 | [0. 0.37968978] 401 | [0. 0.5824065 ] 402 | [0. 0.61108169] 403 | [0. 0.60623194] 404 | [0. 0.72306372] 405 | [0. 0.47164665] 406 | [0. 1.02677049] 407 | [0. 0.1579566 ] 408 | [0. 0.40774595] 409 | [0. 0.40898036] 410 | [0. 0.6073146 ] 411 | [0. 0.60022254] 412 | [0. 0.58517585] 413 | [0. 0.68074465] 414 | [0. 0.43864109] 415 | [0. 0.94424155] 416 | [0. 0.22481028] 417 | [0. 0.5712543 ] 418 | [0. 0.49806534] 419 | [0. 0.70355618] 420 | [0. 0.66285325] 421 | [0. 0.62349926] 422 | [0. 0.73325852] 423 | [0. 0.462848 ] 424 | [0. 0.85482742] 425 | [0. 0.30710519] 426 | [0. 0.73956924] 427 | [0. 0.46288998] 428 | [0. 0.63250731] 429 | [0. 0.60844689] 430 | [0. 0.58683228] 431 | [0. 0.64488432] 432 | [0. 0.44798902] 433 | [0. 0.99078788]] 434 | Duration: 175.99393534262975 minutes 435 | -------------------------------------------------------------------------------- /test/2D_y-.res: -------------------------------------------------------------------------------- 1 | iteration 1 480.0 2 | iteration 2 181.0700038208588 3 | iteration 3 59.6364248349593 4 | iteration 4 18.325941612771675 5 | iteration 5 8.535597741911964 6 | iteration 6 3.136792303504071 7 | iteration 7 1.7610234913288436 8 | iteration 8 0.8917794446868816 9 | iteration 9 0.5232015779748552 10 | iteration 10 0.3030564751762591 11 | iteration 11 0.1792008898130962 12 | iteration 12 0.10694656872059975 13 | iteration 13 0.0636376389380138 14 | iteration 14 0.03814484029507301 15 | iteration 15 0.02280225953765082 16 | iteration 16 0.013663298651669839 17 | iteration 17 0.008189910898470721 18 | iteration 18 0.00490376199816088 19 | iteration 19 0.0029436292327515157 20 | iteration 20 0.0017616215473813682 21 | iteration 21 0.0010582415555597927 22 | t_n: 1 res: 0.0006331305738704192 Iteration # 21 23 | delta_x = 0.5 24 | Horizon = 1.5014999999999998 25 | epsilon_tensor 26 | [[-0.00614744 0.00012632] 27 | [ 0.00012632 0.02092183] 28 | [-0.00523822 -0.00232317] 29 | [-0.00232317 0.01492187] 30 | [-0.00734047 -0.00021041] 31 | [-0.00021041 0.0166062 ] 32 | [-0.00719633 0.00025009] 33 | [ 0.00025009 0.01546421] 34 | [-0.00757669 -0.00080715] 35 | [-0.00080715 0.01612157] 36 | [-0.00741699 -0.0014596 ] 37 | [-0.0014596 0.01613065] 38 | [-0.00608402 -0.0008302 ] 39 | [-0.0008302 0.01401315] 40 | [ 0.0002258 -0.00446765] 41 | [-0.00446765 0.01469399] 42 | [-0.00146895 -0.00160773] 43 | [-0.00160773 0.01003764] 44 | [-0.00462239 -0.00021127] 45 | [-0.00021127 0.02001114] 46 | [-0.00481154 -0.00145527] 47 | [-0.00145527 0.01486589] 48 | [-0.00535816 -0.00016327] 49 | [-0.00016327 0.01734997] 50 | [-0.00537605 -0.00021968] 51 | [-0.00021968 0.01579478] 52 | [-0.00535756 -0.00074589] 53 | [-0.00074589 0.01653035] 54 | [-0.00428135 -0.0015412 ] 55 | [-0.0015412 0.01639611] 56 | [-0.00282522 -0.00153823] 57 | [-0.00153823 0.01401622] 58 | [-0.00108781 -0.00300497] 59 | [-0.00300497 0.01481659] 60 | [-0.00115588 -0.00110709] 61 | [-0.00110709 0.00895114] 62 | [-0.004801 -0.00017735] 63 | [-0.00017735 0.02345409] 64 | [-0.00514485 -0.00051904] 65 | [-0.00051904 0.01549842] 66 | [-0.00526681 -0.00041577] 67 | [-0.00041577 0.0178578 ] 68 | [-0.00530081 -0.00037629] 69 | [-0.00037629 0.0163454 ] 70 | [-0.00503057 -0.00060943] 71 | [-0.00060943 0.01691583] 72 | [-0.00395828 -0.00099025] 73 | [-0.00099025 0.01651997] 74 | [-0.00267236 -0.00118209] 75 | [-0.00118209 0.01400285] 76 | [-0.00167606 -0.00153209] 77 | [-0.00153209 0.01457015] 78 | [-0.00079774 -0.0008978 ] 79 | [-0.0008978 0.00827904] 80 | [-0.00455936 -0.00045346] 81 | [-0.00045346 0.02533854] 82 | [-0.00475357 -0.00048735] 83 | [-0.00048735 0.01612508] 84 | [-0.00496027 -0.00033676] 85 | [-0.00033676 0.01850847] 86 | [-0.00491956 -0.00025359] 87 | [-0.00025359 0.0168949 ] 88 | [-0.00443572 -0.00039991] 89 | [-0.00039991 0.01735792] 90 | [-0.00341688 -0.0005181 ] 91 | [-0.0005181 0.0166282 ] 92 | [-0.00224369 -0.00051992] 93 | [-0.00051992 0.01385112] 94 | [-0.00102519 -0.0007265 ] 95 | [-0.0007265 0.01418112] 96 | [-0.00042029 -0.00040912] 97 | [-0.00040912 0.00798176] 98 | [-0.00448055 -0. ] 99 | [-0. 0.02576872] 100 | [-0.00477912 -0. ] 101 | [-0. 0.01649521] 102 | [-0.00497383 -0. ] 103 | [-0. 0.01884639] 104 | [-0.00491545 -0. ] 105 | [-0. 0.01708042] 106 | [-0.0043245 -0. ] 107 | [-0. 0.01750382] 108 | [-0.00322757 -0. ] 109 | [-0. 0.01667089] 110 | [-0.00201725 -0. ] 111 | [-0. 0.01379774] 112 | [-0.00093576 -0. ] 113 | [-0. 0.01406354] 114 | [-0.0003668 -0. ] 115 | [-0. 0.00791137] 116 | [-0.00455936 0.00045346] 117 | [ 0.00045346 0.02533854] 118 | [-0.00475357 0.00048735] 119 | [ 0.00048735 0.01612508] 120 | [-0.00496027 0.00033676] 121 | [ 0.00033676 0.01850847] 122 | [-0.00491956 0.00025359] 123 | [ 0.00025359 0.0168949 ] 124 | [-0.00443572 0.00039991] 125 | [ 0.00039991 0.01735792] 126 | [-0.00341688 0.0005181 ] 127 | [ 0.0005181 0.0166282 ] 128 | [-0.00224369 0.00051992] 129 | [ 0.00051992 0.01385112] 130 | [-0.00102519 0.0007265 ] 131 | [ 0.0007265 0.01418112] 132 | [-0.00042029 0.00040912] 133 | [ 0.00040912 0.00798176] 134 | [-0.004801 0.00017735] 135 | [ 0.00017735 0.02345409] 136 | [-0.00514485 0.00051904] 137 | [ 0.00051904 0.01549842] 138 | [-0.00526681 0.00041577] 139 | [ 0.00041577 0.0178578 ] 140 | [-0.00530081 0.00037629] 141 | [ 0.00037629 0.0163454 ] 142 | [-0.00503057 0.00060943] 143 | [ 0.00060943 0.01691583] 144 | [-0.00395828 0.00099025] 145 | [ 0.00099025 0.01651997] 146 | [-0.00267236 0.00118209] 147 | [ 0.00118209 0.01400285] 148 | [-0.00167606 0.00153209] 149 | [ 0.00153209 0.01457015] 150 | [-0.00079774 0.0008978 ] 151 | [ 0.0008978 0.00827904] 152 | [-0.00462239 0.00021127] 153 | [ 0.00021127 0.02001114] 154 | [-0.00481154 0.00145527] 155 | [ 0.00145527 0.01486589] 156 | [-0.00535816 0.00016327] 157 | [ 0.00016327 0.01734997] 158 | [-0.00537605 0.00021968] 159 | [ 0.00021968 0.01579478] 160 | [-0.00535756 0.00074589] 161 | [ 0.00074589 0.01653035] 162 | [-0.00428135 0.0015412 ] 163 | [ 0.0015412 0.01639611] 164 | [-0.00282522 0.00153823] 165 | [ 0.00153823 0.01401622] 166 | [-0.00108781 0.00300497] 167 | [ 0.00300497 0.01481659] 168 | [-0.00115588 0.00110709] 169 | [ 0.00110709 0.00895114] 170 | [-0.00614744 -0.00012632] 171 | [-0.00012632 0.02092183] 172 | [-0.00523822 0.00232317] 173 | [ 0.00232317 0.01492187] 174 | [-0.00734047 0.00021041] 175 | [ 0.00021041 0.0166062 ] 176 | [-0.00719633 -0.00025009] 177 | [-0.00025009 0.01546421] 178 | [-0.00757669 0.00080715] 179 | [ 0.00080715 0.01612157] 180 | [-0.00741699 0.0014596 ] 181 | [ 0.0014596 0.01613065] 182 | [-0.00608402 0.0008302 ] 183 | [ 0.0008302 0.01401315] 184 | [ 0.0002258 0.00446765] 185 | [ 0.00446765 0.01469399] 186 | [-0.00146895 0.00160773] 187 | [ 0.00160773 0.01003764]] 188 | strain_longi [0. 0.01810782] 189 | stress_tensor 190 | [[-14.56192123 15.86983932] 191 | [ 15.86983932 88.96745073] 192 | [-14.12510307 2.58749717] 193 | [ 2.58749717 53.09690775] 194 | [-12.75036077 -0.60714709] 195 | [ -0.60714709 69.25226613] 196 | [-12.99228926 0.67007757] 197 | [ 0.67007757 71.36442301] 198 | [-13.80311758 -2.16268162] 199 | [ -2.16268162 74.34023613] 200 | [-13.24150071 -3.91084698] 201 | [ -3.91084698 74.5093246 ] 202 | [-10.3509557 -2.39554646] 203 | [ -2.39554646 58.53448335] 204 | [ 15.06357479 -21.88715236] 205 | [-21.88715236 65.72484308] 206 | [ 2.81310801 -12.46225405] 207 | [-12.46225405 46.82133136] 208 | [ -4.15848888 3.36041418] 209 | [ 3.36041418 86.19740204] 210 | [ -7.00212102 -1.80084448] 211 | [ -1.80084448 55.83154512] 212 | [ -0.07595692 -0.51692864] 213 | [ -0.51692864 75.4101106 ] 214 | [ -2.11401429 -0.65534114] 215 | [ -0.65534114 73.82819249] 216 | [ -1.36859297 -2.22512728] 217 | [ -2.22512728 77.51764832] 218 | [ 1.88390243 -4.59768485] 219 | [ -4.59768485 77.85318851] 220 | [ 4.90917545 -4.87013249] 221 | [ -4.87013249 62.44870969] 222 | [ 10.41821472 -12.26428103] 223 | [-12.26428103 61.20391757] 224 | [ 3.50202802 -5.23961168] 225 | [ -5.23961168 40.0883594 ] 226 | [ -1.46275553 -0.5117425 ] 227 | [ -0.5117425 82.72462428] 228 | [ -8.22002051 -1.64332119] 229 | [ -1.64332119 46.01085612] 230 | [ 0.13261609 -1.43144818] 231 | [ -1.43144818 62.82232615] 232 | [ -2.17750699 -1.23866953] 233 | [ -1.23866953 62.14963075] 234 | [ -0.56433756 -2.00613572] 235 | [ -2.00613572 64.80572867] 236 | [ 2.99076987 -3.25973053] 237 | [ -3.25973053 64.31062143] 238 | [ 5.72337127 -4.06981011] 239 | [ -4.06981011 50.92908807] 240 | [ 7.00214239 -4.85066713] 241 | [ -4.85066713 46.46842234] 242 | [ 3.56918485 -2.59060958] 243 | [ -2.59060958 29.98125054] 244 | [ -3.02876156 -1.21500678] 245 | [ -1.21500678 84.45199516] 246 | [ -8.66250519 -1.45385963] 247 | [ -1.45385963 46.17029797] 248 | [ -0.77579297 -1.10853688] 249 | [ -1.10853688 63.367755 ] 250 | [ -2.78772411 -0.79967697] 251 | [ -0.79967697 62.66439364] 252 | [ -0.3893333 -1.26108264] 253 | [ -1.26108264 65.0003135 ] 254 | [ 2.95664706 -1.63380018] 255 | [ -1.63380018 63.09993027] 256 | [ 5.51229711 -1.7114863 ] 257 | [ -1.7114863 48.99364223] 258 | [ 8.13403544 -2.16727297] 259 | [ -2.16727297 43.55284075] 260 | [ 4.10102343 -1.09620205] 261 | [ -1.09620205 27.39092542] 262 | [ -2.30284653 -0. ] 263 | [ -0. 86.00693444] 264 | [ -8.4441596 -0. ] 265 | [ -0. 47.3081719 ] 266 | [ -0.47045657 -0. ] 267 | [ -0. 64.60708179] 268 | [ -2.58577155 -0. ] 269 | [ -0. 63.41065176] 270 | [ 0.20146282 -0. ] 271 | [ -0. 65.69515215] 272 | [ 3.75662846 -0. ] 273 | [ -0. 63.45998906] 274 | [ 6.39475153 -0. ] 275 | [ -0. 49.03789509] 276 | [ 8.47060412 -0. ] 277 | [ -0. 43.26734493] 278 | [ 4.31256978 -0. ] 279 | [ -0. 27.18799613] 280 | [ -3.02876156 1.21500678] 281 | [ 1.21500678 84.45199516] 282 | [ -8.66250519 1.45385963] 283 | [ 1.45385963 46.17029797] 284 | [ -0.77579297 1.10853688] 285 | [ 1.10853688 63.367755 ] 286 | [ -2.78772411 0.79967697] 287 | [ 0.79967697 62.66439364] 288 | [ -0.3893333 1.26108264] 289 | [ 1.26108264 65.0003135 ] 290 | [ 2.95664706 1.63380018] 291 | [ 1.63380018 63.09993027] 292 | [ 5.51229711 1.7114863 ] 293 | [ 1.7114863 48.99364223] 294 | [ 8.13403544 2.16727297] 295 | [ 2.16727297 43.55284075] 296 | [ 4.10102343 1.09620205] 297 | [ 1.09620205 27.39092542] 298 | [ -1.46275553 0.5117425 ] 299 | [ 0.5117425 82.72462428] 300 | [ -8.22002051 1.64332119] 301 | [ 1.64332119 46.01085612] 302 | [ 0.13261609 1.43144818] 303 | [ 1.43144818 62.82232615] 304 | [ -2.17750699 1.23866953] 305 | [ 1.23866953 62.14963075] 306 | [ -0.56433756 2.00613572] 307 | [ 2.00613572 64.80572867] 308 | [ 2.99076987 3.25973053] 309 | [ 3.25973053 64.31062143] 310 | [ 5.72337127 4.06981011] 311 | [ 4.06981011 50.92908807] 312 | [ 7.00214239 4.85066713] 313 | [ 4.85066713 46.46842234] 314 | [ 3.56918485 2.59060958] 315 | [ 2.59060958 29.98125054] 316 | [ -4.15848888 -3.36041418] 317 | [ -3.36041418 86.19740204] 318 | [ -7.00212102 1.80084448] 319 | [ 1.80084448 55.83154512] 320 | [ -0.07595692 0.51692864] 321 | [ 0.51692864 75.4101106 ] 322 | [ -2.11401429 0.65534114] 323 | [ 0.65534114 73.82819249] 324 | [ -1.36859297 2.22512728] 325 | [ 2.22512728 77.51764832] 326 | [ 1.88390243 4.59768485] 327 | [ 4.59768485 77.85318851] 328 | [ 4.90917545 4.87013249] 329 | [ 4.87013249 62.44870969] 330 | [ 10.41821472 12.26428103] 331 | [ 12.26428103 61.20391757] 332 | [ 3.50202802 5.23961168] 333 | [ 5.23961168 40.0883594 ] 334 | [-14.56192123 -15.86983932] 335 | [-15.86983932 88.96745073] 336 | [-14.12510307 -2.58749717] 337 | [ -2.58749717 53.09690775] 338 | [-12.75036077 0.60714709] 339 | [ 0.60714709 69.25226613] 340 | [-12.99228926 -0.67007757] 341 | [ -0.67007757 71.36442301] 342 | [-13.80311758 2.16268162] 343 | [ 2.16268162 74.34023613] 344 | [-13.24150071 3.91084698] 345 | [ 3.91084698 74.5093246 ] 346 | [-10.3509557 2.39554646] 347 | [ 2.39554646 58.53448335] 348 | [ 15.06357479 21.88715236] 349 | [ 21.88715236 65.72484308] 350 | [ 2.81310801 12.46225405] 351 | [ 12.46225405 46.82133136]] 352 | strain_energy 353 | [[0. 0.99078788] 354 | [0. 0.44798902] 355 | [0. 0.64488432] 356 | [0. 0.58683228] 357 | [0. 0.60844689] 358 | [0. 0.63250731] 359 | [0. 0.46288998] 360 | [0. 0.73956924] 361 | [0. 0.30710519] 362 | [0. 0.85482742] 363 | [0. 0.462848 ] 364 | [0. 0.73325852] 365 | [0. 0.62349926] 366 | [0. 0.66285325] 367 | [0. 0.70355618] 368 | [0. 0.49806534] 369 | [0. 0.5712543 ] 370 | [0. 0.22481028] 371 | [0. 0.94424155] 372 | [0. 0.43864109] 373 | [0. 0.68074465] 374 | [0. 0.58517585] 375 | [0. 0.60022254] 376 | [0. 0.6073146 ] 377 | [0. 0.40898036] 378 | [0. 0.40774595] 379 | [0. 0.1579566 ] 380 | [0. 1.02677049] 381 | [0. 0.47164665] 382 | [0. 0.72306372] 383 | [0. 0.60623194] 384 | [0. 0.61108169] 385 | [0. 0.5824065 ] 386 | [0. 0.37968978] 387 | [0. 0.37847999] 388 | [0. 0.14709893] 389 | [0. 1.04634826] 390 | [0. 0.48616723] 391 | [0. 0.74402403] 392 | [0. 0.61299345] 393 | [0. 0.61295226] 394 | [0. 0.57634328] 395 | [0. 0.37199399] 396 | [0. 0.37689826] 397 | [0. 0.14748753] 398 | [0. 1.02677049] 399 | [0. 0.47164665] 400 | [0. 0.72306372] 401 | [0. 0.60623194] 402 | [0. 0.61108169] 403 | [0. 0.5824065 ] 404 | [0. 0.37968978] 405 | [0. 0.37847999] 406 | [0. 0.14709893] 407 | [0. 0.94424155] 408 | [0. 0.43864109] 409 | [0. 0.68074465] 410 | [0. 0.58517585] 411 | [0. 0.60022254] 412 | [0. 0.6073146 ] 413 | [0. 0.40898036] 414 | [0. 0.40774595] 415 | [0. 0.1579566 ] 416 | [0. 0.85482742] 417 | [0. 0.462848 ] 418 | [0. 0.73325852] 419 | [0. 0.62349926] 420 | [0. 0.66285325] 421 | [0. 0.70355618] 422 | [0. 0.49806534] 423 | [0. 0.5712543 ] 424 | [0. 0.22481028] 425 | [0. 0.99078788] 426 | [0. 0.44798902] 427 | [0. 0.64488432] 428 | [0. 0.58683228] 429 | [0. 0.60844689] 430 | [0. 0.63250731] 431 | [0. 0.46288998] 432 | [0. 0.73956924] 433 | [0. 0.30710519]] 434 | Duration: 174.16870076258976 minutes 435 | -------------------------------------------------------------------------------- /test/displ_condition_1D_x-.csv: -------------------------------------------------------------------------------- 1 | #id 2 | 32 -------------------------------------------------------------------------------- /test/displ_condition_1D_x.csv: -------------------------------------------------------------------------------- 1 | #id 2 | 0 -------------------------------------------------------------------------------- /test/displ_condition_2D_x+.csv: -------------------------------------------------------------------------------- 1 | #id 2 | 0 3 | 1 4 | 2 5 | 3 6 | 4 7 | 5 8 | 6 9 | 7 10 | 8 11 | 9 12 | 10 13 | 11 14 | 12 15 | 13 16 | 14 17 | 15 18 | 16 19 | 17 20 | -------------------------------------------------------------------------------- /test/displ_condition_2D_x-.csv: -------------------------------------------------------------------------------- 1 | #id 2 | 63 3 | 64 4 | 65 5 | 66 6 | 67 7 | 68 8 | 69 9 | 70 10 | 71 11 | 72 12 | 73 13 | 74 14 | 75 15 | 76 16 | 77 17 | 78 18 | 79 19 | 80 20 | -------------------------------------------------------------------------------- /test/displ_condition_2D_y+.csv: -------------------------------------------------------------------------------- 1 | #id 2 | 0 3 | 1 4 | 9 5 | 10 6 | 18 7 | 19 8 | 27 9 | 28 10 | 36 11 | 37 12 | 45 13 | 46 14 | 54 15 | 55 16 | 63 17 | 64 18 | 72 19 | 73 20 | -------------------------------------------------------------------------------- /test/displ_condition_2D_y-.csv: -------------------------------------------------------------------------------- 1 | #id 2 | 7 3 | 8 4 | 16 5 | 17 6 | 25 7 | 26 8 | 34 9 | 35 10 | 43 11 | 44 12 | 52 13 | 53 14 | 61 15 | 62 16 | 70 17 | 71 18 | 79 19 | 80 20 | -------------------------------------------------------------------------------- /test/force_condition_1D_x-.csv: -------------------------------------------------------------------------------- 1 | #id 2 | 0 -------------------------------------------------------------------------------- /test/force_condition_1D_x.csv: -------------------------------------------------------------------------------- 1 | #id 2 | 32 -------------------------------------------------------------------------------- /test/force_condition_2D_x+.csv: -------------------------------------------------------------------------------- 1 | #id 2 | 72 3 | 73 4 | 74 5 | 75 6 | 76 7 | 77 8 | 78 9 | 79 10 | 80 11 | -------------------------------------------------------------------------------- /test/force_condition_2D_x-.csv: -------------------------------------------------------------------------------- 1 | #id 2 | 0 3 | 1 4 | 2 5 | 3 6 | 4 7 | 5 8 | 6 9 | 7 10 | 8 11 | -------------------------------------------------------------------------------- /test/force_condition_2D_y+.csv: -------------------------------------------------------------------------------- 1 | #id 2 | 8 3 | 17 4 | 26 5 | 35 6 | 44 7 | 53 8 | 62 9 | 71 10 | 80 11 | -------------------------------------------------------------------------------- /test/force_condition_2D_y-.csv: -------------------------------------------------------------------------------- 1 | #id 2 | 0 3 | 9 4 | 18 5 | 27 6 | 36 7 | 45 8 | 54 9 | 63 10 | 72 11 | -------------------------------------------------------------------------------- /test/geometry_1D.csv: -------------------------------------------------------------------------------- 1 | # id x y z volume density 2 | 0 -0.25 0.5 3 | 1 0.25 0.5 4 | 2 0.75 0.5 5 | 3 1.25 0.5 6 | 4 1.75 0.5 7 | 5 2.25 0.5 8 | 6 2.75 0.5 9 | 7 3.25 0.5 10 | 8 3.75 0.5 11 | 9 4.25 0.5 12 | 10 4.75 0.5 13 | 11 5.25 0.5 14 | 12 5.75 0.5 15 | 13 6.25 0.5 16 | 14 6.75 0.5 17 | 15 7.25 0.5 18 | 16 7.75 0.5 19 | 17 8.25 0.5 20 | 18 8.75 0.5 21 | 19 9.25 0.5 22 | 20 9.75 0.5 23 | 21 10.25 0.5 24 | 22 10.75 0.5 25 | 23 11.25 0.5 26 | 24 11.75 0.5 27 | 25 12.25 0.5 28 | 26 12.75 0.5 29 | 27 13.25 0.5 30 | 28 13.75 0.5 31 | 29 14.25 0.5 32 | 30 14.75 0.5 33 | 31 15.25 0.5 34 | 32 15.75 0.5 -------------------------------------------------------------------------------- /test/geometry_2D.csv: -------------------------------------------------------------------------------- 1 | # id x y z volume density 2 | 0 -1.75 -1.75 0.25 3 | 1 -1.75 -1.25 0.25 4 | 2 -1.75 -0.75 0.25 5 | 3 -1.75 -0.25 0.25 6 | 4 -1.75 0.25 0.25 7 | 5 -1.75 0.75 0.25 8 | 6 -1.75 1.25 0.25 9 | 7 -1.75 1.75 0.25 10 | 8 -1.75 2.25 0.25 11 | 9 -1.25 -1.75 0.25 12 | 10 -1.25 -1.25 0.25 13 | 11 -1.25 -0.75 0.25 14 | 12 -1.25 -0.25 0.25 15 | 13 -1.25 0.25 0.25 16 | 14 -1.25 0.75 0.25 17 | 15 -1.25 1.25 0.25 18 | 16 -1.25 1.75 0.25 19 | 17 -1.25 2.25 0.25 20 | 18 -0.75 -1.75 0.25 21 | 19 -0.75 -1.25 0.25 22 | 20 -0.75 -0.75 0.25 23 | 21 -0.75 -0.25 0.25 24 | 22 -0.75 0.25 0.25 25 | 23 -0.75 0.75 0.25 26 | 24 -0.75 1.25 0.25 27 | 25 -0.75 1.75 0.25 28 | 26 -0.75 2.25 0.25 29 | 27 -0.25 -1.75 0.25 30 | 28 -0.25 -1.25 0.25 31 | 29 -0.25 -0.75 0.25 32 | 30 -0.25 -0.25 0.25 33 | 31 -0.25 0.25 0.25 34 | 32 -0.25 0.75 0.25 35 | 33 -0.25 1.25 0.25 36 | 34 -0.25 1.75 0.25 37 | 35 -0.25 2.25 0.25 38 | 36 0.25 -1.75 0.25 39 | 37 0.25 -1.25 0.25 40 | 38 0.25 -0.75 0.25 41 | 39 0.25 -0.25 0.25 42 | 40 0.25 0.25 0.25 43 | 41 0.25 0.75 0.25 44 | 42 0.25 1.25 0.25 45 | 43 0.25 1.75 0.25 46 | 44 0.25 2.25 0.25 47 | 45 0.75 -1.75 0.25 48 | 46 0.75 -1.25 0.25 49 | 47 0.75 -0.75 0.25 50 | 48 0.75 -0.25 0.25 51 | 49 0.75 0.25 0.25 52 | 50 0.75 0.75 0.25 53 | 51 0.75 1.25 0.25 54 | 52 0.75 1.75 0.25 55 | 53 0.75 2.25 0.25 56 | 54 1.25 -1.75 0.25 57 | 55 1.25 -1.25 0.25 58 | 56 1.25 -0.75 0.25 59 | 57 1.25 -0.25 0.25 60 | 58 1.25 0.25 0.25 61 | 59 1.25 0.75 0.25 62 | 60 1.25 1.25 0.25 63 | 61 1.25 1.75 0.25 64 | 62 1.25 2.25 0.25 65 | 63 1.75 -1.75 0.25 66 | 64 1.75 -1.25 0.25 67 | 65 1.75 -0.75 0.25 68 | 66 1.75 -0.25 0.25 69 | 67 1.75 0.25 0.25 70 | 68 1.75 0.75 0.25 71 | 69 1.75 1.25 0.25 72 | 70 1.75 1.75 0.25 73 | 71 1.75 2.25 0.25 74 | 72 2.25 -1.75 0.25 75 | 73 2.25 -1.25 0.25 76 | 74 2.25 -0.75 0.25 77 | 75 2.25 -0.25 0.25 78 | 76 2.25 0.25 0.25 79 | 77 2.25 0.75 0.25 80 | 78 2.25 1.25 0.25 81 | 79 2.25 1.75 0.25 82 | 80 2.25 2.25 0.25 83 | -------------------------------------------------------------------------------- /test/input_elas_1D_x+.yaml: -------------------------------------------------------------------------------- 1 | Discretization: 2 | Dim: 1 3 | Final_Time: 1.0 4 | Time_Steps: 1 5 | Horizon_Factor_m_value: 1.0 6 | Influence_Function: ONE 7 | File: 8 | Name: geometry_1D.csv 9 | Material: 10 | Type: Elastic 11 | Young_Modulus: 4000.0 12 | Boundary: 13 | Condition: 14 | Type: 15 | - Force 16 | - Displacement 17 | Value: 18 | - 40 19 | - 0.0 20 | Direction: 21 | - 1 22 | - 1 23 | File: 24 | - force_condition_1D_x.csv 25 | - displ_condition_1D_x.csv 26 | Shape: 27 | - Ramp 28 | - Fixed 29 | Shape: 30 | Type: Ramp 31 | Values: 32 | - 1.0 33 | - 1.0 34 | - 1.0 35 | Solver: 36 | Max_Iteration: 100 37 | Tolerance: 1.0e-6 38 | Jacobian_Perturbation: 1.0e-6 39 | Parallel: 40 | Threads: 3 41 | -------------------------------------------------------------------------------- /test/input_elas_1D_x-.yaml: -------------------------------------------------------------------------------- 1 | Discretization: 2 | Dim: 1 3 | Final_Time: 1.0 4 | Time_Steps: 1 5 | Horizon_Factor_m_value: 1.0 6 | Influence_Function: ONE 7 | File: 8 | Name: geometry_1D.csv 9 | Material: 10 | Type: Elastic 11 | Young_Modulus: 4000.0 12 | Boundary: 13 | Condition: 14 | Type: 15 | - Force 16 | - Displacement 17 | Value: 18 | - -40 19 | - 0.0 20 | Direction: 21 | - 1 22 | - 1 23 | File: 24 | - force_condition_1D_x-.csv 25 | - displ_condition_1D_x-.csv 26 | Shape: 27 | - Ramp 28 | - Fixed 29 | Shape: 30 | Type: Ramp 31 | Values: 32 | - 1.0 33 | - 1.0 34 | - 1.0 35 | Solver: 36 | Max_Iteration: 100 37 | Tolerance: 1.0e-6 38 | Jacobian_Perturbation: 1.0e-6 39 | Parallel: 40 | Threads: 3 41 | -------------------------------------------------------------------------------- /test/input_elas_2D_x+.yaml: -------------------------------------------------------------------------------- 1 | Discretization: 2 | Dim: 2 3 | Type: Plane_Stress 4 | Final_Time: 1.0 5 | Time_Steps: 1 6 | Horizon_Factor_m_value: 3.0 7 | Influence_Function: 1.0 8 | File: 9 | Name: geometry_2D.csv 10 | Material: 11 | Type: Elastic 12 | Bulk_Modulus: 3333.3333 13 | Shear_Modulus: 1538.4615 14 | Boundary: 15 | Condition: 16 | Type: 17 | - Force 18 | - Displacement 19 | - Displacement 20 | Value: 21 | - 40.0 22 | - 0.0 23 | - 0.0 24 | Direction: 25 | - 1 26 | - 1 27 | - 2 28 | File: 29 | - force_condition_2D_x+.csv 30 | - displ_condition_2D_x+.csv 31 | - displ_condition_2D_x+.csv 32 | Shape: 33 | - Ramp 34 | - Fixed 35 | - Fixed 36 | Shape: 37 | Type: Ramp 38 | Values: 39 | - 1.0 40 | - 1.0 41 | - 1.0 42 | Solver: 43 | Max_Iteration: 1000 44 | Tolerance: 1.0e-3 45 | Jacobian_Perturbation: 1.0e-6 46 | Parallel: 47 | Threads: 12 48 | -------------------------------------------------------------------------------- /test/input_elas_2D_x-.yaml: -------------------------------------------------------------------------------- 1 | Discretization: 2 | Dim: 2 3 | Type: Plane_Stress 4 | Final_Time: 1.0 5 | Time_Steps: 1 6 | Horizon_Factor_m_value: 3.0 7 | Influence_Function: 1.0 8 | File: 9 | Name: geometry_2D.csv 10 | Material: 11 | Type: Elastic 12 | Bulk_Modulus: 3333.3333 13 | Shear_Modulus: 1538.4615 14 | Boundary: 15 | Condition: 16 | Type: 17 | - Force 18 | - Displacement 19 | - Displacement 20 | Value: 21 | - -40.0 22 | - 0.0 23 | - 0.0 24 | Direction: 25 | - 1 26 | - 1 27 | - 2 28 | File: 29 | - force_condition_2D_x-.csv 30 | - displ_condition_2D_x-.csv 31 | - displ_condition_2D_x-.csv 32 | Shape: 33 | - Ramp 34 | - Fixed 35 | - Fixed 36 | Shape: 37 | Type: Ramp 38 | Values: 39 | - 1.0 40 | - 1.0 41 | - 1.0 42 | Solver: 43 | Max_Iteration: 1000 44 | Tolerance: 1.0e-3 45 | Jacobian_Perturbation: 1.0e-6 46 | Parallel: 47 | Threads: 3 48 | -------------------------------------------------------------------------------- /test/input_elas_2D_y+.yaml: -------------------------------------------------------------------------------- 1 | Discretization: 2 | Dim: 2 3 | Type: Plane_Stress 4 | Final_Time: 1.0 5 | Time_Steps: 1 6 | Horizon_Factor_m_value: 3.0 7 | Influence_Function: 1.0 8 | File: 9 | Name: geometry_2D.csv 10 | Material: 11 | Type: Elastic 12 | Bulk_Modulus: 3333.3333 13 | Shear_Modulus: 1538.4615 14 | Boundary: 15 | Condition: 16 | Type: 17 | - Force 18 | - Displacement 19 | - Displacement 20 | Value: 21 | - 40.0 22 | - 0.0 23 | - 0.0 24 | Direction: 25 | - 2 26 | - 1 27 | - 2 28 | File: 29 | - force_condition_2D_y+.csv 30 | - displ_condition_2D_y+.csv 31 | - displ_condition_2D_y+.csv 32 | Shape: 33 | - Ramp 34 | - Fixed 35 | - Fixed 36 | Shape: 37 | Type: Ramp 38 | Values: 39 | - 1.0 40 | - 1.0 41 | - 1.0 42 | Solver: 43 | Max_Iteration: 1000 44 | Tolerance: 1.0e-3 45 | Jacobian_Perturbation: 1.0e-6 46 | Parallel: 47 | Threads: 3 48 | -------------------------------------------------------------------------------- /test/input_elas_2D_y-.yaml: -------------------------------------------------------------------------------- 1 | Discretization: 2 | Dim: 2 3 | Type: Plane_Stress 4 | Final_Time: 1.0 5 | Time_Steps: 1 6 | Horizon_Factor_m_value: 3.0 7 | Influence_Function: 1.0 8 | File: 9 | Name: geometry_2D.csv 10 | Material: 11 | Type: Elastic 12 | Bulk_Modulus: 3333.3333 13 | Shear_Modulus: 1538.4615 14 | Boundary: 15 | Condition: 16 | Type: 17 | - Force 18 | - Displacement 19 | - Displacement 20 | Value: 21 | - -40.0 22 | - 0.0 23 | - 0.0 24 | Direction: 25 | - 2 26 | - 1 27 | - 2 28 | File: 29 | - force_condition_2D_y-.csv 30 | - displ_condition_2D_y-.csv 31 | - displ_condition_2D_y-.csv 32 | Shape: 33 | - Ramp 34 | - Fixed 35 | - Fixed 36 | Shape: 37 | Type: Ramp 38 | Values: 39 | - 1.0 40 | - 1.0 41 | - 1.0 42 | Solver: 43 | Max_Iteration: 1000 44 | Tolerance: 1.0e-3 45 | Jacobian_Perturbation: 1.0e-6 46 | Parallel: 47 | Threads: 3 48 | -------------------------------------------------------------------------------- /tools/run_tests_1D.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/bash 2 | ## Tests 3 | cd ../test 4 | echo "--1D direction x+" 5 | python ../pd_dic.py -i input_elas_1D_x+.yaml -t pd > 1D+.dat 6 | sed -i '$ d' 1D+.dat 7 | DIFF=$(diff 1D+.res 1D+.dat ) 8 | if [ "$DIFF" != "" ] 9 | then 10 | echo "Test failed" 11 | else 12 | echo "Test passed" 13 | fi 14 | echo "--1D direction x-" 15 | python ../pd_dic.py -i input_elas_1D_x-.yaml -t pd > 1D-.dat 16 | sed -i '$ d' 1D-.dat 17 | DIFF=$(diff 1D-.res 1D-.dat ) 18 | if [ "$DIFF" != "" ] 19 | then 20 | echo "Test failed" 21 | else 22 | echo "Test passed" 23 | fi 24 | 25 | -------------------------------------------------------------------------------- /tools/run_tests_2D.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/bash 2 | ## Tests 3 | cd ../test 4 | echo "--2D direction x+" 5 | python ../pd_dic.py -i input_elas_2D_x+.yaml -t pd > 2D_x+.dat 6 | sed -i '$ d' 2D_x+.res 7 | DIFF=$(diff 2D_x+.dat 2D_x+.res ) 8 | if [ "$DIFF" != "" ] 9 | then 10 | echo "Test failed" 11 | else 12 | echo "Test passed" 13 | fi 14 | echo "--2D direction x-" 15 | python ../pd_dic.py -i input_elas_2D_x-.yaml -t pd > 2D_x-.dat 16 | sed -i '$ d' 2D_x-.res 17 | DIFF=$(diff 2D_x-.dat 2D_x-.res ) 18 | if [ "$DIFF" != "" ] 19 | then 20 | echo "Test failed" 21 | else 22 | echo "Test passed" 23 | fi 24 | echo "--2D direction y+" 25 | python ../pd_dic.py -i input_elas_2D_y+.yaml -t pd > 2D_y+.dat 26 | sed -i '$ d' 2D_y+.res 27 | DIFF=$(diff 2D_y+.dat 2D_y+.res ) 28 | if [ "$DIFF" != "" ] 29 | then 30 | echo "Test failed" 31 | else 32 | echo "Test passed" 33 | fi 34 | echo "--2D direction y-" 35 | python ../pd_dic.py -i input_elas_2D_y-.yaml -t pd > 2D_y-.dat 36 | sed -i '$ d' 2D_y-.res 37 | DIFF=$(diff 2D_y-.dat 2D_y-.res ) 38 | if [ "$DIFF" != "" ] 39 | then 40 | echo "Test failed" 41 | else 42 | echo "Test passed" 43 | fi 44 | 45 | 46 | --------------------------------------------------------------------------------