Skip to content

Memory leak when using Gadget2? #739

@ReinosoB

Description

@ReinosoB

I am experiencing a memory leak when I change the internal energy of sph particles in Gadget2.
This does not occur when I do the same but using Fi. Any idea of why does this happen?
The next lines reproduces the issue:

import numpy
from amuse.units import units, constants, nbody_system
from amuse.community.gadget2.interface import Gadget2
from amuse.ext.molecular_cloud import molecular_cloud

numpy.random.seed(12122019)

Nsph =1048576
Mgas =1.e4    |units.MSun                  
Rgas =1.5     |units.parsec               

dt   =   5.   |units.yr
t_end=1000.   |units.yr  

gamma=5./3.
meanmwt=1.82  |units.amu

converter = nbody_system.nbody_to_si(Mgas, Rgas)

T_ini =200.|units.K
ratio1=5. * constants.kB * T_ini * Rgas/(3. * Mgas * (gamma-1.) * constants.G * meanmwt)
ratio2=0.0
gas = molecular_cloud(nf=64,power=1.8,targetN=Nsph, convert_nbody=converter,
                          ethep_ratio=ratio1, ekep_ratio=ratio2).result

##----sph code-------------------------------------
sph = Gadget2(converter,number_of_workers=30)
sph.initialize_code()
sph.gas_particles.add_particles(gas) 

while sph.model_time<t_end:
  sph.gas_particles.u*=0.9
  sph.evolve_model(sph.model_time+dt)

sph.stop()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions