-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup_codes.py
53 lines (49 loc) · 1.29 KB
/
setup_codes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Setup / create codes
"""
from amuse.community.fastkick.interface import FastKick
from amuse.units import units
from bridge import CalculateFieldForCodes
def new_field_gravity_code(
converter, epsilon_squared=0.1 | units.parsec**2,
):
"Create a new field code"
print("Creating field code")
result = FastKick(
converter,
redirection="none",
# redirect_file=(
# p.dir_codelogs + "/field_gravity_code.log"
# ),
mode="cpu",
number_of_workers=8,
)
result.parameters.epsilon_squared = epsilon_squared
print(result.parameters)
return result
def new_field_code(
code,
# converter=None,
# epsilon_squared=0. | units.m**2,
):
" something"
# result = CalculateFieldForCodesUsingReinitialize(
result = CalculateFieldForCodes(
new_field_gravity_code,
[code],
# converter=converter,
# epsilon_squared=epsilon_squared,
# required_attributes=[
# 'mass', 'radius',
# 'x', 'y', 'z',
# 'vx', 'vy', 'vz',
# ]
# required_attributes=[
# 'mass', 'u',
# 'x', 'y', 'z',
# 'vx', 'vy', 'vz',
# ]
)
return result