You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- the path to the `.wb` file has to be passed as an input to CHIC
13
+
14
+
2. **Query Temperature and Composition**:
15
+
- pass domain boundaries as input to CHIC (analogous to the `.grid` files used for the gwb-grid app {ref}`part:user_manual:chap:how_to_use_the_apps:sec:gwb-grid_app`)
16
+
- parse grid in given boundaries
17
+
- overwrite values of temperature and composition at each position:
18
+
```fortran
19
+
! Query temperature at the given position
20
+
call temperature_3d(cworld, x, y, z, depth, temperature)
21
+
! Query composition at the given position
22
+
call composition_3d(cworld, x, y, z, depth, composition_number, composition)
The interface functions are defined in the Fortran wrapper module (`source/world_builder/wrapper_fortran.f90`). Here we provide short explanations for each function (subroutines in Fortran).
9
6
10
7
```{important}
@@ -13,14 +10,15 @@ To start the World Builder and create a world from a given `.wb` file, the `crea
Interface with the World Builder to create a world with a given `.wb` file
17
15
18
-
PARAMETERS
19
-
cworld (C_PTR) - variable that points to the world pointer of the world builder
20
-
file_name (string) - name of the `.wb` file to be used
21
-
has_output_dir
22
-
output_dir
23
-
random_number_seed (long) - random seed used in creating the world
16
+
Parameters:
17
+
cworld (C_PTR) - Variable that points to the world pointer of the world builder
18
+
file_name (C_CHAR) - Name of the `.wb` file to be used
19
+
has_output_dir (C_BOOL) - If true, the World Builder gains permission to write files into the given directory (`output_dir`). Currently, these are the World Builder json schema and declarations file.
20
+
output_dir (C_CHAR) - Path to directory where the files should be written into.
21
+
random_number_seed (C_LONG) - Random seed used in creating the world
24
22
```
25
23
26
24
After calling `create_world`, the world builder can be queried to output temperature and composition values at a given position. The subroutines for temperature and composition, each have a 2D and 3D variant. Each subroutine creates an interface with a c function of the world builder of the same name.
@@ -51,34 +49,12 @@ Output:
51
49
52
50
- value (of temperature or composition) at the position specified with x, (y,) z, depth
53
51
54
-
Example (CHIC)
55
-
-----------
56
-
57
-
To illustrate how the World Builder interface can be used, the following section outlines what is done in CHIC:
- the path to the `.wb` file has to be passed as an input to CHIC
64
-
65
-
2. **Query Temperature and Composition**:
66
-
- pass domain boundaries as input to CHIC (analogous to the `.grid` files used for the gwb-grid app {ref}`part:user_manual:chap:how_to_use_the_apps:sec:gwb-grid_app`)
67
-
- parse grid in given boundaries
68
-
- overwrite values of temperature and composition at each position:
69
-
```fortran
70
-
! Query temperature at the given position
71
-
call temperature_3d(cworld, x, y, z, depth, temperature)
72
-
! Query composition at the given position
73
-
call composition_3d(cworld, x, y, z, depth, composition_number, composition)
74
-
```
75
-
3. **Release the World Builder**:
76
-
```fortran
77
-
call release_world(cworld)
78
-
```
79
-
80
52
```{important}
81
-
The `release_world` subroutine has to be called afterwards, in order to clean up the memory used by the World Builder.
53
+
When done with the World Builder, the `release_world` subroutine has to be called to clean up the memory used by the World Builder.
54
+
```
55
+
56
+
```{hint}
57
+
A short explanation of how the World Builder is integrated into the Mantle Convection code CHIC can be found on the next page {ref}`part:API_manual:chap:API_FFI:sec:Fortran_interface:subsec:CHIC_integration`
82
58
```
83
59
84
60
<!-- With the sphinx Fortran extension, the following syntax would be possible
0 commit comments