input: module of Hdust input tools
PyHdust input module: Hdust input tools.
Definitions on Classes: - fname: is the original file for reference (kept as stated in the input). The following variables are defined based on the fname. - proj: directory to the project (mandatory) - modn: ‘modn’ structure - suf: only the suffix. - one use Class.set_fname(fname) to update everything. - convention is to use “_” as separador. So, use “-” for a given name, as for the projects.
- co-author:
Rodrigo Vieira
- license:
GNU GPL v3.0 https://github.com/danmoser/pyhdust/blob/master/LICENSE
- class pyhdust.input.Disk(fname=None, proj=None)[source]
Disk class
- set_disk(renv=18.6, mh=1.5, ht=60.0, nr=2.0, dval=1000000000000.0, hseq=False, alpha=0.5, mu=0.5, R0r=100, vt=0.0, denstype=None)[source]
set_disk() set the parameters below for the disk HDUST input configuration.
- Parameters:
renv (float) – Envelope/Disk radius (or Rd)
mh (float) – r^mh is the dependence of the disk scale height
ht (float) – Either the absolute temperature (if ht > 1000), or the relative polar temperature
nr (float) – r^-nr is the density radius dependence
dval (float) – value of the base density (see below)
denstype (str) – one of the following: [‘n0’, ‘sig0’, ‘mdot’];
sig0
means g/cm2 instead ofn0
hseq (bool) – self-consistent vertical scale-height
alpha (float) – Shakura-Sunyaev viscosity parameter
mu (float) – mean molecular weight
R0r (float) – R0r >> Rd typically
vt (float) – Turbulence velocity
- Returns:
The parameters defined appropriately.
- Return type:
(self.parameters)
- class pyhdust.input.Input(fname=None, proj=None)[source]
Input class; no fname (ie., specific suf/model defined)
Criado no novo make_inpjob.
Terminando verificação de existência prévia de *.inp e *.sed2
Incluído verificação do *_SEI.sed2
- set_Be_source(**kwargs)[source]
Define self.source from “_Be_…(end)” in self.suf
- self.source: str, optional
Source name that goes inside “.inp” file
- set_input(docasesl=None, case1='step1', case2='step1_refine', case3l=None, imagesl=None, composition='pureH', controls='controls', gridcells='grid', observers='observers', perturbations='', source='', chkout=True, c1max=20, c2max=24, c3prefl=None, clustl=None, ncore=48, walltime='72:00:00', email='$USER@localhost', touch=False)[source]
set_input() set the parameters below for the disk HDUST ‘.inp’ configuration.
- Parameters:
docasesl (list) – cases [1, 2, 3]
case[1|2] (str) – simulation filename for case[1|2] (eg., ‘step1’)
case3l – list of case3 simulations (eg., [‘SED’, ‘Halpha’])
imagesl – list of images for case simulations (eg., [‘SED’, ‘’])
source – source star filename. If self.suf has Be_, this is will be automatically generated if empty.
- Returns:
The parameter defined appropriately.
- Return type:
(self.parameters)
- write_job(**kwargs)[source]
The parameters can be set with kwargs :param self.proj: Name of the project (eg., BeStar) :type self.proj: str :param self.clustl: List of strings of the clusters (eg., [‘job’, ‘oar’, ‘bat’]) :type self.clustl: list :param self.touch: Touch files to avoid user permission problems (**TBD) :type self.touch: bool
- Returns:
at TBC
- Return type:
(file written)
- pyhdust.input.check_inp(mods=None, step1=['step1', 20], step1_ref=['step1_refine', 30], cust_sim=[['SED', 'SED']], ignore_comm=True)[source]
To be executed in the PROJECT folder.
mods
= array of model folders. Ex: [“mod01”, “mod02”].None
do it for all.cust_sim
= specifies a pair of simulation-prefix to be check (by default, these are equal).ignore_comm
= ignore already comments simulations inputs.WARNING: It assumes that SUFFIX inside inp file is consistent with the filename. The function also removes the
*.oar
and*.job
files.
- pyhdust.input.makeCSGrid_bistabWind1Dust(modn='01', renv=[18.6], rcs=[5.0], dm_dOmega=[1.5e-05], v_0=[10.0], v_inf=[1200.0], beta_v=[2], A1=[49], A2=[-0.7], A3=[0.0], m_dth=[92.0], grain_dust_ratio=[200.0], grain_dens=[1.0], selsources='*', path=None)[source]
Great a CS Grid for HDUST for wind+dust shell (1) both in bi-stability
Based on Carciofi+2010 and used in the B[e] grid between IAG/ON (Brazil).
- Parameters:
arg1 (int, float,...) – the first value
arg2 (int, float,...) – the first value
- Returns:
arg1/arg2 +arg3
- Return type:
int, float
- Example:
>>> import template >>> a = template.MainClass1() >>> a.function1(1,1,1) 2
Note
can be useful to emphasize important feature
See also
MainClass2
Warning
arg2 must be non-zero.
- pyhdust.input.makeDiskGrid(modn='01', mhvals=[1.5], hvals=[60.0], rdvals=[18.6], mvals=[2.0], sig0vals=[1.0], convSig2Rho=False, doFVDD=False, sBdays=None, sBfiles=None, selsources='*', alpha=0.5, mu=0.5, R0r=300, Mdot11=False, path=None)[source]
- ###CONFIG. OPTIONS#MODEL NUMBERmodn = ‘02’#The following filter will be applied to the SOURCE selection (string# fmt)selsources = ‘*’#SUPERFICIAL DENSITY PROFILE EXPONENTmvals = [1.5,2.0,2.5,3.0]#VERTICAL DENSITY PROFILE EXPONENTmhvals = [1.5]#FRACTION OF TEFF OF PRIMARY STAR#This parameter sets if it you be FIXED to OB=1.1 casehvals = [72.]#DISK RADIUS EQUATORIAL…rdvals = [30.]#SIGMA_0 VALUESsig0vals = _np.logspace(_np.log10(0.02),_np.log10(4.0),7)#Do the Full VDD model for the corresponding sig0?doFVDD = Truealpha = 0.5mu = 0.5#WARNING: it only generates a single R0 value per batch. If you want to# change it, run it twice (or more)R0r = 300###END CONFIG.Mdot11 = TODOWARNING: if convSig2Rho=True, the routine assumes
sig0vals
containsrho0vals. For that, (sBfiles==None or sBdays==None) and doFVDD==False.
- pyhdust.input.makeImageLine(baseimgs, Rs, vorb_factor, Ms, Ws, ts, lsuffix, path='source/')[source]
- basesims = [‘simulation/Brg.txt’,’simulation/Ha.txt’]Rs = [12000, 20000]Ms = [3., 4., 5., 7., 9., 12., 15., 20.]Ws = [0.5, 0.75, 0.85, 0.92, 0.99]suffix = ‘Z0.014_bE_Ell’
- pyhdust.input.makeInpJob(modn='01', nodes=512, simulations=['SED'], basesims=[''], docases=[1, 3], sim1='step1', sim2='step1_ref', composition='pureH', controls='controls', gridcells='grid', observers='observers', oldstp1=True, images=[''], baseimgs=[''], perturbations=None, clusters=['job'], srcid='', walltime='24:00:00', wcheck=False, email='$USER@localhost', chkout=False, st1max=20, st1refmax=24, ctrM=False, touch=False, srcNf=None, path=None)[source]
Create INP+JOB files to run Hdust.
All SOURCE files must initiate by “Be_”. Otherwise, the makeInpJob will not work. This is to satisfies the criteria of a specific disk model for each source star.
### Start edit here ### modn = ‘02’
#clusters config # job = AlphaCrucis; oar = MesoCentre Licallo; ge = MesoCentre FRIPP clusters = [‘job’, ‘bat’, ‘oar’, ‘ge’, ‘bgq’, ‘slurm’, ‘slurm_ch’] clusters = [‘oar’] nodes = 48 #if wcheck == True, walltime will be AUTOMATICALLY estimated walltime = ‘3:00:00’ wcheck = True email = ‘user@gmail.com’
#Check if the outputs already exist chkout = True #Above the values below, the step1 will be considered done! st1max = 26 st1refmax = 30 #Gera inp+job so’ para o source com ‘1.45’ no nome #Nao funciona caracteres especiais como * ou ? srcid = ‘1.45’ srcid = ‘’ #Se um dos 3 casos nao estiver presente, ele gera input comentado. docases = [1,2,3] #1 = step1 <> Gera inp+job so’ para mod#/mod#.txt #habilita ADDSUFFIX; retira OBSERVERS e IMAGES sim1 = ‘step1’ #2 = step1_refine sim2 = ‘step1_refine’ #3 = outros <> Gera inp+job so’ para mod#/mod#SOURCE.txt (post-proc.) #retira ADDSUFFIX; adiciona OBSERVERS (e talvez IMAGES) simulations = [‘sed’,’h’,’brg’,’halpha’,’uv’] simulations = [‘sed’,’brg_M’,’halpha_M’,’uv’,’j’,’h’,’k’,’l’,’m’,’n’,
‘q1’,’q2’]
simulations = [‘SED’,’Ha’] images = [‘’,’h’,’brg’,’halpha’,’uv’] images = simulations[:] composition = ‘pureH’ controls = ‘no_op’ controls = ‘controls’ ctrM = False gridcells = ‘grid’ observers = ‘obs’ touch = True
- srcNf=[False, True] # False = for continuum bands; True for
# specific simulation files for line profiles or variable photon # numbers SED.
###stop edition here
- pyhdust.input.makeNoDiskGrid(modn, selsources, path=None)[source]
#Create a model list with random disk parameters (“noCS” in filename)
INPUT: modn = ‘01’; selsources = ‘*’ (filter that is applied to the SOURCE selection).
OUTPUT: Files written
- pyhdust.input.makeSimulDens(dbase, basesim, factor=1.0)[source]
Sets the SED simulations number of photons so that the signal/noise level is approximately constant at visible polarization.
|dbase = _np.logspace(_np.log10(0.02),_np.log10(4.0),7) |basesim = ‘simulation/sed.txt’
- pyhdust.input.makeSimulLine(basesims, Rs, hwidth, Ms, Obs, lsuffix, path='source/')[source]
- vrots = [[167.023,229.187,271.072,301.299,313.702],[177.998,244.636,290.596,324.272,338.298],[192.612,267.017,318.288,355.320,370.638],[202.059,281.667,335.158,373.716,389.782],[209.244,292.409,358.626,410.439,430.844],[214.407,297.661,357.799,402.628,420.683]]vrots = [[259.759,354.834,417.792,464.549,483.847],[252.050,346.163,406.388,449.818,468.126],[245.127,336.834,399.983,448.076,467.806],[239.522,329.496,388.734,432.532,450.806],[234.301,321.139,379.297,423.241,441.122],[228.538,313.797,370.343,412.488,429.914],[219.126,299.656,354.547,395.821,413.008],[211.544,288.840,341.081,380.426,396.978],[203.438,279.328,328.666,365.697,380.660],[197.823,268.964,316.901,353.568,368.506],[192.620,262.688,308.208,341.963,356.410],[187.003,255.125,299.737,332.511,346.043]]basesims = [‘simulation/Brg.txt’,’simulation/Ha.txt’]Rs = [12000, 20000]Ms = [4.00,5.00,7.00,9.00,12.00,15.00]Ms = [14.6, 12.5, 10.8, 9.6, 8.6, 7.7, 6.4, 5.5, 4.8, 4.2, 3.8, 3.4]Obs = [1.1,1.2,1.3,1.4,1.45]suffix = ‘H0.30_Z0.014_bE_Ell’
- pyhdust.input.makeSimulLine2(basesims, Rs, hwidth, Ms, Ws, ts, lsuffix, path='source/')[source]
- basesims = [‘simulation/Brg.txt’,’simulation/Ha.txt’]Rs = [12000, 20000]Ms = [3., 4., 5., 7., 9., 12., 15., 20.]Ws = [0.5, 0.75, 0.85, 0.92, 0.99]suffix = ‘Z0.014_bE_Ell’
- pyhdust.input.makeSourceGrid(masses, rps, lums, Ws, betas, path=None, suffix=None)[source]
Arbitrary values (no stellar model info), for the SELF-CONSISTENT RIGID ROTATOR setup.
OUTPUT: The combination of the values of all lists in the path/source/ folder.
Example: 2 of each parameters results in 32 models (2^5)