美文网首页
SOLPS 中间物理量导出 & 粒子平衡统计脚本(python)

SOLPS 中间物理量导出 & 粒子平衡统计脚本(python)

作者: 锅炉工的自我修养 | 来源:发表于2020-04-17 23:46 被阅读0次

output analysis

1. 命名格式

b2npc9_fnax003.dat
    1. b2npc9 mannal 中不存在

2. 涉及物理量

    1. fnax 考虑 He^{+}和He^{2+} and Ar^{+}~Ar^{18+}
    1. fnay ditto
    1. na ditto
    1. resco 连续性方程的残差
    1. sna 粒子源,particle.s^{-1}
    1. b2npc11 ??,只有氘原子
    1. b2npco ?? 只有D、He、Ar原子
    1. b2nph9: heat flux
    • fhex
    • fhey
    • fhix
    • fhiy
    • reshe: 电子热平衡方程残差
    • reshi:离子热平衡方程残差
    • resht:总热平衡残差
    • she:电子热源系数:
      • she(ix,iy,0)+she(ix,iy,1)*te+she(ix,iy,2)*ne+she(ix,iy,3)*ne*te
    • shei:离子热源系数
      • ditto, she \rightarrow shi, te,ne\rightarrowti,ni
    • te
    • ti
    1. b2npmo:动量方程相关
    • flubvx(ix,iy,1:23), vx ??
    • fmox(ix,iy,0:23)
    • fmoy(ix,iy,0:23)
    • resmo(ix,iy,0:ns-1)平行动量方程
    • smb: 平行动量源??
    • smoan:?? 只有D^{+} 10^{-1}有数值
    • smocf:ditto
    • smofrea:ditto
    • smofria: ditto
    • smotfea:ditto
    • smotfia:ditto
    • smovh:只有离子
    • smovv:径向速度??ditto
    • ua(ix,iy,0:23):平行速度
    • ue:平行电子速度
    1. b2npp7
    • fchx:极向电流
    • fchy:径向电流
    • po:电势
    • respo(ix,iy):电子电势方程残差
    • sch(ix,iy,0:3)电子电离源系数
      • sch(,0)+sch(,1)*po+sch(,2)*ne+sch(,3)*ne*po
    1. b2sigp:计算平行动量方程右侧压力梯度项
    • smogpi(ix,iy,0:23): 平行动量返程压力梯度源项
    • smogpo(ix,iy,0:23):??
    1. b2sihs:计算热方程的源项系数。指定粘滞热流场的散度和电子-原子,原子-原子摩擦
    • she:电子热源项。she(0)+she(1)te+she(2)ne+she(3)nete
    • shedd:??
    • shedu:??
    • shefr:??
    • shi:ditto
    • shidd
    • shidu
    • shifr
    • shiva
    • shivc
    1. b2srdt:为解释隐式时间离散解释的修改源系数
    • shedt:电子热源?
    • shidt:粒子热源?
    • smodt(ix,iy,0:23):平行动量源
    • snadt(ix,iy,0:23):粒子源
    • shest:??
    • shist??
    1. b2stbc_phys:提供由于边界条件引起的的密度源、平行动量源、电子热源,电离源的线性表达式
    • sch:电子电离源
    • she
    • shi
    • smo(ix,iy,0:23)
    • sna(ix,iy,0:23)
    1. b2stbr:提供由于边界条件和中性气体再循环模型引起的的密度源、平行动量源、热源,电离源的线性表达式
    • dab2_eir(0:3)
    • dmb2
    • fatmx(0:3)
    • fatmy(0:3)
    • fmolx(1)
    • fmoly(1)
    • pfluxa(0:3)
    • pfluxm(1)
    • rfluxa(0:3)
    • rfluxm(1)
    • she
    • she_eir
    • shi
    • shi_eir
    • smo_eir(is),只有离子
    • sna_eir ditto
    • tab2_eir只有原子
    • tfluxa_eir 只有原子
    • tfluxm_eir
    • tmb2
    1. b2stcx:提供由于电荷交换密度、平行动量、热源的线性表达式
    • shi
    • smq(is)总的原子物理动量源
    • sna(is)
    1. b2stel:提供由于电子-原子碰撞过程解离的密度、平行动量、电子热、原子热源的线性表达式
    • rqbrm(is):韧致辐射损失
    • rqrad(is):线性辐射
    • she_rad
    • shi_ion
    • shi_rec
    • smq_ion(is)
    • smq_rec(is)
    • sna_ion
    • sna_rec
    1. b2tfhe:计算邻近网格的电子热流,指定线性化系数
    • chcex:指定与左侧网格的热导(-checx*(te(ix,iy)-te(left(ix,iy))
    • chcey,ditto (bottom)
    • cssig_anx:电导 ditto
    • cssig_any:ditto
    • fch_px:极向电流积分
    • fchanmlx:反常电流
    • fchanxly:ditto
    • fchdiax:修改的抗磁电流
    • fchdiay:
    • fchinertx:惯性电流
    • fchinerty:ditto
    • fchinx:粒子-中性摩擦
    • fchiny: ditto
    • fchstochy: 随机电流
    • fchvisparx:平行粘滞驱动的电子电流
    • fchvispary:ditto
    • fchvisperx:ditto
    • fchvispery:ditto
    • fhe_no_mdfx:no_current置1,所有电流为0
    • fhe_no_mdfy:ditto
    • fhePSchx:ditto
    • fhePSchy:ditto
    • qe_32x:电子电量
    • qe_32y:ditto
    • qe_alphaTehx
    • qe_alphaTehy
    • qe_ke_gTx
    • qe_ke_gTy
    • qediax:抗磁电流电量in qe?
    • qediay

    1. b2tfhi:计算所有的原子热流
    • chcix:ditto
    • chciy:ditto
    • fhiPschx:ditto
    • fhix
    • fhiy
    • qi_32x
      image.png
    • qi_32y
    • qi_ki_gTx
    • qi_ki_gTy
    • qidiax
    • qidiay

是否阐释导出求解公式中的某一项?Appendix G

    1. b2tfnb:计算一种原子的粒子流,提供线性项系数
    • bxuanax(ix,iy,0:23)
    • cvlbnay(ix,iy,0:23)
    • dgradpbx(ix,iy,is_atom)
    • dgradpxy(ix,iy,is_atom)
    • dPat_2diagradnax(ix,iy,is_ion
    • dPat_2diagradnay(ix,iy,is_ion)
    • dPat_mdf_gradnax(ix,iy,is_ion)
    • dPat_mdf_gradnay(ix,iy,is_ion)
    • dpccorhznax(ix,iy,is)
    • dpccornnax(ix,iy,is)
    • fchanmlx(ix,iy)
    • fchanmly(ix,iy)
    • fchinertx(ix,iy)
    • fhcinerty(ix,iy)
    • fchvispary(ix,iy)
    • fchvispary(ix,iy)
    • fchvisperx(ix,iy)
    • fchvispery(ix,iy)
    • fchivisqx(ix,iy)
    • fchivisqy(ix,iy)
    • fnb_fcorx(ix,iy,is)
    • fnb_fcory(ix,iy,is)
    • fnb_hex(ix,iy,is) 10^{13}
    • fnb_hey(ix,iy,is)
    • fnbPSchx(ix,iy,is)
    • fnbPSchy(ix,iy,is)
    • fnbx(ix,iy,is):左边界的粒子流
    • fnby(ix,iy,is):与下部网格的粒子流
    • kbnrgy(ix,iy,is)
    • vadianahzx(ix,iy,is_ion):vadia\rightarrow指定有效抗磁漂移速度(沿着磁场方向,映射到极向) x\rightarrow径向
    • vadianahzy(ix,iy,is_ion)
    • vadianax
    • vadianay
    • vaecrbnax(ix,iy,is_ion)
    • vaecrbnay(ix,iy,is_ion)
    • vbdiax(ix,iy,is)
    • vbdiay(ix,iy,is)
    • vbecrbx(ix,iy,is_D+)
    • vbecrby(ix,iy,is_D+)
    • wbdiax(ix,iy,is)
    • wbdiay(ix,iy,is)
    1. b2tqca:计算原子输运系数的经典分布
    • lnlam(ix,iy)
    • taua(ix,iy,is_ion) : \tau
    1. b2qce:电子输运系数,ditto
    • taue(ix,iy)
    1. b2tqna:反常输运对输运系数的贡献
    • alf0(ix,iy,):热电子系数的径向和极向
    • dna(ix,iy,is):输运系数,对应的粒子流密度。-dna*grad.na
    • dpa(ix,iy,is):压强驱动的输运系数
    • hece0:电子热反常输运系数
    • hcib(ix,iy,is):离子热反常输运系数
    • sig0:反常电导输运系数
    • vla0y(ix,iy,is):极向反常pinch速度
    1. b2trcl:几何因素对输运系数的影响
    • vsa0(ix,iy,is):反常粘滞系数
    • alfx_c:反常热电子输运系数
    • calfx:热电子系数左侧
    • chcex:指定电子热导
    • chcix:离子热导
    • csigx:左边界的电导
    • cvsahzx(ix,iy,is_ion)
    • luciani_calf_c
    • luciani_calfx
    • luciani_csigx
    • luciani_cvsahzx(ix,iy,is_ion)
    • luciani_fllim_cvsahzx(ix,iy,is):
    • luciani_sigx_c
    • sigx_c
    1. b2trno:包含集合因素影响,计算输运系数
    • cdnax(ix,iy,is_ion):指定离子输运系数,左边界
    • cdnay(ix,iy,is_ion):下边界
    • cdpay(ix,iy,is_atom)
    • cdpay(ix,iy,is_atom)
    • chcex
    • chcey_stoch
    • chcix
    • chiy
    • csigx
    • csigy_stoch
    • csigy
    • cvsahzx(ix,iy,is)
    • cvsahzy(ix,iy,is)
    • cvsax(ix,iy,is)
    • cvsay(ix,iy,is):粒子的粘滞导率
  • b2urmo:计算平行动量方程的残差
    • etaPat_graduax(ix,iy,is_ion)
    • etaPat_graduay(ix,iy,is_ion)

Others

    1. bb:磁场
    1. bbc:??
    1. bbl:
    1. bbr
    1. bbv
    1. bbxc
    1. bbxl
    1. bbxr
    1. bbxv
    1. bbz
    1. bbzc
    1. bbzl
    1. bbzr
    1. bbzv
    1. Ey_neo??
    1. Eyc
    1. Eyf
    1. gsx:左边界相邻面积
    1. gsy
    1. gsz
  • 21.hx:指定网格的x,y,z diameter
    1. hxb
    1. hy
    1. hyl
    1. hz
  • 26.hzb
    1. hzl
    1. kt
    1. leftix/iy or right or bottom or top
    1. len_surf
    1. lengthx
    1. lengthxTrans
    1. lengthy
    1. lengthy1
    1. ne
    1. pbsx:perpsx
    1. po
    1. qc
    1. qz0cost
    1. qz1sint
    1. te/ti_eV
    1. vol
    1. Wsh??
    1. Zeff

Statistic script

    1. energy_flux
    • fenex_mdf
    • feney_mdf
    • fenix_mdf
    • feniy_mdf
    • fenix_physics_pot_2_all_ions
    • feniy_physics_pot_2_all_ions
    1. q_plates


      image.png
      image.png
    • qe
    • qi
    • qei
    • q_target
    1. Total_boundary_particle_fluxes_modifued


      image.png

脚本编写

1. 产生所需数据 eirc fnax


    1. python 调用shell命令

python 调用shell

#!/user/bin/env python
import os
val=os.system('ls -al')
print(val)
echo "phys eirc fnax 'fnax_2D.last10' mprt" | b2plot;mv  b2pl.exe.dir/fnax_2D.last10 2D_data 
    1. 获取当前路径 &字符串拼接
import sys
cwd=sys.path[0]
print(cwd)
full_path= cwd+"/b2pl.exe/fnax_2D.last10"
print(full_path)
    1. 打开jupyter notebook
search cmd
e: # 盘符
cd path
jupyter note


过滤含有指定字符的行

with open(test_path,'r') as f:
        for each in f:
                if "#" not in each:
                        print(each.strip())
    1. 将数据放入矩阵或者list

没有anacoda不能调用numpy库

  • 下载anaconda_linux

清华镜像不快
获得数据源

a=[]
with open(full_path,'r') as f:
        for each in f:
                if "#"  not in each:
                #       print(each.strip())

                        # save the first column
                        #tmp=each.strip()
                        tmp=each.split()[3]
                        a.append(tmp)
        a=np.array(a)
        a.reshape(98,38,-1)
        print(a)

查询官方文档

numpy 官方文档
numpy 详细介绍


matlab中reshape是列优先读取的,python的reshape,存在三种读取循序

image.png
    1. 为保证维度一致:order='F'

anaconda in linux 不能直接显示图片,需要先保存,再打开

image.png

存在的问题,没有按照数值排序

最终框架

#!/user/bin/env python
#coding=utf-8 

import os
import sys
import numpy as np
import matplotlib.pyplot as plt

# ===================== callback the b2plot commands ============================= #
#os.system("echo \"phys eirc fnax 'fnax_2D.last10' mprt \" | b2plot")

# ====================== get current path & string join ========================== #
#cwd=os.getcwd()
#print(cwd)
cwd=sys.path[0]
#print(cwd)

full_path= cwd+"/b2pl.exe.dir/fnax_2D.last10"
a=[]
with open(full_path,'r') as f:
        for each in f:
                if "#"  not in each:
                        # save the first column
                        tmp=each.split()[3]
                        a.append(tmp)
        a=np.array(a)
        a=np.reshape(a,(98,38,-1),order='F') # correspond with matlab script
        #print(a)
        print(a.ndim)
        print(a.size)
        print(a.shape)
        #print(a[:,0,0]) # pass the test of order

# ====================== save data in a list ================== #
ix_div_in=26
f_div=a[ix_div_in-1,:,0]
print(f_div)
print(f_div.shape)

iy=np.array(range(1,39))
print(iy.shape)

# ======================== plot the flux at somewhere ========== # 

plt.plot(iy,f_div,label='$T_{e}$',color='r',linestyle='-',linewidth=1)


plt.savefig('test.eps')


相关文章

网友评论

      本文标题:SOLPS 中间物理量导出 & 粒子平衡统计脚本(python)

      本文链接:https://www.haomeiwen.com/subject/nepuvhtx.html