Commit 9b802f8a authored by muhammad Hassani's avatar muhammad Hassani
Browse files

updating tensile_test notebook

parent 0dd7b667
from pyiron_base import JOB_CLASS_DICT, Project
from tensile_test_job import TensileJob
from .tensile_test_job import TensileJob
JOB_CLASS_DICT['TensileJob'] = 'pyiron_tensile_test.tensile_test_job'
%% Cell type:markdown id:30019591-6b6b-4093-b08e-b352c92293d1 tags:
# Tensile test workflow
Here, an examplary workflow of a tensile test is presented.
- The data source is obtained from a triple store via sparql queries.
- Then the elastic modulus is calculcated based on the given stress-strain data.
- The calculated elastic modulus is returned to the triple store.
It must be mentioned that the sparql endpoint here is an instance of blazegraph, running on a personal cloud machine.
%% Cell type:markdown id:8f8eccf0-e01a-4ed8-ab63-23b7ca137a46 tags:
### Importing and defining project from the custom defined module
%% Cell type:code id:c4ed7e16-cde3-4a61-b882-2d5d0266f994 tags:
``` python
from pyiron_tensile_test import Project, TensileJob
from pyiron_tensile_test import Project
```
%% Cell type:code id:1455a593-de89-4960-b569-cfadde7dc473 tags:
``` python
pr = Project('test_tensile_job')
pr.remove_jobs_silently(recursive=True)
```
%% Cell type:markdown id:d180d6c7-7ecc-4acf-859e-4ce029179df2 tags:
### Creating a job of type tensile test
%% Cell type:code id:72765577-e5fc-467b-b9fa-9f29c1afa75e tags:
``` python
job = pr.create.job.TensileJob(job_name='tensile_job')
```
%% Cell type:markdown id:c5e34bb4-f2d5-4027-a5b6-b00e3193e821 tags:
### Defining the sparql endpoint and query for data source
%% Cell type:code id:8496725a-d729-4335-b91f-35844d2e3e7d tags:
``` python
job.endpoint = 'https://blazegraph.workshop-virtual.de/bigdata/sparql'
```
%% Cell type:code id:7531101b-73fb-4880-87f5-58f5de30e304 tags:
``` python
download_url = job.query_data_source(test_name='Tensile_Test')
```
%% Cell type:code id:ad71ed4e-56f7-42a9-a887-2f3119650d00 tags:
``` python
download_url
```
%% Output
'https://datashare.mpcdf.mpg.de/s/9N5Z1YXxMv9g09p'
%% Cell type:markdown id:eed0e007-a990-4afe-b18d-ac7f19c0f5e0 tags:
### Obtaining the experimental dataset
%% Cell type:code id:29b6c64a-99c5-4d0b-8aee-6be40e2b9a26 tags:
``` python
job.get_dataset(url=download_url)
```
%% Cell type:code id:376ce2f8-d36c-4099-b771-a34960b96423 tags:
``` python
job.experimental_json
```
%% Output
test.metadata \
object.identifier RX5163DV
test.start-timestamp 2009-05-13T10:23:00+0200
object.length {'value': 50, 'unit': 'mm'}
object.cross-section-area {'value': 78.658, 'unit': 'mm^2'}
test.speed-1 {'value': 0.1, 'unit': 'mm/sec'}
test.speed-2 {'value': 0.4, 'unit': 'mm/sec'}
Young's module {'value': 202.1, 'unit': 'GPa'}
yield stress {'value': 316, 'unit': 'MPa'}
tensile strength {'value': 607, 'unit': 'MPa'}
fields NaN
data NaN
test.series
object.identifier NaN
test.start-timestamp NaN
object.length NaN
object.cross-section-area NaN
test.speed-1 NaN
test.speed-2 NaN
Young's module NaN
yield stress NaN
tensile strength NaN
fields [[Time, s], [Crosshead Travel, mm], [Load, kN], [Tensile Stress, MPa], [Elongation_1, %], [Elongation_2, %], [Elongation Average, %]]
data [[0.0, -4e-05, 0.00062, 0.007840000000000001, 0.0004900000000000001, 0.0, 0.0], [0.1, 0.00252, -0.00013000000000000002, -0.0016500000000000002, 0.00047000000000000004, 0.0, 0.0], [0.2, 0.00928, 0....
%% Cell type:markdown id:640e6fc8-4b3e-447d-872f-01a75b1041a9 tags:
### Extracting stress and strain data from the dataset
%% Cell type:code id:edb0e1d0-89f2-48e1-8551-87f0634a2edc tags:
``` python
job.extract_stress_strain()
```
%% Cell type:code id:9502757f-f379-44fa-bbdf-74062087114f tags:
``` python
job.input.strains
```
%% Output
array([4.90000000e-04, 4.70000000e-04, 5.00000000e-04, ...,
5.51814239e+01, 5.51907786e+01, 5.51935194e+01])
%% Cell type:code id:483ba441-eedb-480e-af52-1f912b7c6e0a tags:
``` python
job.input.stresses
```
%% Output
array([ 7.8400000e-03, -1.6500000e-03, 1.7400000e-03, ...,
3.8407181e+02, 3.8266739e+02, 3.8133539e+02])
%% Cell type:code id:c5daa08a-c8f2-4e84-ac72-7d811da6d46e tags:
``` python
job.plot_stress_strain()
```
%% Output
%% Cell type:markdown id:3026e672-9c83-4d7b-9d33-547921c1d74b tags:
## Calculating the elastic modulus
%% Cell type:code id:13c1a787-2596-4ec1-954b-30869f000971 tags:
``` python
job.run()
```
%% Output
The job tensile_job was saved and received the ID: 342
The job tensile_job was saved and received the ID: 355
%% Cell type:code id:3610242f-f53b-4664-bd17-9c77acf79edd tags:
``` python
job.output.elastic_modulus
```
%% Output
201.21019550851148
%% Cell type:markdown id:ba1ba3e5-7ebc-4d72-adb0-5735da75a21c tags:
### Return the calculated value to the triple store
%% Cell type:code id:26aacc0c-6fde-461d-881b-293d000415a5 tags:
``` python
job.update_triple_store()
```
%% Cell type:code id:5f7e1c4f-6b3c-46c3-9c13-7797cb610e14 tags:
``` python
job.verify_update()
```
%% Output
correctly updated!
True
%% Cell type:markdown id:578ac891-c3c8-4fd7-b429-0296010f8533 tags:
## Verifying the hdf5 file storage
%% Cell type:code id:376a7daa-4cae-4a3d-89d7-bc05da6b49d4 tags:
``` python
job_load = pr.load(job.name)
```
%% Cell type:code id:95c6590b-0b7e-4847-9a90-a1292127913c tags:
``` python
job_load.output
```
%% Output
DataContainer({'elastic_modulus': 201.21019550851148})
%% Cell type:code id:8d12770b-9b73-4a9f-a481-f067585e2daa tags:
``` python
job_load.input
```
%% Output
DataContainer({'test_name': 'Tensile_Test', 'strains': array([4.90000000e-04, 4.70000000e-04, 5.00000000e-04, ...,
5.51814239e+01, 5.51907786e+01, 5.51935194e+01]), 'stresses': array([ 7.8400000e-03, -1.6500000e-03, 1.7400000e-03, ...,
3.8407181e+02, 3.8266739e+02, 3.8133539e+02])})
%% Cell type:code id:450946ff-19d0-4bea-b993-ec26c9a15b1e tags:
``` python
```
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment