Smilei icon indicating copy to clipboard operation
Smilei copied to clipboard

Segmentation fault with time_frozen

Open iplasma opened this issue 1 year ago • 12 comments

Hi,

With the attached test input file and latest master branch of Smilei, the simulation will crash with message as follows. This appears to be related to the time_frozen variable, for example, if it is set to a value between 0 and 6, the code seems to run fine, but it crashes for time_frozen = 7.0, which is very strange. Any idea of what could be wrong?

Segmentation fault (Address not mapped to object [0x801878c88]) Stack trace (most recent call last): #13 Object "[0xffffffffffffffff]", at 0xffffffffffffffff, in #12 Object "/global/Work/smilei_github/Smilei/smilei", at 0x40c959, in _start #11 Object "/lib64/libc.so.6", at 0x7f62fb9ec24c, in __libc_start_main #10 Object "/global/Work/smilei_github/Smilei/smilei", at 0x8e3e3a, in main #9 Object "/opt/AMD/aocc-compiler-3.2.0/bin/../lib/libomp.so", at 0x7f62fbbf7340, in __kmpc_fork_call #8 Object "/opt/AMD/aocc-compiler-3.2.0/bin/../lib/libomp.so", at 0x7f62fbc09711, in __kmp_fork_call #7 Object "/opt/AMD/aocc-compiler-3.2.0/bin/../lib/libomp.so", at 0x7f62fbc00ace, in #6 Object "/opt/AMD/aocc-compiler-3.2.0/bin/../lib/libomp.so", at 0x7f62fbc6a3b2, in __kmp_invoke_microtask #5 Object "/global/Work/smilei_github/Smilei/smilei", at 0x8e5fb0, in #4 Object "/global/Work/smilei_github/Smilei/smilei", at 0x7cb761, in VectorPatch::dynamics(Params&, SmileiMPI*, SimWindow*, RadiationTables&, MultiphotonBreitWheelerTables&, double, Timers&, int) #3 Object "/global/Work/smilei_github/Smilei/smilei", at 0x7cbb76, in VectorPatch::dynamicsWithoutTasks(Params&, SmileiMPI*, SimWindow*, RadiationTables&, MultiphotonBreitWheelerTables&, double, Timers&, int) Stack trace (most recent call last) in thread 869352: #2 Object "/global/Work/smilei_github/Smilei/smilei", at 0x91f2fa, in Species::dynamics(double, unsigned int, ElectroMagn*, Params&, bool, PartWalls*, Patch*, SmileiMPI*, RadiationTables&, MultiphotonBreitWheelerTables&) #1 Object "/global/Work/smilei_github/Smilei/smilei", at 0x8905d0, in Projector1D2Order::currentsAndDensityWrapper(ElectroMagn*, Particles&, SmileiMPI*, int, int, int, bool, bool, int, int, int) #0 Object "/global/Work/smilei_github/Smilei/smilei", at 0x891448, in Projector1D2Order::currents(double*, double*, double*, Particles&, unsigned int, double, int*, double*, int)

Parameters

  • Smilei version: 4.7-1037-g81d858dd9-HEAD

  • C++ compiler : both AOCC and gnu

  • Input file

import numpy as np
twopi = 2*np.pi
twopi2 = twopi**2.0

# ---------- pre-processing -------------------
## global info
box = [800]
res = [200]   # resolution in space: cell number per unit length
number_of_patches = [2048]
tmax = 20000  # max sim. time
## processing global info
dr =[ 1./i for i in res ]
dt_CFL = 1./np.sqrt(sum(i**2 for i in res))  # Courant condition
res_t = (1./dt_CFL)/0.98  # resolution in t
dt =1./res_t
Nt = int(res_t) # steps needed to finish one time unit

time_frozen= 18.0 #plasma_start-2.0

## adjust box size (cells) to be divided by number_of_pathces
##   ** do not change **
for i in range(len(box)):
        fac = float(box[i])*res[i]/number_of_patches[i]
        if fac!=fac//1: fac = int(fac)+1
        box[i] = float(fac)*number_of_patches[i]/res[i]
cells = list( np.array(box)*np.array(res) ) # total number of cells


# ------------ global settings --------------------
Main(
    geometry = "1Dcartesian",
    interpolation_order = 2,
    grid_length  = box,
    cell_length = dr,
    number_of_patches = number_of_patches, 
    timestep = dt,
    simulation_time = tmax,
    EM_boundary_conditions = [
        ['silver-muller'],
    ],
        solve_poisson = False,  
        reference_angular_frequency_SI = 3.e8/1.0e-6, 
        print_every = 10,
)


#--------------------- plasma -------------
ionize_model = "tunnel"
Species(name = 'carbon', ionization_model=ionize_model, ionization_electrons="elec", maximum_charge_state=6.0, position_initialization = 'regular', momentum_initialization = 'maxwell-juettner', temperature = [0.01/511]*3, particles_per_cell = 100, atomic_number = 6.0, mass = 12*1836.0, charge = 2.0, number_density = 1.0, boundary_conditions = [ ["remove", 'remove'],], time_frozen=time_frozen,)

Species(name = 'hydrogen', ionization_model=ionize_model, ionization_electrons="elec", maximum_charge_state=1.0, position_initialization = 'regular', momentum_initialization = 'maxwell-juettner', temperature = [0.01/511]*3, particles_per_cell = 100, atomic_number=1.0, mass = 1.0*1836.0, charge = 1.0, number_density = 1.0, boundary_conditions = [ ["remove", 'remove'],], time_frozen=time_frozen,)

Species(name = 'elec',position_initialization = 'regular',momentum_initialization = 'maxwell-juettner', temperature = [0.01/511]*3, particles_per_cell = 100, mass = 1.0, charge = -1.0, charge_density = 3.0, boundary_conditions = [ ["remove", 'remove'],], time_frozen=time_frozen,)

iplasma avatar Sep 06 '23 15:09 iplasma