Skip to content

Commit 71e6c92

Browse files
committed
Polish code
1 parent 0007ad9 commit 71e6c92

File tree

7 files changed

+28
-33
lines changed

7 files changed

+28
-33
lines changed

index.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,3 @@ Summary
6060
tutorial/meshing
6161
tutorial/simulation_run
6262
tutorial/postprocessing
63-
advanced/advanced_topics
64-

tutorial/api_keys.rst

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ If doing so, your ``.env`` file should contain a line such as:
1919

2020
.. code-block:: python
2121
22-
SIMSCALE_API_KEY=(generated api key)
22+
SIMSCALE_API_KEY="your_api_key"
2323
2424
2525
API Client
@@ -37,13 +37,10 @@ The following snippet shows an example of the creation and setup of the ``ApiCli
3737
# Python
3838
3939
import os
40-
from dotenv import load_dotenv()
4140
4241
import simscale_sdk as sim
4342
44-
load_dotenv()
45-
46-
API_KEY = os.getenv('SIMSCALE_API_KEY')
43+
API_KEY = "your_api_key"
4744
API_HOST_URL = "https://api.simscale.com/v0"
4845
4946
configuration = sim.Configuration()
@@ -63,11 +60,9 @@ The following snippet shows an example of the creation and setup of the ``ApiCli
6360
using SimScale.Sdk.Api;
6461
using SimScale.Sdk.Client;
6562
using SimScale.Sdk.Model;
66-
using dotenv.net;
6763
68-
DotEnv.Load();
6964
70-
var API_KEY = System.Environment.GetEnvironmentVariable("SIMSCALE_API_KEY")
65+
var API_KEY = "your_api_key"
7166
var API_HOST_URL = "https://api.simscale.com/v0"
7267
7368
Configuration configuration = new Configuration();

tutorial/create_project.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ actual Api call to create the project:
4747
import simscale_sdk as sim
4848
4949
project_data = sim.Project(
50-
name="My first simulation project",
51-
description="Created via SDK",
50+
name="SDK Tutorial",
51+
description="Created with SimScale SDK",
5252
measurement_system="SI"
5353
)
5454

tutorial/meshing.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ with a model object. It can be done as follows:
2424
curvature=sim.AutomaticCurvature(),
2525
),
2626
automatic_layer_settings=sim.AutomaticLayerOn(
27-
number_of_layers=3,
28-
total_relative_thickness=0.4,
29-
growth_rate=1.5
27+
layer_type=sim.FractionalHeight2(
28+
number_of_layers=3,
29+
total_relative_thickness=0.4,
30+
growth_rate=1.5
31+
),
3032
),
31-
pysics_based_meshing=True,
33+
physics_based_meshing=True,
3234
hex_core=True,
3335
)
3436
@@ -69,7 +71,7 @@ The mesh operation object is used to launch the computation and track its progre
6971
mesh_operation_api.start_mesh_operation(
7072
project_id,
7173
mesh_operation.mesh_operation_id,
72-
simulation_id=simulation_id,
74+
simulation_id=simulation.simulation_id,
7375
)
7476
7577
while mesh_operation.status not in ("FINISHED", "CANCELED", "FAILED"):
@@ -98,11 +100,11 @@ so the platform knows that it should use it as part of the simulation computatio
98100
.. code-block:: python
99101
100102
# Might not be needed if the simulation_spec object is updated
101-
simulation_spec = simulations_api.get_simulation(project_id, simulation_id)
103+
simulation_spec = simulations_api.get_simulation(project_id, simulation.simulation_id)
102104
103105
simulation_spec.mesh_id = mesh_operation.mesh_id
104106
105-
simulations_api.update_simulation(project_id, simulation_id, simulation_spec)
107+
simulations_api.update_simulation(project_id, simulation.simulation_id, simulation_spec)
106108
107109
108110
Now our simulation is ready for computation, with its physics model and a mesh

tutorial/postprocessing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ create a series of configuration objects:
5454
5555
model_settings = sim.ModelSettings(
5656
parts=[],
57-
sacalar_field=scalar_field,
57+
scalar_field=scalar_field,
5858
)
5959
6060
cutting_plane = sim.CuttingPlane(
@@ -121,7 +121,7 @@ happens in the platform:
121121
122122
create_report_res = reports_api.create_report(
123123
project_id,
124-
report_request,
124+
report_req,
125125
)
126126
127127
report_id = create_report_res.report_id

tutorial/simulation_run.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ import or mesh computation operations:
1818
1919
simulation_run = simulation_run_api.create_simulation_run(
2020
project_id,
21-
simulation_id,
21+
simulation.simulation_id,
2222
sim.SimulationRun(
2323
name="Run 1"
2424
),
2525
)
2626
2727
simulation_run_api.start_simulation_run(
2828
project_id,
29-
simulation_id,
29+
simulation.simulation_id,
3030
simulation_run.run_id,
3131
)
3232
33-
while simulation_run.status not in ("FINSIHED", "CANCELED", "FAILED"):
33+
while simulation_run.status not in ("FINISHED", "CANCELED", "FAILED"):
3434
3535
simualtion_run = simulation_run_api.get_simulation_run(
3636
project_id,
37-
simulation_id,
37+
simulation.simulation_id,
3838
simulation_run.run_id,
3939
)
4040

tutorial/simulation_setup.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ A ``SimulationSpec`` object is initialized with this data, then passed to the
2525
model=model
2626
)
2727
28-
simulation = simulation_api.create_simulation(project_id, simulation_spec)
28+
simulation = simulations_api.create_simulation(project_id, simulation_spec)
2929
3030
3131
Now we need to delve deeper into the physics ``model``.
@@ -64,8 +64,8 @@ an example:
6464
...
6565
),
6666
numerics=sim.FluidNumerics(
67-
relaxation_factors=sim.RelaxationFactor(),
68-
pressure_reference_vale=sim.DimensionalPressure(value=0, unit="Pa"),
67+
relaxation_factor=sim.RelaxationFactor(),
68+
pressure_reference_value=sim.DimensionalPressure(value=0, unit="Pa"),
6969
residual_controls=sim.ResidualControls(
7070
velocity=sim.Tolerance(),
7171
pressure=sim.Tolerance(),
@@ -90,9 +90,9 @@ an example:
9090
delta_t=sim.DimensionalTime(value=1, unit="s"),
9191
write_control=sim.TimeStepWriteControl(write_interval=20),
9292
max_run_time=sim.DimensionalTime(value=10000, unit="s"),
93-
decompose_altorithm=sim.ScotchDecomposeAlgorithm(),
94-
)
95-
result_control=sim.FluidResultControls()
93+
decompose_algorithm=sim.ScotchDecomposeAlgorithm(),
94+
),
95+
result_control=sim.FluidResultControls(),
9696
)
9797
9898
@@ -180,7 +180,7 @@ The boundary conditions are setup with the following code:
180180
],
181181
),
182182
),
183-
VelocityInletBC(
183+
sim.VelocityInletBC(
184184
name="Velocity inlet 2",
185185
velocity=sim.FixedValueVBC(
186186
value=sim.DimensionalVectorFunctionSpeed(
@@ -204,7 +204,7 @@ The boundary conditions are setup with the following code:
204204
],
205205
),
206206
),
207-
PressureOutletBC(
207+
sim.PressureOutletBC(
208208
name="Pressure outlet",
209209
gauge_pressure=sim.FixedValuePBC(
210210
value=sim.DimensionalFunctionPressure(

0 commit comments

Comments
 (0)