Exemple #1
0
    def AddFrequencyFromFrequencyList(self):
        (files, selected_filter) = QtWidgets.QFileDialog.getOpenFileNames(
            parent=self,
            caption='Add frequencies from frequency list files',
            filter=
            'frequency list files (*.harminv.selection.txt);; text files (*.txt);; CSV files (*.csv);; All Files(*)',
            directory=self.default_dir_InputDir)

        if files:
            self.default_dir_InputDir = files[0]

        for i in files:
            freq_list = getFrequencies(i)
            for f in freq_list:
                self.AddFrequency(f, get_c0() / f, 'from ' + i)

        return
def addCentralXYZSnapshots(arguments):

    if arguments.infile is None:
        print('ERROR: No input file specified.', file=sys.stderr)
        sys.exit(-1)

    FDTDobj = bfdtd.BFDTDobject()
    FDTDobj.verbosity = arguments.verbosity
    for infile in arguments.infile:
        FDTDobj.readBristolFDTD(infile)

    # hack: remove epsilon snapshots and probes to increase speed
    FDTDobj.clearEpsilonSnapshots()
    #FDTDobj.clearProbes()
    FDTDobj.clearAllSnapshots()

    (size, res) = FDTDobj.mesh.getSizeAndResolution()

    if arguments.verbosity > 0:
        print('res = ', res)

    frequency_vector = []
    if arguments.freqListFile is not None:
        frequency_vector.extend(getFrequencies(arguments.freqListFile))
    if arguments.wavelength_mum is not None:
        frequency_vector.extend(
            [get_c0() / i for i in arguments.wavelength_mum])
    if arguments.frequency_MHz is not None:
        frequency_vector.extend(arguments.frequency_MHz)

    if len(frequency_vector) <= 0:
        print('ERROR: Great scot! You forgot to specify frequencies.',
              file=sys.stderr)
        sys.exit(-1)

    FDTDobj.flag.iterations = arguments.iterations

    # hack: Make sure there will be at least one long duration snapshot at the end
    #arguments.repetition = FDTDobj.flag.iterations - arguments.first

    # Add full X,Y,Z central snapshots
    #pos = FDTDobj.box.getCentro()

    pos = [0, 0, 0]
    # another hack to get the defect position...
    for obj in FDTDobj.geometry_object_list:
        if obj.name == 'defect':
            pos = obj.getCentro()

    for i in [0, 1, 2]:
        letter = ['X', 'Y', 'Z'][i]
        f = FDTDobj.addFrequencySnapshot(letter, pos[i])
        f.name = 'central.' + letter + '.fsnap'
        f.first = arguments.first
        f.repetition = arguments.repetition
        f.frequency_vector = frequency_vector
        f.starting_sample = arguments.starting_sample

    if arguments.outdir is None:
        print('ERROR: no outdir specified', file=sys.stderr)
        sys.exit(-1)

    if arguments.basename is None:
        arguments.basename = os.path.basename(os.path.abspath(
            arguments.outdir))

    FDTDobj.fileList = []
    FDTDobj.writeAll(arguments.outdir, arguments.basename)
    FDTDobj.writeShellScript(arguments.outdir + os.path.sep +
                             arguments.basename + '.sh',
                             arguments.basename,
                             arguments.executable,
                             '$JOBDIR',
                             WALLTIME=arguments.walltime)

    return
