Commit b7213edc authored by NUNEZ Arturo's avatar NUNEZ Arturo

Automatic commit lundi 13 août 2018, 16:30:01 (UTC+0200)

parent 174605db
This diff is collapsed.
This diff is collapsed.
......@@ -58,7 +58,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 3,
"metadata": {
"collapsed": false
},
......@@ -69,7 +69,7 @@
"text": [
"loading Dark matter..\n",
"centering\n",
"done r200 = 227.9296875\n"
"done r200 = 205.6640625\n"
]
}
],
......@@ -89,7 +89,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 4,
"metadata": {
"collapsed": true
},
......@@ -107,7 +107,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 5,
"metadata": {
"collapsed": false
},
......@@ -116,7 +116,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"2E_kin = 3.0329e+16 m_sun kms² s⁻²\n"
"2E_kin = 2.4945e+16 m_sun kms² s⁻²\n"
]
}
],
......@@ -134,18 +134,20 @@
},
{
"cell_type": "code",
"execution_count": 54,
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(array([], dtype=int64),)\n",
"first simplification from Shapiro2004\n",
" E_pot = -3.9727e+16 m_sun km² s⁻²\n"
"ename": "NameError",
"evalue": "name 'myG' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-6-046a68d97f3b>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mm_i\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmyDMO\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmass\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mr_sorted\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mr_i\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmyDMO\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mr\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mr_sorted\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1e-2\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mmyDMO\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpctocm\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;31m# in km\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0mU\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msum\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0mmyG\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mM_i\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mm_i\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0mr_i\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6\u001b[0m \u001b[0mfi\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwhere\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mr_i\u001b[0m\u001b[0;34m<\u001b[0m\u001b[0;36m0.19\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;32mprint\u001b[0m \u001b[0mfi\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mNameError\u001b[0m: name 'myG' is not defined"
]
}
],
......@@ -162,45 +164,29 @@
},
{
"cell_type": "code",
"execution_count": 44,
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"4.53758186497e-39\n"
]
}
],
"outputs": [],
"source": [
"print myGkpc"
]
},
{
"cell_type": "code",
"execution_count": 47,
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"4.53758186497e-39\n"
]
}
],
"outputs": [],
"source": [
"print myGkpc"
]
},
{
"cell_type": "code",
"execution_count": 55,
"execution_count": null,
"metadata": {
"collapsed": true
},
......@@ -212,11 +198,23 @@
},
{
"cell_type": "code",
"execution_count": 62,
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"ename": "NameError",
"evalue": "name 'myGkpc' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-7-48d0e15a70bb>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0mpos\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmyDMO\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpos3d\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreshape\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmyDMO\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpos3d\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mdtype\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfloat32\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mok\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0macc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mPhy\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mCF\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetGravity\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpos\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mmyDMO\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmass\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m0.090\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mG\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmyGkpc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mNameError\u001b[0m: name 'myGkpc' is not defined"
]
}
],
"source": [
"pos = np.array(myDMO.dm.pos3d.reshape(len(myDMO.dm.pos3d)*3),dtype=np.float32)\n",
"ok, acc, Phy = CF.getGravity(pos,myDMO.dm.mass,0.090,G=myGkpc)"
......@@ -299,7 +297,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 20,
"metadata": {
"collapsed": false
},
......@@ -311,8 +309,8 @@
"loading Dark matter..\n",
"loading Stars..\n",
"loading Gas..\n",
"36844.594\n",
"[20418.88714131 17567.72033332 17124.40448217]\n",
"36837.902\n",
"[20415.17962488 17564.52714926 17121.29102275]\n",
"| r_200 = 212.70\n",
"| Diagonal matrix computed \n",
"| | 20, 0, 0|\n",
......@@ -331,7 +329,97 @@
"nucenter = nbe.real_center(myhydro.dm.pos3d[zoom_reg], myhydro.dm.mass[zoom_reg])\n",
"print nucenter\n",
"myhydro.center_shift(nucenter)\n",
"myhydro.r_virial(600,n=25)\n"
"myhydro.r_virial(600,n=2)\n"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"pos_dm = np.array(myhydro.dm.pos3d.reshape(len(myhydro.dm.pos3d)*3),dtype=np.float32)\n",
"pos_gs = np.array(myhydro.gs.pos3d.reshape(len(myhydro.gs.pos3d)*3),dtype=np.float32)\n",
"pos_st = np.array(myhydro.st.pos3d.reshape(len(myhydro.st.pos3d)*3),dtype=np.float32)\n",
"pos = np.concatenate((pos_dm, pos_st))#, pos_gs))\n",
"mass = np.concatenate((myhydro.dm.mass,myhydro.st.mass))#,myhydro.gs.mass))\n",
"v = np.concatenate((myhydro.dm.v,myhydro.st.v))#,myhalo.gs.v))\n"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"pos3d = pos.reshape(len(pos)/3,3)\n",
"r = np.sqrt(pos3d[:,0]**2 + pos3d[:,1]**2 +pos3d[:,2]**2)\n",
"inside_halo = np.where(r<(myhydro.r200))\n",
"r_sorted = np.argsort(r)\n",
"M_i = np.cumsum(mass[r_sorted]) - mass[r_sorted]\n",
"m_i = mass[r_sorted]\n",
"r_i = r[r_sorted]*(1e-2*myhydro.p.pctocm)# in km\n",
"U = np.sum(-myGkm*M_i*m_i/r_i)\n"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"-4.1098533e+16"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"U\n"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2.330e+13\n"
]
}
],
"source": [
"gas_in = np.where(myhydro.gs.r<myhydro.r200)\n",
"mH= 1.66e-24\n",
"gamma = 1.66\n",
"temp = ((1e6 * mH /1.38e-23)*myhydro.p.simutokms**2*myhydro.gs.temp)*(gamma-1)/myhydro.gs.rho\n",
"print \"{0:.3e}\".format(np.sum(temp[gas_in]))\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"print tem"
]
},
{
......@@ -488,7 +576,7 @@
},
"outputs": [],
"source": [
"K_thermal_gas = np.sum(myhalo.gs.mass[myhalo.gs.r<myhalo.r200]*myhalo.gs.temp[myhalo.gs.r<myhalo.r200])*(3./2.)"
"K_thermal_gas = np.sum(myhydro.gs.mass[myhalo.gs.r<myhalo.r200]*myhalo.gs.temp[myhalo.gs.r<myhalo.r200])*(3./2.)"
]
},
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment