def perfect_simulations_from_dirs(dirlist,normlist,species,psiN_to_psi=sentinel,global_term_multiplier=sentinel):
    #for now, assumes that the simulations have been previously finished
    if type(normlist) is not list:
        normlist=[normlist]*len(dirlist)
    if type(species) is not list:
        species=[species]*len(dirlist)
    if psiN_to_psi != sentinel:
        if type(psiN_to_psi) is not list:
            psiN_to_psi=[psiN_to_psi]*len(dirlist)
    if  global_term_multiplier != sentinel:
        if type(global_term_multiplier) is not list:
            global_term_multiplier=[global_term_multiplier]*len(dirlist)
            

    input="input.namelist"
    output="perfectOutput.h5"
    
    i=0
    simuls=[]
    for dir in dirlist:
        input_filename=dir+"/"+input
        output_filename=dir+"/"+output
        norm_filename=normlist[i]
        species_filename=species[i]
        if psiN_to_psi != sentinel:
            psiN_to_psi_filename = psiN_to_psi[i]
        else:
            psiN_to_psi_filename = None
        if global_term_multiplier != sentinel:
            global_term_multiplier_filename = global_term_multiplier[i]
        else:
            global_term_multiplier_filename = None
        
        print species_filename
        print psiN_to_psi_filename
        print global_term_multiplier_filename
        
        simuls.append(normalized_perfect_simulation(input_filename,norm_filename,species_filename,output_filename,psiN_to_psi_filename,global_term_multiplier_filename))
        simuls[i].description=dir
        #simuls[i].species=species
        i=i+1
    return simuls
예제 #2
0
    simul.inputs.charges[index] = Z
    simul.inputs.masses[index] = mHat
    # str_of_array=' '.join(map(str,l))

    simul.inputs.changevar("speciesParameters", "charges", " ".join(map(str, simul.inputs.charges)))
    simul.inputs.changevar("speciesParameters", "masses", " ".join(map(str, simul.inputs.masses)))


# simulation initialization
input_filename = "input.namelist"
norm_filename = "norms.namelist"
species_filename = "species"
psiN_to_psi_filename = "psiAHat.h5"
output_filename = "perfectOutput.h5"

simul = normalized_perfect_simulation(input_filename, norm_filename, species_filename, None, None)
species = simul.species_list
# indicate which index in the above list that corresponds to main ions, impurity ions, and electrons.
# main ions: will have density given by input. Potential calculated from this.
# impurity: will have density given by its eta and the potential
# electron: will be assumed to not violate perfect orderings and thus use inputs.
mI = 0
zI = 1
eI = 2

Tped = 0.9
a = 0.7  # minor radius in meters
xwidth = 0.03  # pedestal width in r

dxdpsiN = drdpsiN_of_r(a, simul)  # generate dr/dpsi_N. Returns a function
upShift_denom = 2
from generate_compatible_profiles import generate_compatible_profiles
from generate_psi_of_r import drdpsiN_of_r


def simul_manipulation(simul,group,field,change):
    #increase field in group by change
    simul.inputs.inputfile[group][field]=simul.inputs.inputfile[group][field]+change    
    simul.inputs.changevar(group,field,simul.inputs.inputfile[group][field])


#simulation initialization
input_filename="input.namelist"
norm_filename="norms.namelist"
output_filename="perfectOutput.h5"

original_simul=normalized_perfect_simulation(input_filename,norm_filename,None)
original_simul.species=["d","N","e"]


Tped=0.9
mI=0
zI=1
eI=2
a=0.7 #minor radius in meters
xwidth=0.03 #pedestal width in r
imp_conc=0.01 #factor relating impurity and main ion concentration at pedestal top
dxdpsiN=drdpsiN_of_r(a,original_simul) #generate dr/dpsi_N. Returns a function


Tped_e=0.9
dTCoredx_e=-0.1*Tped_e/xwidth