Skip to content

Commit edbfde6

Browse files
committed
Add content to simulation project
1 parent 830eafe commit edbfde6

File tree

1 file changed

+78
-2
lines changed

1 file changed

+78
-2
lines changed

tutorial/create_project.rst

+78-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,83 @@
1-
Creating Projects
2-
=================
1+
Simulation Project
2+
==================
33

44
To Do:
55

66
* Explain what a simulation project is and what it contains
77
* How to create a simulation project with the SDK
8+
9+
A simulation project is a container for the elements needed to setup a simulation, the two most
10+
important of them being the CAD geometry and the simulation or physics setup. We can visualize
11+
the hierarchy with a tree structure:
12+
13+
.. code-block::
14+
15+
- Simulation project
16+
|
17+
|- Geometries
18+
| |
19+
| |- CAD 1
20+
| |- CAD 2
21+
|
22+
|- Simulations
23+
|
24+
|- Simulation 1
25+
|- Simulation 2
26+
27+
28+
Eeach simulation is linked to one geometry, and each simulation setup contains the physics definition.
29+
More details to follow in the specific steps.
30+
31+
In order to create and manipulate simulation projects, the SimScale SDK provides a Projects API client:
32+
33+
.. code-block:: python
34+
35+
import simscale_sdk as sim
36+
37+
projects_api = sim.ProjectsApi(api_client)
38+
39+
40+
.. code-block:: csharp
41+
42+
...
43+
44+
45+
We can see that the projects api object is initialized with the ``api_client``, which we previously
46+
initialized with our Api key and host URL.
47+
48+
The project data is hosted in a ``Project`` object, which is then included as the argument of the
49+
actual Api call to create the project:
50+
51+
.. code-block:: python
52+
53+
import simscale_sdk as sim
54+
55+
project_data = sim.Project(
56+
name="My first simulation project",
57+
description="Created via SDK",
58+
measurement_system="SI"
59+
)
60+
61+
project = projects_api.create_project(project_data)
62+
63+
project_id = project.project_id
64+
65+
print(f"{project_id=}")
66+
67+
68+
.. code-block:: csharp
69+
70+
...
71+
72+
73+
You can see that the ``ProjectsApi.create_project`` method returns a ``Project`` object containing
74+
the data of our original object, plus some additional data added after the project is created in the platform.
75+
For instance, the ``project_id`` is a unique identification string for our newly created project.
76+
77+
The ``ProjectsApi`` object has many other useful methods to deal with simulations project data, such as:
78+
79+
* To get the data for an existing project ``ProjectsApi.get_project(project_id)``
80+
* To update the data for an existing proejct ``ProjectsApi.update_project(project_id, project_data)``
81+
82+
More details on the Projects Api can be found in the
83+
`documentation <https://simscalegmbh.github.io/simscale-python-sdk/simscale_sdk.api.html#module-simscale_sdk.api.projects_api>`_

0 commit comments

Comments
 (0)