def addModeVolumeFrequencySnapshots(arguments):
    '''
  .. todo:: find nice generic+flexible system for this...
  '''

    FDTDobj = bfdtd.BFDTDobject()
    FDTDobj.verbosity = arguments.verbosity
    for infile in arguments.infile:
        FDTDobj.readBristolFDTD(infile)

    (size, res) = FDTDobj.mesh.getSizeAndResolution()

    if arguments.verbosity > 0:
        print('res = ', res)

    if arguments.slicing_direction is None:
        # take the direction with the smallest number of snapshots to reduce number of generated .prn files
        S = ['X', 'Y', 'Z']
        arguments.slicing_direction = S[res.index(min(res))]

    frequency_vector = []
    if arguments.readFreqFromInput:
        #print('FUUUUUUUUUUUUUUUUUUUU')
        frequency_list = set()
        for freq_snap in FDTDobj.frequency_snapshot_list:
            for freq in freq_snap.frequency_vector:
                frequency_list.add(freq)
        print(frequency_list)
        frequency_vector.extend(frequency_list)
        print(frequency_vector)

        #sys.exit(-1)
    if arguments.freqListFile is not None:
        frequency_vector.extend(getFrequencies(arguments.freqListFile))
    if arguments.wavelength_mum is not None:
        frequency_vector.extend(
            [get_c0() / i for i in arguments.wavelength_mum])
    if arguments.frequency_MHz is not None:
        frequency_vector.extend(arguments.frequency_MHz)

    if len(frequency_vector) <= 0:
        print('ERROR: Great scot! You forgot to specify frequencies.',
              file=sys.stderr)
        sys.exit(-1)

    FDTDobj.flag.iterations = arguments.iterations

    NAME = 'ModeVolume'
    #print(arguments.slicing_direction)
    if arguments.slicing_direction == 'X':
        pos_list = FDTDobj.mesh.getXmesh()
        for pos in pos_list:
            e = FDTDobj.addEpsilonSnapshot('X', pos)
            e.name = NAME + '.eps'
            e.first = 1
            e.repetition = FDTDobj.flag.iterations + 1  # So that only one epsilon snapshot is created. We don't need more.
            f = FDTDobj.addFrequencySnapshot('X', pos)
            f.name = NAME + '.freq'
            f.first = arguments.first
            f.repetition = arguments.repetition
            f.starting_sample = arguments.starting_sample
            f.frequency_vector = frequency_vector
    elif arguments.slicing_direction == 'Y':
        pos_list = FDTDobj.mesh.getYmesh()
        for pos in pos_list:
            e = FDTDobj.addEpsilonSnapshot('Y', pos)
            e.name = NAME + '.eps'
            e.first = 1
            e.repetition = FDTDobj.flag.iterations + 1  # So that only one epsilon snapshot is created. We don't need more.
            f = FDTDobj.addFrequencySnapshot('Y', pos)
            f.name = NAME + '.freq'
            f.first = arguments.first
            f.repetition = arguments.repetition
            f.starting_sample = arguments.starting_sample
            f.frequency_vector = frequency_vector
    elif arguments.slicing_direction == 'Z':
        pos_list = FDTDobj.mesh.getZmesh()
        #for pos in pos_list:
        # another quick hack to reduce the number of snapshots to 101 around the center... .. todo:: add options for that...
        reduced_range = range(len(pos_list))
        pos_mid = int(numpy.floor(len(pos_list) / 2))
        #reduced_range = pos_list[ pos_mid-50:pos_mid+50+1]
        reduced_range = pos_list[pos_mid - 25:pos_mid + 25 + 1]
        #reduced_range = pos_list[ pos_mid-1:pos_mid+1+1]
        #reduced_range = pos_list[ pos_mid-12:pos_mid+12+1]

        # temporary hack
        #arguments.repetition = FDTDobj.flag.iterations - arguments.first

        full_list = []
        for pos in reduced_range:
            ##pos = pos_list[idx]
            #e = FDTDobj.addEpsilonSnapshot('Z',pos)
            #e.name = NAME + '.eps'
            #e.first = 1
            #e.repetition = FDTDobj.flag.iterations + 1 # So that only one epsilon snapshot is created. We don't need more.

            ## and more quick hacks...
            #e.P1[0] = min(reduced_range)
            #e.P1[1] = min(reduced_range)
            #e.P2[0] = max(reduced_range)
            #e.P2[1] = max(reduced_range)

            #f = FDTDobj.addFrequencySnapshot('Z',pos)
            #f.name = NAME + '.freq'
            #f.first = arguments.first
            #f.repetition = arguments.repetition
            #f.frequency_vector = frequency_vector

            F = bfdtd.FrequencySnapshot()
            F.name = NAME + '.freq'
            F.plane = 'Z'
            F.P1 = [FDTDobj.box.lower[0], FDTDobj.box.lower[1], pos]
            F.P2 = [FDTDobj.box.upper[0], FDTDobj.box.upper[1], pos]
            F.first = arguments.first
            F.repetition = arguments.repetition
            F.starting_sample = arguments.starting_sample
            F.frequency_vector = frequency_vector

            full_list.append(F)

            ## and more quick hacks...
            #f.P1[0] = min(reduced_range)
            #f.P1[1] = min(reduced_range)
            #f.P2[0] = max(reduced_range)
            #f.P2[1] = max(reduced_range)

    else:
        print(
            'ERROR: invalid slicing direction : arguments.slicing_direction = '
            + str(arguments.slicing_direction),
            file=sys.stderr)
        sys.exit(-1)

    ## temporary hack to rectify excitation direction
    #P1 = numpy.array(FDTDobj.excitation_list[0].P1)
    #P2 = numpy.array(FDTDobj.excitation_list[0].P2)
    #Pdiff = P2-P1
    #Pdiff = list(Pdiff)
    #exc_dir = Pdiff.index(max(Pdiff))
    #if exc_dir == 0:
    #FDTDobj.excitation_list[0].E = [1,0,0]
    #elif exc_dir == 1:
    #FDTDobj.excitation_list[0].E = [0,1,0]
    #elif exc_dir == 2:
    #FDTDobj.excitation_list[0].E = [0,0,1]
    #else:
    #print('ERROR: wrong exc_dir = '+str(exc_dir)+' Pdiff = '+str(Pdiff), file=sys.stderr)
    #sys.exit(-1)

    # temporary hack to disable frequency snaphsots
    #FDTDobj.clearFrequencySnapshots()
    #FDTDobj.clearTimeSnapshots()

    # Add full X,Y,Z central snapshots for reference
    pos = FDTDobj.box.getCentro()

    for i in [0, 1]:
        letter = ['X', 'Y', 'Z'][i]
        #e = FDTDobj.addEpsilonSnapshot(letter,pos[i])
        #e.name = 'central.'+letter+'.eps'
        #e.first = 1
        #e.repetition = FDTDobj.flag.iterations + 1 # So that only one epsilon snapshot is created. We don't need more.
        f = FDTDobj.addFrequencySnapshot(letter, pos[i])
        f.name = 'central.' + letter + '.fsnap'
        f.first = arguments.first
        f.repetition = arguments.repetition
        f.starting_sample = arguments.starting_sample
        f.frequency_vector = frequency_vector
        full_list.append(f)

    print(full_list)
    list_1 = full_list[0:len(full_list) // 2]
    list_2 = full_list[len(full_list) // 2:len(full_list)]

    if arguments.outdir is None:
        print('ERROR: no outdir specified', file=sys.stderr)
        sys.exit(-1)

    if arguments.basename is None:
        arguments.basename = os.path.basename(os.path.abspath(
            arguments.outdir))

    # hack: remove epsilon snapshots and probes to increase speed
    FDTDobj.clearAllSnapshots()
    FDTDobj.clearEpsilonSnapshots()
    FDTDobj.clearProbes()

    FDTDobj.fileList = []

    destdir = os.path.join(arguments.outdir, './part_1')
    FDTDobj.snapshot_list = list_1
    FDTDobj.writeAll(destdir, arguments.basename)
    FDTDobj.writeShellScript(destdir + os.path.sep + arguments.basename +
                             '.sh',
                             arguments.basename,
                             arguments.executable,
                             '$JOBDIR',
                             WALLTIME=arguments.walltime)

    destdir = os.path.join(arguments.outdir, './part_2')
    FDTDobj.snapshot_list = list_2
    FDTDobj.writeAll(destdir, arguments.basename)
    FDTDobj.writeShellScript(destdir + os.path.sep + arguments.basename +
                             '.sh',
                             arguments.basename,
                             arguments.executable,
                             '$JOBDIR',
                             WALLTIME=arguments.walltime)

    return
Exemple #4
0
def process(maindir,
            destdir,
            overwrite,
            dry_run,
            disabled_epsilon=False,
            disabled_directions=[]):
    print('maindir = {}'.format(maindir))
    print('destdir = {}'.format(destdir))
    print('overwrite = {}'.format(overwrite))
    print('dry_run = {}'.format(dry_run))
    print('disabled_epsilon = {}'.format(disabled_epsilon))
    print('disabled_directions = {}'.format(disabled_directions))

    for direction in ['Ex', 'Ey', 'Ez']:

        if direction not in disabled_directions:
            # get the frequency list, to fail quickly in case of problems
            flist = os.path.join(maindir, direction, 'frequency-selection.txt')
            freq_MHz_list = getFrequencies(flist)

        # read in base file
        infile = os.path.join(maindir, direction, 'RCD111.in')
        sim = readBristolFDTD(infile, verbosity=0)
        sim.setFileBaseName('RCD111')
        # clean sim
        sim.clearProbes()
        sim.clearAllSnapshots()
        sim.clearFileList()

        # get excitation location
        excitation = sim.getExcitations()[0]
        excitation_location = excitation.getLocation()

        # get min/max param values
        dt = sim.getTimeStep()
        time_offset = max(
            excitation.getTimeOffset(),
            MIN_TIME_OFFSET_TIME_CONSTANT_RATIO * excitation.getTimeConstant())
        starting_sample_min = int(
            ceil((time_offset + MIN_TIME_OFFSET_TIME_CONSTANT_RATIO *
                  excitation.getTimeConstant()) / dt))
        #print(dt)
        #print(starting_sample_min)
        Npoints_per_period_min = int(
            floor((1 / excitation.getFrequencyMax()) / dt))
        #print(Npoints_per_period_min)
        repetition_min_1 = int(
            ceil((MIN_SAMPLINGTIME_MAXPERIOD_RATIO /
                  excitation.getFrequencyMin()) / dt))
        repetition_min_2 = int(
            ceil(
                (MIN_NFFT_POINTS_IN_EXCITATION_RANGE /
                 (excitation.getFrequencyMax() - excitation.getFrequencyMin()))
                / dt))
        #print(repetition_min_1)
        #print(repetition_min_2)

        first_min = starting_sample_min + max(repetition_min_1,
                                              repetition_min_2)
        #print(first_min)

        repetition = max([repetition_min_1, repetition_min_2] + REPETITION)
        starting_sample = max([starting_sample_min] + STARTING_SAMPLE)
        first = max([starting_sample + repetition] + FIRST)

        print('starting_sample = {}, first = {}, repetition = {}'.format(
            starting_sample, first, repetition))

        #print('starting_sample = {}'.format(starting_sample))
        #print('first = {}'.format(first))
        #print('repetition = {}'.format(repetition))

        # set up the volume box
        partial_box = SnapshotBoxVolume()

        # set up the XYZ box
        xyz_box = SnapshotBoxXYZ()
        xyz_box.setIntersectionPoint(excitation_location)

        # MV box size is chosen so that it will cover 1+2*47 = 95 mesh lines (we want Nsnaps<=99, but that includes 3 x/y/z snaps)
        xmesh = sim.getXmesh()
        (idx, val) = findNearestInSortedArray(xmesh, excitation_location[0], 0)
        MV_box_size = (xmesh[idx + 42] + xmesh[idx + 43]) / 2 - (
            xmesh[idx - 42] + xmesh[idx - 43]) / 2
        print('MV_box_size = {} = {}*sim.getSize()'.format(
            MV_box_size, MV_box_size / (sim.getSize()[0])))

        # set up base frequency snapshot (we need two at the moment because one has full extension and the other one does not)
        fsnap_base_partial = FrequencySnapshot()
        fsnap_base_partial.setCentro(excitation_location)
        fsnap_base_partial.setSize([MV_box_size, MV_box_size, MV_box_size])
        fsnap_base_partial.setPlaneOrientationX()
        fsnap_base_partial.setFullExtensionOn()
        fsnap_base_partial.setStartingSample(starting_sample)
        fsnap_base_partial.setFirst(first)
        fsnap_base_partial.setRepetition(repetition)

        fsnap_base_full = FrequencySnapshot()
        fsnap_base_full.setFromSnapshot(fsnap_base_partial)
        fsnap_base_full.setFullExtensionOn()
        #fsnap_base_full.setCentro(excitation_location)
        #fsnap_base_full.setSize(MV_box_size)
        #fsnap_base_full.setPlaneOrientationX()

        # custom snapshots
        fsnap_custom = FrequencySnapshot()
        fsnap_custom.setPlaneOrientationZ()
        fsnap_custom.setFullExtensionOn()
        fsnap_custom.setStartingSample(starting_sample)
        fsnap_custom.setFirst(first)
        fsnap_custom.setRepetition(repetition)

        f1 = copy.deepcopy(fsnap_custom)
        f1.setCentro([6.216506, 6.216506, 1.121651E+01])
        f2 = copy.deepcopy(fsnap_custom)
        f2.setCentro([6.216506, 6.216506, 1.021651E+01])
        f3 = copy.deepcopy(fsnap_custom)
        f3.setCentro([6.216506, 6.216506, 9.216510E+00])
        f4 = copy.deepcopy(fsnap_custom)
        f4.setCentro([6.216506, 6.216506, 8.216510E+00])
        f5 = copy.deepcopy(fsnap_custom)
        f5.setCentro([6.216506, 6.216506, 7.216510E+00])
        #   f6 = copy.deepcopy(fsnap_custom); f6.setCentro([6.216506,6.216506,6.216510E+00])
        f7 = copy.deepcopy(fsnap_custom)
        f7.setCentro([6.216506, 6.216506, 5.216510E+00])
        f8 = copy.deepcopy(fsnap_custom)
        f8.setCentro([6.216506, 6.216506, 4.216510E+00])
        f9 = copy.deepcopy(fsnap_custom)
        f9.setCentro([6.216506, 6.216506, 3.216510E+00])
        f10 = copy.deepcopy(fsnap_custom)
        f10.setCentro([6.216506, 6.216506, 2.216510E+00])
        f11 = copy.deepcopy(fsnap_custom)
        f11.setCentro([6.216506, 6.216506, 1.216510E+00])

        if direction == 'Ex':
            # create epsilon run
            outdir_epsilon = os.path.join(destdir, 'epsilon')
            print('outdir_epsilon = {}'.format(outdir_epsilon))

            # set up base epsilon snapshots
            esnap_base_partial = EpsilonSnapshot()
            esnap_base_partial.setFromSnapshot(fsnap_base_partial)

            esnap_base_full = EpsilonSnapshot()
            esnap_base_full.setFromSnapshot(fsnap_base_full)

            #esnap_base_partial.setCentro(excitation_location)
            #esnap_base_partial.setSize(sim.getSize()/2)
            #esnap_base_partial.setPlaneOrientationY()

            ## set up base frequency snapshot
            #fsnap_base = FrequencySnapshot()
            #fsnap_base.setFromSnapshot(esnap_base)

            # attach base snapshots to boxes
            partial_box.setBaseSnapshot(esnap_base_partial)
            xyz_box.setBaseSnapshot(esnap_base_full)
            # add the snapshots
            sim.setSnapshots([partial_box, xyz_box])

            # set up a short simulation
            sim.setIterations(1)
            sim.setWallTime(120)

            # write
            if not dry_run and not disabled_epsilon:
                sim.writeTorqueJobDirectory(outdir_epsilon,
                                            overwrite=overwrite)
                checkSnapshotNumber(os.path.join(
                    outdir_epsilon,
                    sim.getFileBaseName() + '.inp'),
                                    verbose=True)

        if direction not in disabled_directions:
            for freq_MHz in freq_MHz_list:
                print('freq_MHz = {}'.format(freq_MHz))
                wavelength_mum = get_c0() / freq_MHz
                outdir_MV = os.path.join(
                    destdir, direction,
                    'MV-freq-{:.0f}-MHz-lambda-{:.6f}-mum'.format(
                        freq_MHz, wavelength_mum))
                print('outdir_MV = {}'.format(outdir_MV))

                # set snapshot frequency
                fsnap_base_partial.setFrequencies([freq_MHz])
                fsnap_base_full.setFrequencies([freq_MHz])
                fsnap_custom.setFrequencies([freq_MHz])

                # attach base snapshots to boxes
                partial_box.setBaseSnapshot(fsnap_base_partial)
                xyz_box.setBaseSnapshot(fsnap_base_full)
                # add the snapshots
                sim.setSnapshots([
                    partial_box, xyz_box, f1, f2, f3, f4, f5, f7, f8, f9, f10,
                    f11
                ])

                # set up a long simulation
                sim.setIterations(1e9)
                sim.setWallTime(360)

                # write
                if not dry_run:
                    sim.writeTorqueJobDirectory(outdir_MV, overwrite=overwrite)
                    checkSnapshotNumber(os.path.join(
                        outdir_MV,
                        sim.getFileBaseName() + '.inp'),
                                        verbose=True)

    return
Exemple #5
0
def resonance_run(args):
    ''' Copy src to dst with added frequency snapshots from freqListFile '''
    src = os.path.abspath(args.src).rstrip(os.sep)
    dst = os.path.abspath(args.dst).rstrip(os.sep)
    if os.path.isdir(src):
        print(src + ' is a directory')
        sim = bfdtd.readBristolFDTD(src + os.sep + os.path.basename(src) +
                                    '.in')
        if not args.fileBaseName:
            fileBaseName = os.path.basename(src)
    else:
        print(src + ' is not a directory')
        sim = bfdtd.readBristolFDTD(src)
        if not args.fileBaseName:
            fileBaseName = os.path.splitext(os.path.basename(src))[0]

    freqs = getFrequencies(args.freqListFile)

    print('---')
    print('Frequencies:')
    for f in freqs:
        print(f)
    print('---')

    # get src snapshot lists
    (all_time_snapshots, time_snapshots, epsilon_snapshots,
     mode_filtered_probes) = sim.getAllTimeSnapshots()
    fsnap_list = sim.getFrequencySnapshots()

    new_snapshot_list = []

    if args.frequency_to_energy:
        for fsnap in fsnap_list:
            energy_snapshot = bfdtd.EnergySnapshot()
            energy_snapshot.setFromSnapshot(fsnap)
            energy_snapshot.setFrequencies(freqs)
            new_snapshot_list.append(energy_snapshot)

    if args.new_central:
        box = bfdtd.SnapshotBoxXYZ()
        exc = sim.getExcitations()[0]
        if args.intersection_at_P1:
            (P1, P2) = exc.getExtension()
            print('P1 = {}'.format(P1))
            box.setIntersectionPoint(P1)
        else:
            box.setIntersectionPoint(exc.getCentro())
        energy_snapshot = bfdtd.EnergySnapshot()
        energy_snapshot.setFrequencies(freqs)
        box.setBaseSnapshot(energy_snapshot)
        new_snapshot_list.append(box)

    print(new_snapshot_list)
    print(len(new_snapshot_list))

    if args.clearAllSnapshots:
        sim.clearAllSnapshots()
    if args.clearEpsilonSnapshots:
        sim.clearEpsilonSnapshots()
    if args.clearFrequencySnapshots:
        sim.clearFrequencySnapshots()
    if args.clearModeFilteredProbes:
        sim.clearModeFilteredProbes()
    if args.clearTimeSnapshots:
        sim.clearTimeSnapshots()
    if args.clearProbes:
        sim.clearProbes()
    if args.clearGeometry:
        sim.clearGeometry()

    if args.iterations:
        sim.setIterations(args.iterations)

    sim.appendSnapshot(new_snapshot_list)

    exc = sim.getExcitations()[0]
    if args.source_frequency_range:
        exc.setFrequencyRange(*args.source_frequency_range)
    elif args.source_wavelength_range:
        exc.setWavelengthRange(*args.source_wavelength_range)
    elif args.source_frequency_range_from_DBR:
        wavelength, nLow, nHigh = args.source_frequency_range_from_DBR
        obj = geometries.DBR.DBR(wavelength, nLow, nHigh)
        fmin, fmax = obj.getFrequencyRange()
        exc.setFrequencyRange(fmin, fmax)
    elif args.source_frequency_range_max:
        lambda0 = args.source_frequency_range_max
        f0 = get_c0() / lambda0
        delta_f = f0 / 4
        fmin = f0 - delta_f / 2
        fmax = f0 + delta_f / 2
        exc.setFrequencyRange(fmin, fmax)

    print('FrequencyRange = {}'.format(exc.getFrequencyRange()))
    print('WavelengthRange = {}'.format(exc.getWavelengthRange()))
    print('exc.getPeriod() = {}'.format(exc.getPeriod()))
    print('exc.getTimeConstant() = {}'.format(exc.getTimeConstant()))
    print('exc.getPeriod()/exc.getTimeConstant() = {}'.format(
        exc.getPeriod() / exc.getTimeConstant()))

    exc.setStartTime(0)

    sim.printInfo()

    sim.setFileBaseName(fileBaseName)
    sim.setWallTime(args.walltime)
    sim.setAutosetNFrequencySnapshots(10)

    if args.run_source:
        sim.setSizeAndResolution([1, 1, 1], [32, 32, 32])
        sim.getBoundaries().setBoundaryConditionsNormal()
        sim.clearAllSnapshots()
        sim.clearProbes()
        sim.clearGeometry()

        exc = sim.getExcitations()[0]
        exc.setLocation(sim.getCentro())
        exc.setSize([0, 0, 0])

        p = sim.appendProbe(bfdtd.Probe())
        p.setStep(1)
        p.setLocation(exc.getLocation())

        sim.setSimulationTime(sim.getExcitationEndTimeMax())

    sim.writeTorqueJobDirectory(dst)
    #sim.writeAll(dst, fileBaseName)
    #sim.writeShellScript(os.path.join(dst, fileBaseName+'.sh'))

    print(sim.getSnapshots())
    for s in sim.getSnapshots():
        print(s.getName())