amusecode / amuse

Astrophysical Multipurpose Software Environment. This is the main repository for AMUSE
http://www.amusecode.org
Apache License 2.0
158 stars 99 forks source link

Add "textbook" example for stellar_wind.py #550

Open rieder opened 4 years ago

rieder commented 4 years ago

stellar_wind.py (@vdhelm et al. 2019) does not currently have an example, since it was released after the AMUSE book came out. It would be good to have such an example though.

vdhelm commented 4 years ago

Very good point, I remember I made one at some point, I'll take some time to dig it up and add it.

rieder commented 4 years ago

That would be great!

GFTwrt commented 4 years ago

Hello, I'm interested in an example too. Is there any progress in the digging?

GFTwrt commented 4 years ago

Hello, any progress in generating an example? THX for the Support.

spzwart commented 4 years ago

a MSc student in class might be making one. otherwise I will.

On Wed, Dec 11, 2019, 09:07 Steven Rieder notifications@github.com wrote:

stellar_wind.py (Van der Helm et al. 2019) does not currently have an example, since it was released after the AMUSE book came out. It would be good to have such an example though.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/amusecode/amuse/issues/550?email_source=notifications&email_token=ABCPFTD4UJTKFS43BTEGW5TQYCNT5A5CNFSM4JZKZRLKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H7V3TZQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCPFTHNSZNS7F6RICPS45DQYCNT5ANCNFSM4JZKZRLA .

GFTwrt commented 4 years ago

Hello Simon,

thank you for doing an example. In the meantime I had a look to the tests folder and setup a first simulation, which provides me problems. Maybe you could give me a hint. It looks like a problem in the python core of amuse. I'm well suited in C/C++ but not that deep in python. I get the following error: "AmuseException: Error when calling 'evolve_model' of a 'Gadget2', errorcode is -8, error is 'A particle was assigned a timestep of size zero. The code_time_unit used may be too large.'" if I simulate with a few SPH-Particles (but I'll need much more). I think gadget->timestep_limit will decrease the internal times much. But when I try to adjust "hydro.parameters.code_time_unit" I get the message: "CoreException: Could not set value for parameter 'code_time_unit' of a 'Gadget2' object, parameter is read-only".

even if "interface.py" defines a getter and a setter.
@legacy_function def get_unit_time(): """Get the code time unit (in s/h, default: 3.085678e16 s = (1 kpc) / (1 km/s) ~ 0.9778 Gyr). Implicitly changes velocity unit.""" function = LegacyFunctionSpecification() function.addParameter('code_time_unit', dtype='float64', direction=function.OUT, description = "The code time unit (in s/h, default: 3.085678e16 s = (1 kpc) / (1 km/s) ~ 0.9778 Gyr).") function.result_type = 'int32' return function

@legacy_function
def set_unit_time():
    """Set the code time unit (in s/h, default: 3.085678e16 s = (1 kpc) / (1 km/s) ~ 0.9778 Gyr)."""
    function = LegacyFunctionSpecification()
    function.addParameter('code_time_unit', dtype='float64', direction=function.IN,
        description = "The code time unit (in s/h, default: 3.085678e16 s = (1 kpc) / (1 km/s) ~ 0.9778 Gyr).")
    function.result_type = 'int32'
    return function

Thank you for your help in advance!

Thomas solar_wind1.zip