{"id":404,"date":"2018-04-17T08:26:59","date_gmt":"2018-04-17T08:26:59","guid":{"rendered":"https:\/\/sparx.tiara.sinica.edu.tw\/?p=404"},"modified":"2018-04-17T08:28:34","modified_gmt":"2018-04-17T08:28:34","slug":"the-preprocessor-presparx","status":"publish","type":"post","link":"https:\/\/sparx.tiara.sinica.edu.tw\/2018\/04\/17\/the-preprocessor-presparx\/","title":{"rendered":"The Preprocessor: PRESPARX"},"content":{"rendered":"
The command “presparx” can show the usage<\/p>\n
$ presparx<\/span>\r\npresparx -o<\/span> <<\/span> Output File ><\/span>\r\n -e<\/span> :<\/span> error estimation \r\n -p<\/span> :<\/span> profile plot\r\n -v<\/span> :<\/span> generate vtk file\r\n<\/pre>\n-o : the filename of the HDF data for SPARX input
\n-e : estimate the error of mass and the largest velocity dispersion
\n-p : generate a simple plot of the physical profile
\n-v : generate the VTK file for visualization purpose<\/p>\n
grid.py for an example of a\u00a0spherical 1D uniform grid<\/p>\n
# Grid Type : SPH1D \/ SPH3D \/ CYL3D \/REC3D \/ REC1D<\/span>\r\nGridType =<\/span> 'SPH1D'<\/span>\r\n# spacing type : uniform \/ stretch<\/span>\r\nspacing =<\/span> 'uniform'<\/span>\r\n# resolution of the radius<\/span>\r\nnr =<\/span> 64<\/span>\r\n# inner radius (pc)<\/span>\r\nRin =<\/span> 0.0<\/span>\r\n# outer radius (pc)<\/span>\r\nRout =<\/span> 0.1<\/span>\r\n<\/pre>\nmodel.py for an example of Shu’s 1D collapsing cloud<\/p>\n
# Model Type : Function \/ Constant \/ TABLE \/ ZEUS <\/span>\r\nModelType =<\/span> 'Function'<\/span>\r\n\r\n# Molecule<\/span>\r\nmolec =<\/span> 'hco+'<\/span>\r\n# CMB temperature (Kelvin, outer B.C.)<\/span>\r\nT_cmb =<\/span> 2.73<\/span>\r\n# inner Boundary condition<\/span>\r\nT_in =<\/span> 0.0<\/span>\r\n# reference radius<\/span>\r\nr_ref =<\/span> 0.01<\/span>\r\n# reference H2 number density (m^-3)<\/span>\r\nn_H2_ref =<\/span> 1e10<\/span>\r\n# reference velocity (m\/s)<\/span>\r\nV_ref =<\/span> -<\/span>200.0<\/span>\r\n\r\n# Gas Density (number\/m^3)<\/span>\r\ndef<\/span> Density1D(<\/span>r)<\/span>:<\/span>\r\n n_H2 =<\/span> n_H2_ref *<\/span> (<\/span> r \/<\/span> r_ref )<\/span>**<\/span>-<\/span>2.<\/span>\r\n return<\/span> n_H2\r\nclass<\/span> model:<\/span>\r\n def<\/span> __init__<\/span>(<\/span>self,<\/span>r)<\/span>:<\/span>\r\n # Gas Density (number\/m^3)<\/span>\r\n self.<\/span>n_H2 =<\/span> Density1D(<\/span>r)<\/span>\r\n # Velocity (m\/s)<\/span>\r\n self.<\/span>Vr =<\/span> V_ref *<\/span> (<\/span> r \/<\/span> r_ref )<\/span>**<\/span>-<\/span>0.5<\/span>\r\n # Temperature (Kelvin)<\/span>\r\n self.<\/span>T_k =<\/span> 10.<\/span>\r\n # turbulent speed (m\/s)<\/span>\r\n self.<\/span>Vt =<\/span> 200.<\/span>\r\n # Molecular Abundance (fraction)<\/span>\r\n self.<\/span>X_mol =<\/span> 1e-9<\/span>\r\n # dust-to-gas ratio<\/span>\r\n self.<\/span>dust_to_gas =<\/span> 0.01<\/span>\r\n # Dust Temperature (Kelvin)<\/span>\r\n self.<\/span>T_d =<\/span> self.<\/span>T_k\r\n # dust kappa<\/span>\r\n self.<\/span>kapp_d =<\/span> 'table,jena_thin_e5'<\/span>\r\n<\/pre>\nCommand “presparx” and specify the model file name.
\nAppend “-epv” to check out the error, profile plot, and the VTK file<\/p>\n
$ presparx -o model -epv<\/span>\r\nAnalytical Mass :<\/span> 0<\/span>.<\/span>103706<\/span> Msun\r\nMass Error of the Gridding :<\/span> 0<\/span>.<\/span>640518<\/span> %\r\nLargest Velocity Dispersion to Turbulent Velocity :<\/span> 1<\/span>.<\/span>512118<\/span>\r\nLargest Dispersion occurs at spatial index =<\/span> 0<\/span>\r\nprofile.png generated\r\nvisual.vtk generated\r\nwrote out \"model\"<\/span>\r\n<\/pre>\nThe options “-p” and “-v” would generate a figure ‘profile.png’ and a VTK file ‘visual.vtk’. The profile of this model is shown as below
\n
<\/p>\n","protected":false},"excerpt":{"rendered":"
The command “presparx” can show the usage $ presparx presparx -o < Output File > -e : error estimation -p : profile plot -v : generate vtk file -o : the filename of the HDF data for SPARX input -e… <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/sparx.tiara.sinica.edu.tw\/wp-json\/wp\/v2\/posts\/404"}],"collection":[{"href":"https:\/\/sparx.tiara.sinica.edu.tw\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sparx.tiara.sinica.edu.tw\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sparx.tiara.sinica.edu.tw\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sparx.tiara.sinica.edu.tw\/wp-json\/wp\/v2\/comments?post=404"}],"version-history":[{"count":2,"href":"https:\/\/sparx.tiara.sinica.edu.tw\/wp-json\/wp\/v2\/posts\/404\/revisions"}],"predecessor-version":[{"id":406,"href":"https:\/\/sparx.tiara.sinica.edu.tw\/wp-json\/wp\/v2\/posts\/404\/revisions\/406"}],"wp:attachment":[{"href":"https:\/\/sparx.tiara.sinica.edu.tw\/wp-json\/wp\/v2\/media?parent=404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sparx.tiara.sinica.edu.tw\/wp-json\/wp\/v2\/categories?post=404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sparx.tiara.sinica.edu.tw\/wp-json\/wp\/v2\/tags?post=404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}