fargopy 0.2.1__py3-none-any.whl → 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fargopy/__init__.py +202 -87
- fargopy/fields.py +221 -0
- fargopy/simulation.py +845 -0
- fargopy/sys.py +41 -18
- fargopy/util.py +4 -0
- fargopy/version.py +1 -1
- {fargopy-0.2.1.dist-info → fargopy-0.3.0.dist-info}/LICENSE +0 -0
- fargopy-0.3.0.dist-info/METADATA +243 -0
- fargopy-0.3.0.dist-info/RECORD +13 -0
- {fargopy-0.2.1.dist-info → fargopy-0.3.0.dist-info}/WHEEL +1 -1
- fargopy/__cycle1.py +0 -880
- fargopy/conf.py +0 -20
- fargopy/fargo3d.py +0 -561
- fargopy-0.2.1.dist-info/METADATA +0 -470
- fargopy-0.2.1.dist-info/RECORD +0 -14
- {fargopy-0.2.1.data → fargopy-0.3.0.data}/scripts/ifargopy +0 -0
- {fargopy-0.2.1.dist-info → fargopy-0.3.0.dist-info}/entry_points.txt +0 -0
- {fargopy-0.2.1.dist-info → fargopy-0.3.0.dist-info}/top_level.txt +0 -0
fargopy-0.2.1.dist-info/METADATA
DELETED
|
@@ -1,470 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: fargopy
|
|
3
|
-
Version: 0.2.1
|
|
4
|
-
Summary: FARGO3D Wrapping
|
|
5
|
-
Home-page: https://pypi.org/project/fargopy
|
|
6
|
-
Author: Jorge Zuluaga, Matias Montesinos
|
|
7
|
-
Author-email: jorge.zuluaga@gmail.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Keywords: astronomy MHD CFD
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
-
Classifier: Operating System :: OS Independent
|
|
13
|
-
Description-Content-Type: text/markdown
|
|
14
|
-
License-File: LICENSE
|
|
15
|
-
Requires-Dist: scipy
|
|
16
|
-
Requires-Dist: matplotlib
|
|
17
|
-
Requires-Dist: tqdm
|
|
18
|
-
Requires-Dist: numpy
|
|
19
|
-
Requires-Dist: ipython
|
|
20
|
-
Requires-Dist: celluloid
|
|
21
|
-
|
|
22
|
-
# FARGOpy
|
|
23
|
-
## Wrapping FRAGO3D
|
|
24
|
-
|
|
25
|
-
<!-- This are visual tags that you may add to your package at the beginning with useful information on your package -->
|
|
26
|
-
[](https://pypi.org/project/fargopy/)
|
|
27
|
-
[](https://pypi.org/project/fargopy/)
|
|
28
|
-
|
|
29
|
-
`FARGOpy` is a python wrapping for [`FARGO3D`](https://fargo3d.bitbucket.io/intro.html)., the well-knwon hydrodynamics and magnetohydrodynamics parallel code. This wrapping is intended to ensue the interaction with FARGO3D especially for those starting using the code, for instance for teaching and training purposes, but also provide functionalities for most advanced users in tasks related to the postprocessing of output files and plotting.
|
|
30
|
-
|
|
31
|
-
<p align="center"><img src="https://github.com/seap-udea/fargopy/blob/main/gallery/fargo-animation.gif?raw=true" alt="Animation""/></p>
|
|
32
|
-
|
|
33
|
-
## Download and install FARGO3D
|
|
34
|
-
|
|
35
|
-
For using `FARGOpy` you first need to download and install `FARGO3D` and all its prerequisites. For a detailed guide please see the [FARGO documentation](https://fargo3d.bitbucket.io/index.html) or the [project repo at bitbucket](https://bitbucket.org/fargo3d/public/src/ae0fcdc67bb7c83aed85fc9a4d4a2d5061324597/?at=release%2Fpublic). Still, `FARGOpy` provides some useful commands and tools to test the platform on which you are working and check if it is prepared to use the whole functionalities of the packages or part of them.
|
|
36
|
-
|
|
37
|
-
> **NOTE**: It is important to understand that `FARGO3D` works especially well on Linux plaforms (including `MacOS`). The same condition applies for `FARGOpy`. Because of that, most internal as well as public features of the packages are designed to work in a `Linux` environment. For working in another operating systems, for instance for teaching or training purposes, please consider to use virtual machines.
|
|
38
|
-
|
|
39
|
-
Still, `fargopy` provides a simple way to get the latest version of `FARGO3D`. For this just run in the terminal:
|
|
40
|
-
|
|
41
|
-
```shell
|
|
42
|
-
$ ifargopy download
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
A copy of `FARGO3D` will be download in the directory where the command is executed with the name `./fargo3d/`
|
|
46
|
-
|
|
47
|
-
## Quickstart
|
|
48
|
-
|
|
49
|
-
There are three modalities for using `fargopy`:
|
|
50
|
-
|
|
51
|
-
1. **FARGO3D expert**. In this modality you already have a `FARGO3D` installation and want to use `fargopy` to manipulate input and output files.
|
|
52
|
-
|
|
53
|
-
2. **FARGO3D newbie**. In this modality you are starting to use `FARGO3D` and want to use some of the tools available in `fargopy` to compile, run and analyse the output.
|
|
54
|
-
|
|
55
|
-
3. Something in the middle.
|
|
56
|
-
|
|
57
|
-
In the following we will explain the basic functionalities that might result useful in each modality.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
For this quickstart let's load these utilities:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
```python
|
|
64
|
-
import numpy as np
|
|
65
|
-
import matplotlib.pyplot as plt
|
|
66
|
-
from IPython.display import HTML
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### `FARGO3D` expert mode
|
|
70
|
-
|
|
71
|
-
To use `fargopy` in the case that you already have some simulation results, run the `ifargopy` script:
|
|
72
|
-
|
|
73
|
-
```shell
|
|
74
|
-
$ ifargopy
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
This command will start a session of `IPython` and initialize `fargopy`. Alternatively you may prefer to work in a `Jupyter` notebook. In both cases, the first thing to do is to import `fargopy`.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
```python
|
|
81
|
-
import fargopy as fp
|
|
82
|
-
from fargopy import DEG, RAD
|
|
83
|
-
%load_ext autoreload
|
|
84
|
-
%autoreload 2
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
The autoreload extension is already loaded. To reload it, use:
|
|
88
|
-
%reload_ext autoreload
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
When you run `fargopy` from the command line using `ifargopy` the previous import command is included in the initialization script.
|
|
92
|
-
|
|
93
|
-
> **NOTE**: For the purpose of this example, we will assume that you already have a copy of `FARGO3D` in a directory named `./fargo3d/`. Additionally we assume that for illustration purposes you have ran the `fargo` setup and have all or part of the outputs in the folder `./fargo3d/outputs/fargo`. If you have never used fargo3d, and still want to use this part of the Quickstart, ran these commands in the terminal (still, a more detailed guide to `FARGO3D` and how to compile, configure and run it is described in the *newbie* section of this Quickstart):
|
|
94
|
-
|
|
95
|
-
```shell
|
|
96
|
-
ifargopy download
|
|
97
|
-
cd fargo3d/
|
|
98
|
-
make SETUP=fargo
|
|
99
|
-
./fargo3d setups/fargo/fargo.par
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
#### Basic commands
|
|
103
|
-
|
|
104
|
-
Any operation in `fargopy` requires the creation of a simulation:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
```python
|
|
108
|
-
sim = fp.Simulation()
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
Set the directory where the outputs are located:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
```python
|
|
115
|
-
sim.set_output_dir('./fargo3d/outputs/fargo')
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
Now you are connected with output directory './fargo3d/outputs/fargo'
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
List the files available in the output directory:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
```python
|
|
125
|
-
outputs = sim.list_outputs()
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
271 files in output directory
|
|
129
|
-
IDL.var, bigplanet0.dat, dims.dat, domain_x.dat, domain_y.dat, domain_z.dat, gasdens0.dat, gasdens0_2d.dat, gasdens1.dat, gasdens10.dat,
|
|
130
|
-
gasdens11.dat, gasdens12.dat, gasdens13.dat, gasdens14.dat, gasdens15.dat, gasdens16.dat, gasdens17.dat, gasdens18.dat, gasdens19.dat, gasdens2.dat,
|
|
131
|
-
gasdens20.dat, gasdens21.dat, gasdens22.dat, gasdens23.dat, gasdens24.dat, gasdens25.dat, gasdens26.dat, gasdens27.dat, gasdens28.dat, gasdens29.dat,
|
|
132
|
-
gasdens3.dat, gasdens30.dat, gasdens31.dat, gasdens32.dat, gasdens33.dat, gasdens34.dat, gasdens35.dat, gasdens36.dat, gasdens37.dat, gasdens38.dat,
|
|
133
|
-
gasdens39.dat, gasdens4.dat, gasdens40.dat, gasdens41.dat, gasdens42.dat, gasdens43.dat, gasdens44.dat, gasdens45.dat, gasdens46.dat, gasdens47.dat,
|
|
134
|
-
gasdens48.dat, gasdens49.dat, gasdens5.dat, gasdens50.dat, gasdens6.dat, gasdens7.dat, gasdens8.dat, gasdens9.dat, gasenergy0.dat, gasenergy1.dat,
|
|
135
|
-
gasenergy10.dat, gasenergy11.dat, gasenergy12.dat, gasenergy13.dat, gasenergy14.dat, gasenergy15.dat, gasenergy16.dat, gasenergy17.dat, gasenergy18.dat, gasenergy19.dat,
|
|
136
|
-
gasenergy2.dat, gasenergy20.dat, gasenergy21.dat, gasenergy22.dat, gasenergy23.dat, gasenergy24.dat, gasenergy25.dat, gasenergy26.dat, gasenergy27.dat, gasenergy28.dat,
|
|
137
|
-
gasenergy29.dat, gasenergy3.dat, gasenergy30.dat, gasenergy31.dat, gasenergy32.dat, gasenergy33.dat, gasenergy34.dat, gasenergy35.dat, gasenergy36.dat, gasenergy37.dat,
|
|
138
|
-
gasenergy38.dat, gasenergy39.dat, gasenergy4.dat, gasenergy40.dat, gasenergy41.dat, gasenergy42.dat, gasenergy43.dat, gasenergy44.dat, gasenergy45.dat, gasenergy46.dat,
|
|
139
|
-
gasenergy47.dat, gasenergy48.dat, gasenergy49.dat, gasenergy5.dat, gasenergy50.dat, gasenergy6.dat, gasenergy7.dat, gasenergy8.dat, gasenergy9.dat, gasvx0.dat,
|
|
140
|
-
gasvx0_2d.dat, gasvx1.dat, gasvx10.dat, gasvx11.dat, gasvx12.dat, gasvx13.dat, gasvx14.dat, gasvx15.dat, gasvx16.dat, gasvx17.dat,
|
|
141
|
-
gasvx18.dat, gasvx19.dat, gasvx2.dat, gasvx20.dat, gasvx21.dat, gasvx22.dat, gasvx23.dat, gasvx24.dat, gasvx25.dat, gasvx26.dat,
|
|
142
|
-
gasvx27.dat, gasvx28.dat, gasvx29.dat, gasvx3.dat, gasvx30.dat, gasvx31.dat, gasvx32.dat, gasvx33.dat, gasvx34.dat, gasvx35.dat,
|
|
143
|
-
gasvx36.dat, gasvx37.dat, gasvx38.dat, gasvx39.dat, gasvx4.dat, gasvx40.dat, gasvx41.dat, gasvx42.dat, gasvx43.dat, gasvx44.dat,
|
|
144
|
-
gasvx45.dat, gasvx46.dat, gasvx47.dat, gasvx48.dat, gasvx49.dat, gasvx5.dat, gasvx50.dat, gasvx6.dat, gasvx7.dat, gasvx8.dat,
|
|
145
|
-
gasvx9.dat, gasvy0.dat, gasvy0_2d.dat, gasvy1.dat, gasvy10.dat, gasvy11.dat, gasvy12.dat, gasvy13.dat, gasvy14.dat, gasvy15.dat,
|
|
146
|
-
gasvy16.dat, gasvy17.dat, gasvy18.dat, gasvy19.dat, gasvy2.dat, gasvy20.dat, gasvy21.dat, gasvy22.dat, gasvy23.dat, gasvy24.dat,
|
|
147
|
-
gasvy25.dat, gasvy26.dat, gasvy27.dat, gasvy28.dat, gasvy29.dat, gasvy3.dat, gasvy30.dat, gasvy31.dat, gasvy32.dat, gasvy33.dat,
|
|
148
|
-
gasvy34.dat, gasvy35.dat, gasvy36.dat, gasvy37.dat, gasvy38.dat, gasvy39.dat, gasvy4.dat, gasvy40.dat, gasvy41.dat, gasvy42.dat,
|
|
149
|
-
gasvy43.dat, gasvy44.dat, gasvy45.dat, gasvy46.dat, gasvy47.dat, gasvy48.dat, gasvy49.dat, gasvy5.dat, gasvy50.dat, gasvy6.dat,
|
|
150
|
-
gasvy7.dat, gasvy8.dat, gasvy9.dat, monitor, orbit0.dat, outputgas.dat, planet0.dat, summary0.dat, summary1.dat, summary10.dat,
|
|
151
|
-
summary11.dat, summary12.dat, summary13.dat, summary14.dat, summary15.dat, summary16.dat, summary17.dat, summary18.dat, summary19.dat, summary2.dat,
|
|
152
|
-
summary20.dat, summary21.dat, summary22.dat, summary23.dat, summary24.dat, summary25.dat, summary26.dat, summary27.dat, summary28.dat, summary29.dat,
|
|
153
|
-
summary3.dat, summary30.dat, summary31.dat, summary32.dat, summary33.dat, summary34.dat, summary35.dat, summary36.dat, summary37.dat, summary38.dat,
|
|
154
|
-
summary39.dat, summary4.dat, summary40.dat, summary41.dat, summary42.dat, summary43.dat, summary44.dat, summary45.dat, summary46.dat, summary47.dat,
|
|
155
|
-
summary48.dat, summary49.dat, summary5.dat, summary50.dat, summary6.dat, summary7.dat, summary8.dat, summary9.dat, tqwk0.dat, used_rad.dat,
|
|
156
|
-
variables.par,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
The files describing the basic properties of the simulations are `dims.dat`, `variables.par` and `domain_*.dat`. You may load the information in these files:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
```python
|
|
163
|
-
vars, domains = sim.load_properties()
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
Loading variables
|
|
167
|
-
84 variables loaded
|
|
168
|
-
Simulation in 2 dimensions
|
|
169
|
-
Loading domain in cylindrical coordinates:
|
|
170
|
-
Variable phi: 384 [[0, -3.1334114227210694], [-1, 3.1334114227210694]]
|
|
171
|
-
Variable r: 128 [[0, 0.408203125], [-1, 2.491796875]]
|
|
172
|
-
Variable z: 1 [[0, 0.0], [-1, 0.0]]
|
|
173
|
-
Configuration variables and domains load into the object. See e.g. <sim>.vars
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
#### Load field data into memory
|
|
177
|
-
|
|
178
|
-
The outputs of a simulation are given as datafiles containing the value of different fields in the coordinate grid. You can load a single field:
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
```python
|
|
182
|
-
gasdens0 = sim.load_field('gasdens',snapshot=0)
|
|
183
|
-
gasdens0, gasdens0.data.shape
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
([[[0.00063662 0.00063662 0.00063662 ... 0.00063662 0.00063662 0.00063662]
|
|
190
|
-
[0.00063662 0.00063662 0.00063662 ... 0.00063662 0.00063662 0.00063662]
|
|
191
|
-
[0.00063662 0.00063662 0.00063662 ... 0.00063662 0.00063662 0.00063662]
|
|
192
|
-
...
|
|
193
|
-
[0.00063662 0.00063662 0.00063662 ... 0.00063662 0.00063662 0.00063662]
|
|
194
|
-
[0.00063662 0.00063662 0.00063662 ... 0.00063662 0.00063662 0.00063662]
|
|
195
|
-
[0.00063662 0.00063662 0.00063662 ... 0.00063662 0.00063662 0.00063662]]],
|
|
196
|
-
(1, 128, 384))
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
As you can see, fields are loaded as special `Field` objects (see `fp.Field?` for a list of attributes and methods), whose most important attribute is `data` which is the `numpy` array containing the values of the field in the coordinate domain.
|
|
201
|
-
|
|
202
|
-
Vectorial fields are special cases. In `FARGO3D` each component of the field is separated by file suffixes such as `x`, `y` and `z` (even if you are working in different coordinate systems). `fargopy` is able to load all components if a vector field using:
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
```python
|
|
206
|
-
vel = sim.load_field('gasv',snapshot=0,type='vector')
|
|
207
|
-
vel.data.shape
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
(2, 1, 128, 384)
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
As you can see, the first index correspond to the component of the field (`x` and `y` in the `FARGO3D` convention, but actually `phi` and `r` in cylindrical coordinates). The second index is the `z` coordinate, the third the `y` coordinate (`r` in the cylindrical system of coordinates) and the fourh is the `z` coordinate (`phi` in the cylindrical system of coordinates).
|
|
218
|
-
|
|
219
|
-
Depending on the size of the outputs, you can also load all physical fields in the output associated to a given fluid. Use this method with caution:
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
```python
|
|
223
|
-
fields0 = sim.load_allfields('gas',snapshot=0)
|
|
224
|
-
fields0.keys(), fields0.size
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
(['gasdens', 'gasenergy', 'gasvx', 'gasvy', 'size'], 1.5)
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
Size here is given in Megabytes.
|
|
235
|
-
|
|
236
|
-
If you want all the fields drop the `snapshot` option (or set in `None`):
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
```python
|
|
240
|
-
fields = sim.load_allfields('gas')
|
|
241
|
-
fields.print_keys()
|
|
242
|
-
fields.item('0').keys(), fields.size
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
0, 1, 10, 11, 12, 13, 14, 15, 16, 17,
|
|
246
|
-
18, 19, 2, 20, 21, 22, 23, 24, 25, 26,
|
|
247
|
-
27, 28, 29, 3, 30, 31, 32, 33, 34, 35,
|
|
248
|
-
36, 37, 38, 39, 4, 40, 41, 42, 43, 44,
|
|
249
|
-
45, 46, 47, 48, 49, 5, 50, 6, 7, 8,
|
|
250
|
-
9, snapshots, size
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
(['gasdens', 'gasenergy', 'gasvx', 'gasvy'], 76.5)
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
```python
|
|
262
|
-
fields.item('0').gasdens.data.shape
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
(1, 128, 384)
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
As you may see, the size of the fields start to be considerable large (36 MB in this case), so it is important to not abusing of this command.
|
|
273
|
-
|
|
274
|
-
#### Field slices
|
|
275
|
-
|
|
276
|
-
Once you have loaded a given field you may want to extract a slice for plotting. Let's for instance plot the density as a function of distance in the example simulation at a given snapshot:
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
```python
|
|
280
|
-
gasdens10 = sim.load_field('gasdens',snapshot=10)
|
|
281
|
-
gasdens10.data.shape
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
(1, 128, 384)
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
Let's extract the density of the gas at `phi=0` and `z=0`:
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
```python
|
|
295
|
-
gasdens_r = gasdens10.slice(phi=0,z=0)
|
|
296
|
-
gasdens_r.shape
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
(128,)
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
And plot:
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
```python
|
|
310
|
-
plt.ioff()
|
|
311
|
-
fig,ax = plt.subplots()
|
|
312
|
-
ax.semilogy(sim.domains.r,gasdens_r)
|
|
313
|
-
ax.set_xlabel(r"$r$ [cu]")
|
|
314
|
-
ax.set_ylabel(r"$\rho$ [cu]")
|
|
315
|
-
fp.Util.fargopy_mark(ax);
|
|
316
|
-
fig.savefig('gallery/example-dens_r.png')
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
<p align="center"><img src="https://github.com/seap-udea/fargopy/blob/main/gallery/example-dens_r.png?raw=true" alt="Animation""/></p>
|
|
320
|
-
|
|
321
|
-
We can do this in a single step with `fargopy`:
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
```python
|
|
325
|
-
gasdens, mesh = gasdens10.meshslice(slice='z=0,phi=0')
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
The object `mesh` now contains matrices of the coordinates:
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
```python
|
|
332
|
-
mesh.keys()
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
['r', 'phi', 'x', 'y', 'z']
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
If you are plotting `r` vs. `gasdens` the plot will be:
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
```python
|
|
346
|
-
plt.ioff()
|
|
347
|
-
fig,ax = plt.subplots()
|
|
348
|
-
ax.semilogy(mesh.r,gasdens)
|
|
349
|
-
ax.set_xlabel(r"$r$ [cu]")
|
|
350
|
-
ax.set_ylabel(r"$\rho$ [cu]")
|
|
351
|
-
fp.Util.fargopy_mark(ax)
|
|
352
|
-
fig.savefig('gallery/example-dens_r.png')
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
<p align="center"><img src="https://github.com/seap-udea/fargopy/blob/main/gallery/example-dens_r.png?raw=true" alt="Animation""/></p>
|
|
356
|
-
|
|
357
|
-
This simple procedure reduce considerably the creation of more complex plots, for instance, a map of the density in different planes:
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
```python
|
|
361
|
-
gasdens, mesh = gasdens10.meshslice(slice='z=0')
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
And plot it:
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
```python
|
|
368
|
-
plt.ioff()
|
|
369
|
-
fig,axs = plt.subplots(1,2,figsize=(12,6))
|
|
370
|
-
|
|
371
|
-
ax = axs[0]
|
|
372
|
-
ax.pcolormesh(mesh.phi*RAD,mesh.r*sim.UL/fp.AU,gasdens,cmap='prism')
|
|
373
|
-
ax.set_xlabel('$\phi$ [deg]')
|
|
374
|
-
ax.set_ylabel('$r$ [au]')
|
|
375
|
-
fp.Util.fargopy_mark(ax)
|
|
376
|
-
|
|
377
|
-
ax = axs[1]
|
|
378
|
-
ax.pcolormesh(mesh.x*sim.UL/fp.AU,mesh.y*sim.UL/fp.AU,
|
|
379
|
-
gasdens,cmap='prism')
|
|
380
|
-
ax.set_xlabel('$x$ [au]')
|
|
381
|
-
ax.set_ylabel('$y$ [au]')
|
|
382
|
-
fp.Util.fargopy_mark(ax)
|
|
383
|
-
ax.axis('equal')
|
|
384
|
-
fig.savefig('gallery/example-dens_disk.png')
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
<p align="center"><img src="https://github.com/seap-udea/fargopy/blob/main/gallery/example-dens_disk.png?raw=true" alt="Animation""/></p>
|
|
388
|
-
|
|
389
|
-
Let's create an animation for illustrating how easy `FARGOpy` make life:
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
```python
|
|
393
|
-
plt.ioff()
|
|
394
|
-
from celluloid import Camera
|
|
395
|
-
from tqdm import tqdm
|
|
396
|
-
|
|
397
|
-
sim = fp.Simulation()
|
|
398
|
-
sim.set_output_dir('./fargo3d/outputs/fargo')
|
|
399
|
-
sim.load_properties()
|
|
400
|
-
|
|
401
|
-
gasdens_all = sim.load_allfields('gasdens')
|
|
402
|
-
fig,axs = plt.subplots(1,2,figsize=(12,6))
|
|
403
|
-
|
|
404
|
-
cmap = 'prism'
|
|
405
|
-
camera = Camera(fig)
|
|
406
|
-
for snapshot in tqdm(gasdens_all.snapshots):
|
|
407
|
-
gasdens_snap = gasdens_all.item(str(snapshot)).gasdens
|
|
408
|
-
gasdens,mesh = gasdens_snap.meshslice(slice='z=0')
|
|
409
|
-
|
|
410
|
-
ax = axs[0]
|
|
411
|
-
ax.pcolormesh(mesh.phi*RAD,mesh.r*sim.UL/fp.AU,gasdens,cmap=cmap)
|
|
412
|
-
ax.set_xlabel('$\phi$ [deg]')
|
|
413
|
-
ax.set_ylabel('$r$ [au]')
|
|
414
|
-
|
|
415
|
-
ax = axs[1]
|
|
416
|
-
ax.pcolormesh(mesh.x*sim.UL/fp.AU,mesh.y*sim.UL/fp.AU,gasdens,cmap=cmap)
|
|
417
|
-
ax.set_xlabel('$x$ [au]')
|
|
418
|
-
ax.set_ylabel('$y$ [au]')
|
|
419
|
-
fp.Util.fargopy_mark(ax)
|
|
420
|
-
|
|
421
|
-
camera.snap()
|
|
422
|
-
|
|
423
|
-
animation = camera.animate()
|
|
424
|
-
animation.save('gallery/fargo-animation.gif')
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
Now you are connected with output directory './fargo3d/outputs/fargo'
|
|
428
|
-
Loading variables
|
|
429
|
-
84 variables loaded
|
|
430
|
-
Simulation in 2 dimensions
|
|
431
|
-
Loading domain in cylindrical coordinates:
|
|
432
|
-
Variable phi: 384 [[0, -3.1334114227210694], [-1, 3.1334114227210694]]
|
|
433
|
-
Variable r: 128 [[0, 0.408203125], [-1, 2.491796875]]
|
|
434
|
-
Variable z: 1 [[0, 0.0], [-1, 0.0]]
|
|
435
|
-
Configuration variables and domains load into the object. See e.g. <sim>.vars
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
100%|██████████| 51/51 [00:01<00:00, 38.16it/s]
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
<p align="center"><img src="https://github.com/seap-udea/fargopy/blob/main/gallery/fargo-animation.gif?raw=true" alt="Animation""/></p>
|
|
442
|
-
|
|
443
|
-
### `FARGO3D` newbie
|
|
444
|
-
|
|
445
|
-
This section is under development.
|
|
446
|
-
|
|
447
|
-
## What's new
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
Version 0.2.*:
|
|
451
|
-
|
|
452
|
-
- First real applications tested with FARGOpy.
|
|
453
|
-
- All basic routines for reading output created.
|
|
454
|
-
- Major refactoring.
|
|
455
|
-
|
|
456
|
-
Version 0.1.*:
|
|
457
|
-
|
|
458
|
-
- Package is now provided with a script 'ifargopy' to run 'ipython' with fargopy initialized.
|
|
459
|
-
- A new 'progress' mode has been added to status method.
|
|
460
|
-
- All the dynamics of loading/compiling/running/stoppìng/resuming FARGO3D has been developed.
|
|
461
|
-
|
|
462
|
-
Version 0.0.*:
|
|
463
|
-
|
|
464
|
-
- First classes created.
|
|
465
|
-
- The project is started!
|
|
466
|
-
|
|
467
|
-
------------
|
|
468
|
-
|
|
469
|
-
This package has been designed and written mostly by Jorge I. Zuluaga with advising and contributions by Matías Montesinos (C) 2023
|
|
470
|
-
|
fargopy-0.2.1.dist-info/RECORD
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
fargopy/__cycle1.py,sha256=mJbXkTu1SI8lb3TRs0NoZuTvH5LBlQRNDlVDzWMGJGI,33432
|
|
2
|
-
fargopy/__init__.py,sha256=in-P41MRX6lHp7BmOm5H6SWGYMzQ38Nv8ekOQJeDHfo,5385
|
|
3
|
-
fargopy/conf.py,sha256=clvquJV1jqAsAeEqYwO8gi_cvNoUehtDvs_zKer9lBc,620
|
|
4
|
-
fargopy/fargo3d.py,sha256=9G36sy-R7WEzX8fgd4q3SAnTlBdoA_VFy-3iHodLyOA,21741
|
|
5
|
-
fargopy/sys.py,sha256=4y1UtqArFm4lsBiZMDNNE7PxovTi6d-9EPCyfHMoJcM,3685
|
|
6
|
-
fargopy/util.py,sha256=edkAf7zqUACPLvJLayAiL9TTgJ9t-WsLWbIWmGLKya8,1443
|
|
7
|
-
fargopy/version.py,sha256=alA1RbafVeEhjGjWHCX53BcqXRSfLqIjxpJ2N9z5NUg,16
|
|
8
|
-
fargopy-0.2.1.data/scripts/ifargopy,sha256=t5E07jKzOLtNnlNyElQZbzjCW6wnR0bc8uCaZpw9yS8,382
|
|
9
|
-
fargopy-0.2.1.dist-info/LICENSE,sha256=aIckKnNVrkXQMqEKlzGn_REfTwc82TF35BHMCRwPXCI,1097
|
|
10
|
-
fargopy-0.2.1.dist-info/METADATA,sha256=bi1RKEpSxuupqHGMJ3MFA9RNXKUm-R_edR2qsgZpYfo,17266
|
|
11
|
-
fargopy-0.2.1.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
|
|
12
|
-
fargopy-0.2.1.dist-info/entry_points.txt,sha256=555NPKYbLCN0fgJbdW4b4azZ5sqjhqVqTUxujBBYEJY,49
|
|
13
|
-
fargopy-0.2.1.dist-info/top_level.txt,sha256=_r66v1_-9T7dB5sQa12AdxaAdsv9-OTwtR-vft4OPBU,8
|
|
14
|
-
fargopy-0.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|