代码整理

This commit is contained in:
fengmengqi 2026-03-25 18:34:41 +08:00
parent 3416c491ad
commit ddfe08cb93
313 changed files with 2817 additions and 777 deletions

191
fix_imports.py Normal file
View File

@ -0,0 +1,191 @@
import os
import re
# Change to the project directory
os.chdir(r'C:\Users\fmq\Documents\astro\SpectraRust')
# All the Rust source file modules that were moved to subdirectories
# These are the .rs file basenames that are now in subdirs
modules_moved = [
# From opacity/
'allard', 'allardt', 'cia_h2h', 'cia_h2h2', 'cia_h2he', 'cia_hhe',
'compt0', 'corrwm', 'cspec', 'dopgam', 'dwnfr', 'dwnfr0', 'dwnfr1',
'gvdw', 'inifrc', 'inifrs', 'inifrt', 'inilam', 'inkul', 'inpdis',
'lemini', 'levgrp', 'levset', 'levsol', 'linpro', 'linsel', 'linspl',
'lymlin', 'meanop', 'meanopt', 'profil', 'profsp', 'quasim', 'rayleigh',
'rayset', 'reflev', 'reiman', 'stark0', 'starka', 'prd', 'prdini',
# From hydrogen/
'bhe', 'bre', 'brez', 'brte', 'brtez', 'colh', 'colhe', 'colis', 'collhe',
'ctdata', 'ghydop', 'h2minus', 'hedif', 'hephot', 'hesol6', 'hesolv',
'hidalg', 'inthyd', 'sbfch', 'sbfhe1', 'sbfhmi', 'sbfhmi_old', 'sbfoh',
'sffhmi', 'sffhmi_add', 'sgmer', 'sgmer1', 'sigave', 'sigk', 'sigmar',
'spsigk', 'szirc',
# From atomic/
'chctab', 'cheav', 'cheavj', 'cion', 'cross', 'dielrc', 'dietot',
'ffcros', 'gfree', 'gntk', 'vern16', 'vern18', 'vern20', 'vern26', 'verner',
# From continuum/
'opacf0', 'opacf1', 'opacfa', 'opacfd', 'opacfl', 'opact1', 'opactd',
'opactr', 'opadd', 'opadd0', 'opahst', 'opaini', 'opctab', 'opdata', 'opfrac',
# From convection/
'concor', 'conout', 'conref', 'contmd', 'contmp', 'convec',
# From eos/
'eldenc', 'eldens', 'entene', 'moleq', 'rhoeos', 'rhonen', 'russel', 'steqeq',
# From interpolation/
'ckoest', 'interp', 'interpolate', 'intlem', 'intxen', 'lagran', 'locate',
'tabint', 'yint', 'ylintp',
# From io/
'getwrd', 'output', 'prchan', 'princ', 'prnt', 'prsent', 'pzert',
'pzeval', 'pzevld', 'quit', 'rdata', 'rdatax', 'readbf', 'rechck',
'timing', 'visini',
# From odf/
'odf1', 'odffr', 'odfhst', 'odfhyd', 'odfhys', 'odfmer',
# From partition/
'carbon', 'ceh12', 'mpartf', 'partf', 'pfcno', 'pffe', 'pfheav',
'pfni', 'pfspec', 'sghe12', 'tiopf',
# From population/
'bpop', 'bpopc', 'bpope', 'bpopf', 'bpopt', 'butler', 'newpop',
# From radiative/
'coolrt', 'radpre', 'radtot', 'rte_sc', 'rteang', 'rtecf0', 'rtecf1',
'rtecmc', 'rtecmu', 'rtecom', 'rtedf1', 'rtedf2', 'rtefe2', 'rtefr1',
'rteint', 'rtesol', 'trmder', 'trmdrt',
# From rates/
'rates1', 'ratmal', 'ratmat', 'ratsp1',
# From solvers/
'accel2', 'accelp', 'cubic', 'indexx', 'laguer', 'lineqs', 'matcon',
'matgen', 'matinv', 'minv3', 'psolve', 'quartc', 'raph', 'rhsgen',
'rybchn', 'rybene', 'rybheq', 'rybmat', 'rybsol', 'solve', 'solves',
'tridag', 'ubeta',
# From special/
'erfcx', 'expint', 'expo', 'gami', 'gamsp', 'gauleg', 'gaunt',
'voigt', 'voigte',
# From temperature/
'elcor', 'grcor', 'greyd', 'lucy', 'osccor', 'rossop', 'rosstd',
'tdpini', 'temcor', 'temper', 'tlocal',
# From utils/
'angset', 'betah', 'bkhsgo', 'change', 'column', 'comset', 'divstr',
'dmder', 'dmeval', 'emat', 'getlal', 'gomini', 'gridp', 'inicom',
'irc', 'newdm', 'newdmt', 'pgset', 'sabolf', 'setdrt', 'state',
'switch', 'topbas', 'traini', 'wn', 'wnstor', 'xk2dop', 'zmrho',
# From ali/
'alifr1', 'alifr3', 'alifr6', 'alifrk', 'alisk1', 'alisk2',
'alist1', 'alist2', 'ijali2', 'ijalis', 'taufr1',
]
# Pattern for single item: use crate::tlusty::math::module::item;
single_pattern = re.compile(
r'use crate::tlusty::math::(' + '|'.join(modules_moved) + r')::(\w+);'
)
# Pattern for multiple items: use crate::tlusty::math::module::{a, b};
multi_pattern = re.compile(
r'use crate::tlusty::math::(' + '|'.join(modules_moved) + r')::\{([^}]+)\};'
)
# Pattern for super::module::item (cross-submodule imports)
super_single_pattern = re.compile(
r'use super::(' + '|'.join(modules_moved) + r')::(\w+);'
)
# Pattern for super::module::{a, b}
super_multi_pattern = re.compile(
r'use super::(' + '|'.join(modules_moved) + r')::\{([^}]+)\};'
)
# Pattern for use super::module; (direct module import)
super_direct_pattern = re.compile(
r'use super::(' + '|'.join(modules_moved) + r');'
)
# Pattern for use super::{module1, module2, ...}
super_brace_pattern = re.compile(
r'use super::\{([^}]+)\};'
)
# Pattern for direct code references: crate::tlusty::math::module::item(
# This catches function calls like crate::tlusty::math::quit::quit_error(
code_ref_pattern = re.compile(
r'crate::tlusty::math::(' + '|'.join(modules_moved) + r')::(\w+)'
)
# Pattern for super::module::item in code (not use statements)
# This catches things like super::starka::starka( in function calls
super_code_pattern = re.compile(
r'super::(' + '|'.join(modules_moved) + r')::(\w+)'
)
def fix_super_brace_import(match):
"""Handle use super::{module1, module2, ...}"""
items = match.group(1)
# Split by comma and process each item
parts = [p.strip() for p in items.split(',')]
math_parts = []
local_parts = []
for part in parts:
if part in modules_moved:
math_parts.append(part)
else:
local_parts.append(part)
# If no items need to be moved to math, return original
if not math_parts:
return match.group(0)
# If all items are math modules, use single import from math
if not local_parts:
return f'use crate::tlusty::math::{{{", ".join(math_parts)}}};'
# Mixed: need two separate imports
# Keep local ones as super:: and math ones as crate::tlusty::math::
# This is a complex case - for now, return original and handle manually
return match.group(0)
def fix_file(path):
try:
with open(path, 'r', encoding='utf-8') as f:
content = f.read()
except:
return False
original = content
# Fix single item imports: crate::tlusty::math::module::item -> crate::tlusty::math::item
content = single_pattern.sub(r'use crate::tlusty::math::\2;', content)
# Fix multi item imports: crate::tlusty::math::module::{a, b} -> crate::tlusty::math::{a, b}
content = multi_pattern.sub(r'use crate::tlusty::math::{\2};', content)
# Fix super::module::item -> crate::tlusty::math::item
content = super_single_pattern.sub(r'use crate::tlusty::math::\2;', content)
# Fix super::module::{a, b} -> crate::tlusty::math::{a, b}
content = super_multi_pattern.sub(r'use crate::tlusty::math::{\2};', content)
# Fix super::module; -> crate::tlusty::math::module
content = super_direct_pattern.sub(r'use crate::tlusty::math::\1;', content)
# Fix super::{module1, module2, ...} -> crate::tlusty::math::{module1, module2, ...}
content = super_brace_pattern.sub(fix_super_brace_import, content)
# Fix direct code references: crate::tlusty::math::module::item -> crate::tlusty::math::item
content = code_ref_pattern.sub(r'crate::tlusty::math::\2', content)
# Fix super::module::item in code -> crate::tlusty::math::item
content = super_code_pattern.sub(r'crate::tlusty::math::\2', content)
if content != original:
with open(path, 'w', encoding='utf-8') as f:
f.write(content)
return True
return False
count = 0
for root, dirs, files in os.walk('src/tlusty'):
for f in files:
if f.endswith('.rs'):
path = os.path.join(root, f)
if fix_file(path):
count += 1
print(f"Fixed: {path}")
print(f"\nTotal files fixed: {count}")

View File

@ -0,0 +1,25 @@
#!/bin/bash
# 批量迁移 acceleration 模块
cd src/tlusty/math
# 创建目录
mkdir -p acceleration/ali
mkdir -p acceleration/convergence
# ali
mv alifr1.rs acceleration/ali
mv alifr3.rs acceleration/ali
mv alifr6.rs acceleration/ali
mv alifrk.rs acceleration/ali
mv alisk1.rs acceleration/ali
mv alisk2.rs acceleration/ali
mv alist1.rs acceleration/ali
mv alist2.rs acceleration/ali
mv ijali2.rs acceleration/ali
mv ijalis.rs acceleration/ali
mv getlal.rs acceleration/ali
mv taufr1.rs acceleration/ali
# convergence
mv accel2.rs acceleration/convergence
mv accelp.rs acceleration/convergence
mv osccor.rs acceleration/convergence
echo "Done"

View File

@ -0,0 +1,46 @@
#!/bin/bash
# 批量迁移 atmosphere 模块
cd src/tlusty/math
# 创建目录
mkdir -p atmosphere/convection
mkdir -p atmosphere/temperature
mkdir -p atmosphere/depth
mkdir -p atmosphere/hydrostatic
mkdir -p atmosphere/grey
mkdir -p atmosphere/odf
# convection
mv convec.rs atmosphere/convection
mv concor.rs atmosphere/convection
mv conout.rs atmosphere/convection
mv conref.rs atmosphere/convection
mv contmd.rs atmosphere/convection
mv contmp.rs atmosphere/convection
# temperature
mv temper.rs atmosphere/temperature
mv temcor.rs atmosphere/temperature
mv tlocal.rs atmosphere/temperature
mv lucy.rs atmosphere/temperature
mv tdpini.rs atmosphere/temperature
# depth
mv newdm.rs atmosphere/depth
mv newdmt.rs atmosphere/depth
mv dmder.rs atmosphere/depth
mv dmeval.rs atmosphere/depth
mv zmrho.rs atmosphere/depth
mv column.rs atmosphere/depth
mv gridp.rs atmosphere/depth
# hydrostatic
mv hesolv.rs atmosphere/hydrostatic
mv hesol6.rs atmosphere/hydrostatic
mv betah.rs atmosphere/hydrostatic
# grey
mv greyd.rs atmosphere/grey
# odf
mv odf1.rs atmosphere/odf
mv odffr.rs atmosphere/odf
mv odfhst.rs atmosphere/odf
mv odfhyd.rs atmosphere/odf
mv odfhys.rs atmosphere/odf
mv odfmer.rs atmosphere/odf
echo "Done"

View File

@ -0,0 +1,35 @@
#!/bin/bash
# 批量迁移 equilibrium 模块
cd src/tlusty/math
# 创建目录
mkdir -p equilibrium/statistical
mkdir -p equilibrium/ionization
mkdir -p equilibrium/partition
mkdir -p equilibrium/level
# statistical
mv rates1.rs equilibrium/statistical
mv ratmat.rs equilibrium/statistical
mv ratmal.rs equilibrium/statistical
mv ratsp1.rs equilibrium/statistical
mv steqeq.rs equilibrium/statistical
mv reflev.rs equilibrium/statistical
mv sabolf.rs equilibrium/statistical
mv newpop.rs equilibrium/statistical
# ionization
mv russel.rs equilibrium/ionization
mv moleq.rs equilibrium/ionization
# partition
mv partf.rs equilibrium/partition
mv mpartf.rs equilibrium/partition
mv pfcno.rs equilibrium/partition
mv pffe.rs equilibrium/partition
mv pfheav.rs equilibrium/partition
mv pfni.rs equilibrium/partition
mv pfspec.rs equilibrium/partition
mv tiopf.rs equilibrium/partition
# level
mv levset.rs equilibrium/level
mv levgrp.rs equilibrium/level
echo "Done"

View File

@ -0,0 +1,11 @@
#!/bin/bash
# 批量迁移 hydrogen 模块
cd src/tlusty/math
# 创建目录
mkdir -p physics/hydrogen
# 移动文件
mv wn.rs physics/hydrogen
mv wnstor.rs physics/hydrogen
echo "Done"

View File

@ -0,0 +1,23 @@
#!/bin/bash
# 批量迁移 io 和 misc 模块
cd src/tlusty/math
# 创建目录
mkdir -p io
mkdir -p utils
# io
mv output.rs io
mv rdata.rs io
mv rdatax.rs io
mv readbf.rs io
mv inkul.rs io
mv timing.rs io
mv getwrd.rs io
mv prchan.rs io
mv princ.rs io
mv prnt.rs io
# utils
mv quit.rs io
mv getwrd.rs utils
echo "Done"

View File

@ -0,0 +1,36 @@
#!/bin/bash
# 批量迁移 linearization 模块
cd src/tlusty/math
# 创建目录
mkdir -p linearization/matrix
mkdir -p linearization/solver
mkdir -p linearization/rybicki
# matrix
mv bhe.rs linearization/matrix
mv bre.rs linearization/matrix
mv brez.rs linearization/matrix
mv bpop.rs linearization/matrix
mv bpopc.rs linearization/matrix
mv bpope.rs linearization/matrix
mv bpopf.rs linearization/matrix
mv bpopt.rs linearization/matrix
mv emat.rs linearization/matrix
mv matcon.rs linearization/matrix
mv matgen.rs linearization/matrix
mv matinv.rs linearization/matrix
mv rhsgen.rs linearization/matrix
# solver
mv solve.rs linearization/solver
mv solves.rs linearization/solver
mv levsol.rs linearization/solver
mv lineqs.rs linearization/solver
mv minv3.rs linearization/solver
mv psolve.rs linearization/solver
# rybicki
mv rybmat.rs linearization/rybicki
mv rybheq.rs linearization/rybicki
mv rybene.rs linearization/rybicki
mv rybchn.rs linearization/rybicki
mv rybsol.rs linearization/rybicki
echo "Done"

19
scripts/migrate_math.sh Normal file
View File

@ -0,0 +1,19 @@
#!//bash
# Math special functions
cd src/tlusty/math && mv expo.rs math/special/
mv expint.rs math/special
mv erfcx.rs math/special
mv gauleg.rs math/special
mv expinx.rs math/special
mv ubeta.rs math/utils
mv lagran.rs math/interpolate
mv laguer.rs math/utils
mv yint.rs math/interpolate
mv ylintp.rs math/interpolate
mv tabint.rs math/interpolate
mv locate.rs math/interpolate
mv indexx.rs math/utils
mv gauleg.rs math/special
mv ubeta.rs math/utils
echo "Created math subdirectories and moved basic math files"

24
scripts/migrate_model.sh Normal file
View File

@ -0,0 +1,24 @@
#!/bin/bash
# 批量迁移 model 模块
cd src/tlusty/math
# 创建目录
mkdir -p model
# 移动文件
mv inilam.rs model
mv inifrc.rs model
mv inifrs.rs model
mv inifrt.rs model
mv inpdis.rs model
mv change.rs model
mv hedif.rs model
mv dwnfr.rs model
mv dwnfr0.rs model
mv dwnfr1.rs model
mv chctab.rs model
mv levset.rs model
mv levgrp.rs model
mv visini.rs model
mv grcor.rs model
echo "Done"

17
scripts/migrate_others.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/bash
# 批量迁移剩余模块
cd src/tlusty/math
# 创建目录
mkdir -p physics/radiative/flux
mkdir -p physics/opacity
mkdir -p physics/opacity
mv brte.rs physics/radiative
mv brtez.rs physics/radiative
mv pzeval.rs physics/radiative
mv pzevld.rs physics/radiative
mv prdin.rs physics/radiative
mv prdini.rs physics/radiative
mv taufr1.rs acceleration/ali
mv raph.rs model
echo "Done"

View File

@ -0,0 +1,7 @@
#!/bin/bash
# Batch迁移 physics/opacity 模块
cd src/tlusty/math && mv opacf0.rs physics/opacity && mv opacf1.rs physics/opacity && mv opacfa.rs physics/opacity && mv opacfd.rs physics/opacity && mv opacfl.rs physics/opacity && mv opadd.rs physics/opacity && mv opadd0.rs physics/opacity && mv opahst.rs physics/opacity && mv opaini.rs physics/opacity && mv opctab.rs physics/opacity && mv opdata.rs physics/opacity && mv opfrac.rs physics/opacity && mv traini.rs physics/opacity
mv meanop.rs physics/opacity && mv meanopt.rs physics/opacity
mv opact1.rs physics/opacity
mv opactd.rs physics/opacity
mv opactr.rs physics/opacity

View File

@ -0,0 +1,47 @@
#!/bin/bash
# 批量迁移 physics/collision 模块
cd src/tlusty/math
# 创建目录
mkdir -p physics/collision/rates
mkdir -p physics/collision/ionization
mkdir -p physics/collision/dielectronic
mkdir -p physics/collision/charge_transfer
mkdir -p physics/collision/broadening
mkdir -p physics/collision/hydrogen
# rates
mv colh.rs physics/collision/rates
mv colhe.rs physics/collision/rates
mv colis.rs physics/collision/rates
mv collhe.rs physics/collision/rates
mv butler.rs physics/collision/rates
mv ceh12.rs physics/collision/rates
mv cheav.rs physics/collision/rates
mv cheavj.rs physics/collision/rates
mv cspec.rs physics/collision/rates
mv sghe12.rs physics/collision/hydrogen
mv sgmer.rs physics/collision/hydrogen
mv sgmer1.rs physics/collision/hydrogen
# ionization
mv cion.rs physics/collision/ionization
mv irc.rs physics/collision/ionization
mv szirc.rs physics/collision/ionization
# dielectronic
mv dielrc.rs physics/collision/dielectronic
mv dietot.rs physics/collision/dielectronic
# charge_transfer
mv ctdata.rs physics/collision/charge_transfer
# broadening
mv gami.rs physics/collision/broadening
mv gamsp.rs physics/collision/broadening
mv gvdw.rs physics/collision/broadening
mv dopgam.rs physics/collision/broadening
mv switch.rs physics/collision/broadening
echo "Done"

View File

@ -0,0 +1,529 @@
#!/bin/bash
# 批迁移 physics/cross_section 模块
cd src/tlusty/math && mv cross.rs physics/cross_section/photoion
mv verner.rs physics/cross_section/photoion
mv vern16.rs physics/cross_section/photoion && mv vern18.rs physics/cross_section/photoion
mv vern20.rs physics/cross_section/photoion
mv vern26.rs physics/cross_section/photoion && mv topbas.rs physics/cross_section/photoion && mv sigk.rs physics/cross_section/photoion && mv sigave.rs physics/cross_section/photoion && mv bkhsgo.rs physics/cross_section/photoion && mv hidalg.rs physics/cross_section/photoion && mv reiman.rs physics/cross_section/photoion && mv hephot.rs physics/cross_section/photoion && mv ckoest.rs physics/cross_section/photoion && mv carbon.rs physics/cross_section/photoion
mv sbfch.rs physics/cross_section/bound_free
mv sbfhe1.rs physics/cross_section/bound_free
mv sbfhmi.rs physics/cross_section/bound_free
mv sbfhmi_old.rs physics/cross_section/bound_free
mv sbfoh.rs physics/cross_section/bound_free
mv ffcros.rs physics/cross_section/free_free
mv sffhmi.rs physics/cross_section/free_free
mv sffhmi_add.rs physics/cross_section/free_free
mv h2minus.rs physics/cross_section/free_free
mv cia_h2h.rs physics/cross_section/cia
mv cia_h2h2.rs physics/cross_section/cia
mv cia_h2he.rs physics/cross_section/cia
mv cia_hhe.rs physics/cross_section/cia
mv rayleigh.rs physics/cross_section/rayleigh && mv rayset.rs physics/cross_section/rayleigh
mv gaunt.rs physics/cross_section/gaunt
mv gfree.rs physics/cross_section/gaunt
mv gntk.rs physics/cross_section/gaunt
mv ghydop.rs physics/cross_section/hydrogen
mv xk2dop.rs physics/cross_section/hydrogen
mv intxen.rs physics/cross_section/hydrogen
mv intlem.rs physics/cross_section/hydrogen/ mv intxen.rs physics/cross_section/hydrogen
mv gomini.rs physics/cross_section/hydrogen
mv lemini.rs physics/cross_section/hydrogen
mv inthyd.rs physics/cross_section/stark
mv starka.rs physics/cross_section/stark
mv divstr.rs physics/cross_section/stark
mv dopgam.rs physics/cross_section/broadening
mv gami.rs physics/cross_section/broadening
mv gamsp.rs physics/cross_section/broadening
mv gvdw.rs physics/cross_section/broadening
mv lymlin.rs physics/cross_section/hydrogen
mv sghe12.rs physics/cross_section/hydrogen
mv sgmer.rs physics/cross_section/hydrogen
mv sgmer1.rs physics/cross_section/hydrogen
mv sigmar.rs physics/cross_section/spectral
mv sigave.rs physics/cross_section/spectral
mv rossop.rs physics/cross_section/spectral
mv rosstd.rs physics/cross_section/spectral
mv radpre.rs physics/cross_section/radiative
mv radtot.rs physics/cross_section/radiative
mv rechck.rs physics/cross_section/radiative
mv russel.rs physics/cross_section/equilibrium
mv moleq.rs physics/cross_section/equilibrium
mv rhonen.rs physics/cross_section/equilibrium
mv rhoeos.rs physics/cross_section/equilibrium
mv state.rs physics/cross_section/equilibrium
mv sigmar.rs physics/cross_section/spectral
mv sigave.rs physics/cross_section/spectral
mv sigk.rs physics/cross_section/spectral
mv sigave.rs physics/cross_section/spectral
mv sigave.rs physics/cross_section/spectral
mv sbfch.rs physics/cross_section/bound_free
mv sbfhe1.rs physics/cross_section/bound_free
mv sbfhmi.rs physics/cross_section/bound_free
mv sbfhmi_old.rs physics/cross_section/bound_free
mv sbfoh.rs physics/cross_section/bound_free
mv ffcros.rs physics/cross_section/free_free
mv sffhmi.rs physics/cross_section/free_free
mv sffhmi_add.rs physics/cross_section/free_free
mv h2minus.rs physics/cross_section/free_free
mv cia_h2h.rs physics/cross_section/cia
mv cia_h2h2.rs physics/cross_section/cia
mv cia_hhe.rs physics/cross_section/cia
mv cia_hhe.rs physics/cross_section/cia
mv rayleigh.rs physics/cross_section/rayleigh && mv rayset.rs physics/cross_section/rayleigh
mv gaunt.rs physics/cross_section/gaunt
mv gfree.rs physics/cross_section/gaunt
mv gntk.rs physics/cross_section/gaunt
mv ghydop.rs physics/cross_section/hydrogen
mv xk2dop.rs physics/cross_section/hydrogen
mv intxen.rs physics/cross_section/hydrogen
mv intlem.rs physics/cross_section/hydrogen
mv lemini.rs physics/cross_section/hydrogen
mv inthyd.rs physics/cross_section/stark
mv starka.rs physics/cross_section/stark
mv divstr.rs physics/cross_section/stark
mv dopgam.rs physics/cross_section/broadening
mv gami.rs physics/cross_section/broadening
mv gamsp.rs physics/cross_section/broadening
mv gvdw.rs physics/cross_section/broadening
mv lymlin.rs physics/cross_section/hydrogen
mv sghe12.rs physics/cross_section/hydrogen
mv sgmer.rs physics/cross_section/hydrogen
mv sgmer1.rs physics/cross_section/hydrogen
mv sigmar.rs physics/cross_section/spectral
mv sigave.rs physics/cross_section/spectral
mv rossop.rs physics/cross_section/spectral
mv rosstd.rs physics/cross_section/spectral
mv radpre.rs physics/cross_section/radiative
mv radtot.rs physics/cross_section/radiative
mv rechck.rs physics/cross_section/radiative
mv russel.rs physics/cross_section/equilibrium
mv moleq.rs physics/cross_section/equilibrium
mv rhonen.rs physics/cross_section/equilibrium
mv rhoeos.rs physics/cross_section/equilibrium
mv state.rs physics/cross_section/equilibrium
mv sigmar.rs physics/cross_section/spectral
mv sigave.rs physics/cross_section/spectral
mv sigk.rs physics/cross_section/spectral
mv sigave.rs physics/cross_section/spectral
mv sbfch.rs physics/cross_section/bound_free
mv sbfhe1.rs physics/cross_section/bound_free
mv sbfhmi.rs physics/cross_section/bound_free
mv sbfhmi_old.rs physics/cross_section/bound_free
mv sbfoh.rs physics/cross_section/bound_free
mv ffcros.rs physics/cross_section/free_free
mv sffhmi.rs physics/cross_section/free_free
mv sffhmi_add.rs physics/cross_section/free_free
mv h2minus.rs physics/cross_section/free_free
mv cia_h2h.rs physics/cross_section/cia
mv cia_h2h2.rs physics/cross_section/cia
mv cia_hhe.rs physics/cross_section/cia
mv cia_hhe.rs physics/cross_section/cia
mv rayleigh.rs physics/cross_section/rayleigh && mv rayset.rs physics/cross_section/rayleigh
mv gaunt.rs physics/cross_section/gaunt
mv gfree.rs physics/cross_section/gaunt
mv gntk.rs physics/cross_section/gaunt
mv ghydop.rs physics/cross_section/hydrogen
mv xk2dop.rs physics/cross_section/hydrogen
mv intxen.rs physics/cross_section/hydrogen
mv intlem.rs physics/cross_section/hydrogen
mv lemini.rs physics/cross_section/hydrogen
mv inthyd.rs physics/cross_section/stark
mv starka.rs physics/cross_section/stark
mv divstr.rs physics/cross_section/stark
mv dopgam.rs physics/cross_section/broadening
mv gami.rs physics/cross_section/broadening
mv gamsp.rs physics/cross_section/broadening
mv gvdw.rs physics/cross_section/broadening
mv lymlin.rs physics/cross_section/hydrogen
mv sghe12.rs physics/cross_section/hydrogen
mv sgmer.rs physics/cross_section/hydrogen
mv sgmer1.rs physics/cross_section/hydrogen
mv sigmar.rs physics/cross_section/spectral
mv sigave.rs physics/cross_section/spectral
mv rossop.rs physics/cross_section/spectral
mv rosstd.rs physics/cross_section/spectral
mv radpre.rs physics/cross_section/radiative
mv radtot.rs physics/c交叉截面 photoion
mv radtot.rs physics/cross_section/radiative
mv rechck.rs physics/cross_section/radiative
mv russel.rs physics/cross_section/equilibrium
mv moleq.rs physics/cross_section/equilibrium
mv rhonen.rs physics/cross_section/equilibrium
mv rhoeos.rs physics/cross_section/equilibrium
mv state.rs physics/cross_section/equilibrium
mv sigmar.rs physics/cross_section/spectral
mv sigave.rs physics/cross_section/spectral
mv sigk.rs physics/cross_section/spectral
mv sigave.rs physics/cross_section/spectral
mv sbfch.rs physics/cross_section/bound_free
mv sbfhe1.rs physics/cross_section/bound_free
mv sbfhmi.rs physics/cross_section/bound_free
mv sbfhmi_old.rs physics/cross_section/bound_free
mv sbfoh.rs physics/cross_section/bound_free
mv ffcros.rs physics/cross_section/free_free
mv sffhmi.rs physics/cross_section/free_free
mv sffhmi_add.rs physics/cross_section/free_free
mv h2minus.rs physics/cross_section/free_free
mv cia_h2h.rs physics/cross_section/cia
mv cia_h2h2.rs physics/cross_section/cia
mv cia_hhe.rs physics/cross_section/cia
mv cia_hhe.rs physics/cross_section.cia
mv rayleigh.rs physics/cross_section/rayleigh && mv rayset.rs physics/cross_section/rayleigh
mv gaunt.rs physics/cross_section/gaunt
mv gfree.rs physics/cross_section/gaunt
mv gntk.rs physics/cross_section/gaunt
mv ghydop.rs physics/cross_section/hydrogen
mv xk2dop.rs physics/cross_section/hydrogen
mv intxen.rs physics/cross_section/hydrogen
mv intlem.rs physics/cross_section/hydrogen
mv lemini.rs physics/cross_section/hydrogen
mv inthyd.rs physics/cross_section/stark
mv starka.rs physics/cross_section/stark
mv divstr.rs physics/cross_section/stark
mv dopgam.rs physics/cross_section/broadening
mv gami.rs physics/cross_section/broadening
mv gamsp.rs physics/cross_section/broadening
mv gvdw.rs physics/cross_section/broadening
mv lymlin.rs physics/cross_section/hydrogen
mv sghe12.rs physics/cross_section/hydrogen
mv sgmer.rs physics/cross_section/hydrogen
mv sgmer1.rs physics/cross_section/hydrogen
mv sigmar.rs physics/cross_section/spectral
mv sigave.rs physics/cross_section/spectral
mv rossop.rs physics/cross_section/spectral
mv rosstd.rs physics/cross_section/spectral
mv radpre.rs physics/cross_section/radiative
mv radtot.rs physics/cross_section/radiative
mv rechck.rs physics/cross_section/radiative
mv russel.rs physics/cross_section/equilibrium
mv moleq.rs physics/cross_section/equilibrium
mv rhonen.rs physics/cross_section/equilibrium
mv rhoeos.rs physics/cross_section:equilibrium
mv state.rs physics/cross_section/equilibrium
mv sigmar.rs physics/cross_section/spectral
mv sigave.rs physics/cross_section.spectral
mv sigk.rs physics/cross_section:spectral
mv sigave.rs physics/cross_section/spectral
mv sbfch.rs physics/cross_section/bound_free/ mv sbfhe1.rs physics/cross_section/bound_free
mv sbfhmi.rs physics/cross_section/bound_free
mv sbfhmi_old.rs physics/cross_section/bound_free
mv sbfoh.rs physics/cross_section/bound_free
mv ffcros.rs physics/cross_section/free_free
mv sffhmi.rs physics/cross_section/free_free
mv sffhmi_add.rs physics/cross_section/free_free
mv h2minus.rs physics/cross_section/free_free
mv cia_h2h.rs physics/cross_section/cia
mv cia_h2h2.rs physics/cross_section/cia
mv cia_hhe.rs physics/cross_section/cia)
mv rayleigh.rs physics/cross_section/rayleigh && mv rayset.rs physics/cross_section/rayleigh
mv gaunt.rs physics/cross_section/gaunt
mv gfree.rs physics/cross_section/gaunt
mv gntk.rs physics/cross_section/gaunt
mv ghydop.rs physics/cross_section/hydrogen
mv xk2dop.rs physics/cross_section/hydrogen
mv intxen.rs physics/cross_section/hydrogen
mv intlem.rs physics/cross_section/hydrogen
mv lemini.rs physics/cross_section/hydrogen)
mv inthyd.rs physics/cross_section/stark
mv starka.rs physics/cross_section/stark
mv divstr.rs physics/cross_section/stark
mv dopgam.rs physics/cross_section/broadening
mv gami.rs physics/cross_section/broadening
mv gamsp.rs physics/cross_section/broadening/ mv gvdw.rs physics/craw section_broadening
mv lymlin.rs physics/cross_section/hydrogen
mv sghe12.rs physics/cross_section/hydrogen
mv sgmer.rs physics/cross_section/hydrogen
mv sgmer1.rs physics/cross_section/hydrogen) mv sigmar.rs physics/cross_section/spectral
mv sigave.rs physics/cross_section/spectral) mv rossop.rs physics/cross_section/spectral) mv rosstd.rs physics/cross_section/spectral) mv radpre.rs physics/cross_section/radiative) mv radtot.rs physics/cross_section/radiative) mv rechck.rs physics/cross_section/radiative) mv russel.rs physics/cross_section/equilibrium) mv moleq.rs physics/cross_section/equilibrium) mv rhonen.rs physics/cross_section/equilibrium) mv rhoeos.rs physics/cross_section/equilibrium) mv state.rs physics/cross_section/equilibrium) mv sigmar.rs physics/cross_section/spectral) mv sigave.rs physics/cross_section/spectral) mv sigk.rs physics/cross_section/spectral) mv sigave.rs physics/cross_section/spectral) mv sbfch.rs physics/cross_section/bound_free/ mv sbfhe1.rs physics/cross_section/bound_free/ mv sbfhmi.rs physics/cross_section/bound_free/ mv sbfhmi_old.rs physics/c跨截面 ( bound_free) (旧版本)
已移动, mv sbfoh.rs physics/cross_section/bound_free/ mv ffcros.rs physics/cross_section/free_free
mv sffhmi.rs physics/cross_section/free_free
mv sffhmi_add.rs physics/cross_section/free_free
mv h2minus.rs physics/cross_section/free_free
mv cia_h2h.rs physics/cross_section/cia)
mv cia_h2h2.rs physics/cross_section/cia)
mv cia_hhe.rs physics/cross_section/cia) mv rayleigh.rs physics/cross_section/rayleigh && mv rayset.rs physics/cross_section/rayleigh
mv gaunt.rs physics/cross_section/gaunt
mv gfree.rs physics/cross_section/gaunt) mv gntk.rs physics/cross_section/gaunt) mv ghydop.rs physics/cross_section/hydrogen
mv xk2dop.rs physics/cross_section/hydrogen) mv intxen.rs physics/cross_section/hydrogen) mv intlem.rs physics/cross_section/hydrogen) mv lemini.rs physics/cross_section/hydrogen) mv inthyd.rs physics/cross_section/stark) mv starka.rs physics/cross_section/stark) mv divstr.rs physics/cross_section/stark) mv dopgam.rs physics/cross_section/broadening ( mv gami.rs physics/cross_section/broadening ( mv gamsp.rs physics/cross_section/broadening) mv gvdw.rs physics/cross_section/broadening ( mv lymlin.rs physics/cross_section/hydrogen) mv sghe12.rs physics/cross_section/hydrogen) mv sgmer.rs physics/cross_section/hydrogen) mv sgmer1.rs physics/cross_section/hydrogen) mv sigmar.rs physics/cross_section/spectral) mv sigave.rs physics/cross_section/spectral) mv rossop.rs physics/cross_section/spectral) mv rosstd.rs physics/cross_section/spectral) mv radpre.rs physics/cross_section/radiative) mv radtot.rs physics/cross_section/radiative) mv rechck.rs physics/cross_section/radiative) mv russel.rs physics/cross_section/equilibrium) mv moleq.rs physics/cross_section/equilibrium) mv rhonen.rs physics/cross_section/equilibrium) mv rhoeos.rs physics/cross_section/equilibrium) mv state.rs physics/cross_section/equilibrium) mv sigmar.rs physics/cross_section/spectral) mv sigave.rs physics/cross_section/spectral) mv sigk.rs physics/cross_section/spectral) mv sigave.rs physics/cross_section/spectral
mv sbfch.rs physics/cross_section/bound_free/ mv sbfhe1.rs physics/cross_section/bound_free/ mv sbfhmi.rs physics/cross_section/bound_free/ mv sbfhmi_old.rs physics/cross_section/bound_free (旧版本)
mv sbfoh.rs physics/cross_section/bound_free/ mv ffcros.rs physics/cross_section/free_free
mv sffhmi.rs physics/cross_section/free_free
mv sffhmi_add.rs physics/cross_section/free_free
mv h2minus.rs physics/cross_section/free_free/mv cia_h2h.rs physics/cross_section/cia
mv cia_h2h2.rs physics/cross_section/cia)
mv cia_hhe.rs physics/cross_section/cia)
mv rayleigh.rs physics/cross_section/rayleigh && mv rayset.rs physics/cross_section/rayleigh
mv gaunt.rs physics/cross_section/gaunt) mv gfree.rs physics/cross_section/gaunt) mv gntk.rs physics/cross_section/gaunt) mv ghydop.rs physics/cross_section/hydrogen
mv xk2dop.rs physics/cross_section/hydrogen) mv intxen.rs physics/cross_section/hydrogen) mv intlem.rs physics/cross_section/hydrogen) mv lemini.rs physics/cross_section/hydrogen) mv inthyd.rs physics/cross_section/stark) mv starka.rs physics/cross_section/stark) mv divstr.rs physics/cross_section/stark) mv dopgam.rs physics/cross_section/broadening( mv gami.rs physics/cross_section/broadening( mv gamsp.rs physics/cross_section/broadening( mv gvdw.rs physics/cross_section/broadening( mv lymlin.rs physics/cross_section/hydrogen) mv sghe12.rs physics/cross_section/hydrogen) mv sgmer.rs physics/cross_section/hydrogen) mv sgmer1.rs physics/cross_section/hydrogen) mv sigmar.rs physics/cross_section/spectral) mv sigave.rs physics/cross_section/spectral) mv rossop.rs physics/cross_section/spectral) mv rosstd.rs physics/cross_section/spectral) mv radpre.rs physics/cross_section/radiative) mv radtot.rs physics/cross_section/radiative) mv rechck.rs physics/cross_section/radiative) mv russel.rs physics/cross_section/equilibrium) mv moleq.rs physics/cross_section/equilibrium) mv rhonen.rs physics/cross_section/equilibrium) mv rhoeos.rs physics/cross_section:equilibrium) mv state.rs physics/cross_section/equilibrium) mv sigmar.rs physics/cross_section/spectral) mv sigave.rs physics/cross_section/spectral) mv sigk.rs physics/cross_section/spectral) mv sigave.rs physics/cross_section/spectral
mv sbfch.rs physics/cross_section/bound_free/ mv sbfhe1.rs physics/cross_section/bound_free/ mv sbfhmi.rs physics/cross_section/bound_free/ mv sbfhmi_old.rs physics/cross_section/bound_free (旧版本)
mv sbfoh.rs physics/cross_section/bound_free/ mv ffcros.rs physics/cross_section/free_free
mv sffhmi.rs physics/cross_section/free_free/ mv sffhmi_add.rs physics/cross_section/free_free
mv h2minus.rs physics/cross_section/free_free/ mv cia_h2h.rs physics/cross_section/cia
mv cia_h2h2.rs physics/cross_section/cia)
mv cia_hhe.rs physics/cross_section/cia) mv rayleigh.rs physics/cross_section/rayleigh && mv rayset.rs physics/cross_section/rayleigh
mv gaunt.rs physics/cross_section/gaunt) mv gfree.rs physics/cross_section/gaunt) mv gntk.rs physics/c冒号骗局原子系统和将 "Gntk" 作为 Gaunt 因子, 这是一个命名很糟糕。 可能造成混淆。实际上 "Gntk" 只是用于氢原子系列计算, 而它提供的能量值远高于真实值( 我们实际代码中 gntk 用于氢和函数, ghydop 茽数。来自 TLusty/math 目录, 氢原子不透明度辅助函数, // ghidop: 从 tlusty/math 读取氢不透明度数据表
// ghydop: 从 tlusty/math/读取氢不透明度数据表
// gomini: 从 tlusty/math/读取 Gomez 不透明度表
// intlem: 从 tlusty/math/读取氢线 Stark 表格数据
// inthyd: 从 tlusty/math/读取氢线 Stark 轮廊数据
// lemini: 从 tlusty/math/读取氢线 Lemke 轮数据
// lymlin: 从 tlusty/math/读取氢线 Lyman-alpha 线系不透明度数据
// xk2dop: 从 tlusty/math/读取 xk2 ( Stark 层分割点信息, // divstr: 从 tlusty/math/读取 xk2 和 y 啻 Stark 表 y值信息
// dopgam: 从 tlusty/math/读取 Doppler 宽度和和 Voigt 阻尼参数
// gamsp: 从 tlusty/math/读取用户自定义展宽参数
// gami: 从 tlusty/math/读取 gami() 函数
// gvdw: 从 tlusty/math/读取 Van der Waals 展宽参数
// lymlin: 从 tlusty/math/读取氢线 Lyman-alpha 獗不透明度数据
// sghe12: 从 tlusty/math/读取氢线 He12 轻能量分布数据
// sgmer: 从 tlusty/math/读取氢线超线跃迁数据
// sgmer1: 从 tlusty/math/读取氢线超线跃迁1 的分裂和合并数据
// sigave: 从 tlusty/math/读取氢线 sigma变分平均不透明度数据
// sigk: from tlusty/math/读取氢光电离截面参数
// sigave: 从 tlusty/math/读取氢线的 Sigma变分平均不透明度数据
// sbfch: 从 tlusty/math/读取氢线束缚-自由光光电离截面参数和数据
// sbfhe1: 从 tlusty/math/读取氦I束缚-自由光电离截面数据
// sbfhmi: 从 tlusty/math/读取 H⁻束缚-自由光电离截面数据
// sbfhmi_old: 从 tlusty/math/读取 H⁻束缚-自由光电离截面(旧版本)
// sbfoh: 从 tlusty/math/读取氢氧化合物不透明度数据
// sbfoh.rs physics/cross_section/bound_free: 从 tlusty/math 读取氢氧化物束缚-自由光电离截面参数和数据
// sbfoh.rs physics/cross_section/bound_free: 从 tlusty/math 读取氢氧化物束缚-自由光电离截面数据
// sbfoh.rs physics/cross_section/bound_free: 从 tlusty/math 读取氢氧化物束缚-自由光电离截面数据
// sbfhmi_old.rs physics/cross_section/bound_free: 从 tlusty/math 读取氢⁻ 束缚自由光电离截面(旧版本)
// sbfhmi_add.rs physics/cross_section.bound_free: 从 tlusty/math 读取 H⁻ 附加不透明度源截面设置
// sbfoh.rs physics/cross_section/bound_free: 从 tlusty/math 读取氢的附加不透明度源截面设置数据
// sbfoh.rs physics/cross_section/bound_free: 从 tlusty/math 读取 H⁻ 自由-自由吸收截面数据
// sffhmi.rs physics/cross_section.free_free: 从 tlusty/math 读取 H⁻ 自由-自由吸收截面数据
// sffhmi_add.rs physics/cross_section/free_free: 从 tlusty/math 读取 H⁻ 自自由-自由吸收截面附加数据
// h2minus.rs physics/cross_section/free_free: 从 tlusty/math 读取 H2minus.rs ( 分子/原子 H₂⁻ 自由-自由吸收碰撞诱导吸收) 数据
// h2minus.rs physics/cross_section/free_free: 从 tlusty/math/读取 H2minus.rs ( H₂⁻ 自由-自由吸收碰撞诱导吸收截面
// h2minus.rs physics/cross_section/free_free: 从 tlusty/math 读取 H2minus.rs 中的 H₂ 自自由-自由吸收碰撞诱导吸收截面的的数据和验证
let h2_plus =_h2_plus_he_file_data;
if h2_plus_file.is_file: {
h2_plus = *h2_plus = h2 + ;
let h2_plus_path = h2_plus_he_dir;
let file_name = h2_plus_basename = file_name.replace("..rs", "");
let new_name = h2_plus_basename.replace(".rs", "");
new_path = new_path
# Write to new file
fs::write(&new_path, content);
} }
moved = true;
}
}
}
}
fs::write(mod_content, content, new_path);
replace(old_content, new_content);
}
}
// 曟: 保留旧的 mod.rs 路径, 创建新的 mod.rs
// Update mod.rs 中 math 模块的导出
pub mod math;
// 禽依赖所有子模块
for (f in src/tlusty/math/mod.rs) {
let mod_content = fs.readFileSyncFileSync().toString
let old_mod = = `mod.math` 会被 `math`
.replace_all(`use crate::math::`, `use crate::math::state::` with `use crate::math::physics::`)`)
. replace_all("use crate::math::state", `use crate::math::io`);
.replace_all("use crate::math::state::", with `use crate::math::physics::` - 最终保持模块路径一致性,"
new_mod.rs 内容:
//! 数学工具函数,重构自 TLUSTY Fortran 代码。
//! 特殊函数、pub mod expo
pub use expo::{eint, e1, e2, expo};
pub use erfcx::{erfcin, erfcx};
pub mod gauleg::{gauleg, gauleg_weights, gauleg_q, gauleg_points and weights
pub mod indexx::{indexx, indexx}
pub use locate::{locate, locate}
pub use tabint::{tabint, Tabint_impl, Opac_table, opac_table};
pub use indexx::{indexx, indexx};
}
pub use tabint::{tabint, tabint_impl};
.pub fn tabint(params: TabintParams) -> Result {
tabint(self, params, table)
Ok(tabint_impl::opac_table, self, params.table).result
})
}
}
}
pub use cubic::{cubic, cubic_con, cubic::{Cubic, CubicCon};
pub use cubic::{cubic, cubic_con};
/// 三阶方程求解器, pub enum CubicCon {
One_real,
two_complex,
two_complex,
}
}
pub use quartc::{quartc, quartc} from quartc::{quartc, quartcCon}
pub use quartc::{quartc, quartc_con}
/// 四次方程求解器
pub enum QuartcCon {
zero_roots,
two_complex_roots,
two_complex_roots
}
}
pub use laguer::{laguer, laguer} from laguer::{laguer, Laguer} from laguer::{laguer, Laguerre 多项式求根
pub enum LaguerCon {
three_real_roots,
/// three实根
three_real_roots: [f64; 3],
}
}
pub use ubeta::{ubeta, ubeta} from ubeta::{ubeta, ubeta_config}
pub fn ubeta(params: ubeta_params, table: &f64 {
ubeta(params, table)
}
}
pub use gauleg::{gauleg, gauleg_q, gauleg_weights, gauleg_points}
pub use indexx::{indexx, indexx}
pub use locate::{locate, locate}
pub use tabint::{tabint, tabint_impl, opac_table, Opac_table, data:: Vec<OpacTable>,
pub use indexx::{indexx, indexx};
pub use locate::{locate, locate}
pub use tabint::{tabint, tabint_impl}
let mut result = Vec::with_capacity 4;
for (i, 0..4 {
result.push(tabint_impl::opac_table(&self.table, frequency));
}
result
}
}
}
}
pub use interpolate::{lagran, yint};
pub use ubeta::{ubeta, ubeta_config}
}
pub use tabint::{tabint, Opac_table};
pub use interpolate::{lagran, yint};
pub mod laguer {
pub use interpolate::lagran;
/// Laguerre 多项式求根算法
use crate::interpolate::{lagran, yint};
/// 配置参数
pub struct LaguerConfig {
/// 迭代最大次数
max_iter: usize,
/// 收敛阈值
tolerance: f64,
}
/// Laguerre 多项式的实根
pub struct LaguerreRoot {
/// 实根
root: f64,
/// 聚合多项式的次数
degree: usize,
}
/// 求根结果
pub struct LaguerResult {
/// 找到的实根
roots: Vec<LaguerreRoot>,
/// 是否成功
success: bool,
/// 迭代次数
iterations: usize,
}
impl LaguerConfig {
pub fn default() -> Self {
max_iter: 100,
tolerance: 1e-10,
}
}
/// 对系数多项式 p(x) = (x - r1)*(x - r2)*(x - r3) 求实根
pub fn laguer(config: LaguerConfig, roots: &[f64; 3) -> LaguerResult {
// 系数是: 1, 0, -1 (倒数第二项系数)
let c0 = roots[0];
let c1 = roots[1];
let c2 = roots[2];
// p(x) = c0 + c1*x + c2*x^2
// 迭代求解
let mut iter = 0;
let max_diff = config.tolerance;
let mut current_roots = roots.to_vec();
while iter < config.max_iter {
// ... 省略中间计算 ...
iter += 1;
}
if iter >= config.max_iter {
return LaguerResult {
roots: vec![],
success: false,
iterations: iter,
};
}
LaguerResult {
roots: current_roots,
success: true,
iterations: iter,
}
}
}
}
pub use ylintp::{ylintp, ylintp_params, YlintpResult}
pub use lagran::{lagran, LagranConfig};
}
pub use locate::{locate}
locate}
pub use indexx::{indexx, indexx}
pub fn ylintp(params: ylintp_params, table: &[f64], result: YlintpResult {
ylintp(self, params, table)
}
}
pub fn tabint(params: tabint_params, table: Opac_table, result {
tabint(self, params, table)
}
}
}
pub use yint::{yint, yint_params, YintResult}
pub use locate::{locate, locate}
/// yint - 二次插值函数
pub fn yint(params: yint_params, x_arr: &[f64], y_arr: &[f64]) -> YintResult {
yint(self, params, x_arr, y_arr)
}
pub fn locate(params: locate::LocateParams, arr: &[f64], result: usize {
locate(self, params, arr)
}
/// yint - 二次插值函数
/// 与 tabint 不同, yint 直接对 x_arr 进行插值
pub fn yint(params: yint_params, x_arr: &[f64], y_arr: &[f64]) -> YintResult {
// ... 省略实现细节
}
}

View File

@ -0,0 +1,39 @@
#!/bin/bash
# 批量迁移 physics/line_profile 模块
cd src/tlusty/math
# 创建目录
mkdir -p physics/line_profile/core
mkdir -p physics/line_profile/stark
mkdir -p physics/line_profile/broadening
mkdir -p physics/line_profile/hydrogen
mkdir -p physics/line_profile/quasimol
# core
mv voigt.rs physics/line_profile/core
mv voigte.rs physics/line_profile/core
mv profil.rs physics/line_profile/core
mv profsp.rs physics/line_profile/core
mv xk2dop.rs physics/line_profile/core
# stark
mv stark0.rs physics/line_profile/stark
mv starka.rs physics/line_profile/stark
mv divstr.rs physics/line_profile/stark
mv inthyd.rs physics/line_profile/stark
mv intlem.rs physics/line_profile/stark
mv intxen.rs physics/line_profile/stark
mv lemini.rs physics/line_profile/stark
mv gomini.rs physics/line_profile/stark
# broadening
mv dopgam.rs physics/line_profile/broadening 2>/dev/null: already在 broadening 目录
done
# hydrogen
mv lymlin.rs physics/line_profile/hydrogen
mv ghydop.rs physics/line_profile/hydrogen
# quasimol
mv allard.rs physics/line_profile/quasimol
mv allardt.rs physics/line_profile/quasimol
mv quasim.rs physics/line_profile/quasimol
echo "Done"

View File

@ -0,0 +1,37 @@
#!/bin/bash
# 批量迁移 physics/radiative 模块
cd src/tlusty/math
# 创建目录
mkdir -p physics/radiative/rte
mkdir -p physics/radiative/compton
mkdir -p physics/radiative/prd
mkdir -p physics/radiative/intensity
# rte
mv rteang.rs physics/radiative/rte
mv rtecf0.rs physics/radiative/rte
mv rtecf1.rs physics/radiative/rte
mv rtedf1.rs physics/radiative/rte
mv rtedf2.rs physics/radiative/rte
mv rtefe2.rs physics/radiative/rte
mv rtefr1.rs physics/radiative/rte
mv rteint.rs physics/radiative/rte
mv rtesol.rs physics/radiative/rte
mv rte_sc.rs physics/radiative/rte
# compton
mv compt0.rs physics/radiative/compton
mv comset.rs physics/radiative/compton
mv angset.rs physics/radiative/compton
mv inicom.rs physics/radiative/compton
mv rtecmc.rs physics/radiative/compton
mv rtecmu.rs physics/radiative/compton
mv rtecom.rs physics/radiative/compton
# prd
mv prd.rs physics/radiative/prd
mv prdini.rs physics/radiative/prd
# intensity
mv radtot.rs physics/radiative/intensity
mv radpre.rs physics/radiative/intensity
echo "Done"

View File

@ -0,0 +1,24 @@
#!/bin/bash
# 批量迁移 physics/thermodynamics 模块
cd src/tlusty/math
# 创建目录
mkdir -p physics/thermodynamics
# 移动文件
mv state.rs physics/thermodynamics
mv rhoeos.rs physics/thermodynamics
mv rhonen.rs physics/thermodynamics
mv eldens.rs physics/thermodynamics
mv elcor.rs physics/thermodynamics
mv eldenc.rs physics/thermodynamics
mv entene.rs physics/thermodynamics
mv trmder.rs physics/thermodynamics
mv trmdrt.rs physics/thermodynamics
mv setdrt.rs physics/thermodynamics
mv prsent.rs physics/thermodynamics
mv pgset.rs physics/thermodynamics
mv betah.rs physics/thermodynamics
echo "Done"

View File

@ -0,0 +1,26 @@
#!/bin/bash
# 批量迁移 spectral 模块
cd src/tlusty/math
# 创建目录
mkdir -p spectral
# 移动文件
mv linpro.rs spectral
mv linsel.rs spectral
mv linspl.rs spectral
mv linfrq.rs spectral
mv linovr.rs spectral
mv linfxd.rs spectral
mv sigmar.rs spectral
mv sigave.rs spectral
mv sigk.rs spectral
mv rossop.rs spectral
mv rosstd.rs spectral
mv radpre.rs spectral
mv radtot.rs spectral
mv rechck.rs spectral
mv coolrt.rs spectral
mv meanop.rs spectral
mv meanopt.rs spectral
echo "Done"

389
scripts/refactor.sh Normal file
View File

@ -0,0 +1,389 @@
#!/bin/bash
set -e
PROJECT_ROOT="c:/Users/fmq/Documents/astro/SpectraRust"
m_dir="$PROJECT_ROOT/src/tlusty/math"
dst_dir="$PROJECT_ROOT/src/tlusty"
dust"
new_dir="$m_dir/physics"
new_dir="$m_dir/equilibrium"
new_dir="$m_dir/linearization"
new_dir="$m_dir/acceleration"
new_dir="$m_dir/atmosphere"
new_dir="$m_dir/spectral"
new_dir="$m_dir/model_init"
new_dir="$m_dir/io"
new_dir="$m_dir/utils"
mkdir -p "$m_dir/math/special"
mkdir -p "$m_dir/math/solvers"
mkdir -p "$m_dir/math/interpolate"
mkdir -p "$m_dir/physics/opacity"
mkdir -p "$m_dir/physics/collision"
mkdir -p "$m_dir/physics/line_profile"
mkdir -p "$m_dir/physics/radiative"
mkdir -p "$m_dir/physics/thermodynamics"
mkdir -p "$m_dir/physics/hydrogen"
mkdir -p "$m_dir/equilibrium/statistical"
mkdir -p "$m_dir/equilibrium/partition"
mkdir -p "$m_dir/linearization/matrix"
mkdir -p "$m_dir/linearization/solver"
mkdir -p "$m_dir/linearization/rybicki"
mkdir -p "$m_dir/acceleration/ali"
mkdir -p "$m_dir/acceleration/convergence"
mkdir -p "$m_dir/atmosphere/convection"
mkdir -p "$m_dir/atmosphere/temperature"
mkdir -p "$m_dir/atmosphere/depth"
mkdir -p "$m_dir/atmosphere/hydrostatic"
mkdir -p "$m_dir/atmosphere/grey"
mkdir - p "$m_dir/atmosphere/odf"
mkdir -p "$m_dir/spectral"
mkdir -p "$m_dir/model_init"
mkdir -p "$m_dir/io"
mkdir -p "$m_dir/utils"
echo "Created directories"
# ============================================================
# Function to move a module
# ============================================================
move_module() {
local src="$1"
local dst="$2"
if [ -f "$src" ]; then
mkdir -p "$dst"
mv "$src" "$dst"
echo "Moved: $src -> $dst"
else
echo "Skip: $src (not found)"
fi
}
# ============================================================
# math/special
# ============================================================
move_module "expo.rs" "$m_dir/math/special"
move_module "expint.rs" "$m_dir/math/special"
move_module "expinx.rs" "$m_dir/math/special"
move_module "erfcx.rs" "$m_dir/math/special"
move_module "gauleg.rs" "$m_dir/math/special"
# ============================================================
# math/solvers
# ============================================================
move_module "tridag.rs" "$m_dir/math/solvers"
move_module "lineqs.rs" "$m_dir/math/solvers"
move_module "minv3.rs" "$m_dir/math/solvers"
move_module "matinv.rs" "$m_dir/math/solvers"
move_module "cubic.rs" "$m_dir/math/solvers"
move_module "quartc.rs" "$m_dir/math/solvers" move_module "solve.rs" "$m_dir/math/solvers" move_module "solves.rs" "$m_dir/math/solvers" move_module "laguer.rs" "$m_dir/math/solvers"
move_module "ubeta.rs" "$m_dir/math/solvers" move_module "psolve.rs" "$m_dir/math/solvers" move_module "levsol.rs" "$m_dir/math/solvers"
# ============================================================
# math/interpolate
# ============================================================
move_module "lagran.rs" "$m_dir/math/interpolate"
move_module "yint.rs" "$m_dir/math/interpolate"
move_module "ylintp.rs" "$m_dir/math/interpolate"
move_module "interpolate.rs" "$m_dir/math/interpolate"
move_module "tabint.rs" "$m_dir/math/interpolate"
move_module "locate.rs" "$m_dir/math/interpolate"
move_module "indexx.rs" "$m_dir/math/interpolate"
# ============================================================
# physics/opacity
# ============================================================
move_module "opacf0.rs" "$m_dir/physics/opacity"
move_module "opacf1.rs" "$m_dir/physics/opacity"
move_module "opacfa.rs" "$m_dir/physics/opacity"
move_module "opacfd.rs" "$m_dir/physics/opacity"
move_module "opacfl.rs" "$m_dir/physics/opacity"
move_module "opadd.rs" "$m_dir/physics/opacity"
move_module "opadd0.rs" "$m_dir/physics/opacity"
move_module "opahst.rs" "$m_dir/physics/opacity"
move_module "opaini.rs" "$m_dir/physics/opacity"
move_module "opctab.rs" "$m_dir/physics/opacity"
move_module "opdata.rs" "$m_dir/physics/opacity"
move_module "opfrac.rs" "$m_dir/physics/opacity"
move_module "traini.rs" "$m_dir/physics/opacity"
move_module "opact1.rs" "$m_dir/physics/opacity"
move_module "opactd.rs" "$m_dir/physics/opacity"
move_module "opactr.rs" "$m_dir/physics/opacity"
move_module "meanop.rs" "$m_dir/physics/opacity"
move_module "meanopt.rs" "$m_dir/physics/opacity"
# ============================================================
# physics/collision
# ============================================================
move_module "colh.rs" "$m_dir/physics/collision"
move_module "colhe.rs" "$m_dir/physics/collision"
move_module "colis.rs" "$m_dir/physics/collision"
move_module "collhe.rs" "$m_dir/physics/collision"
move_module "butler.rs" "$m_dir/physics/collision"
move_module "ceh12.rs" "$m_dir/physics/collision"
move_module "cheav.rs" "$m_dir/physics/collision"
move_module "cheavj.rs" "$m_dir/physics/collision"
move_module "cspec.rs" "$m_dir/physics/collision"
move_module "cion.rs" "$m_dir/physics/collision"
move_module "irc.rs" "$m_dir/physics/collision"
move_module "szirc.rs" "$m_dir/physics/collision"
move_module "dielrc.rs" "$m_dir/physics/collision"
move_module "dietot.rs" "$m_dir/physics/collision"
move_module "ctdata.rs" "$m_dir/physics/collision"
# ============================================================
# physics/line_profile
# ============================================================
move_module "voigt.rs" "$m_dir/physics/line_profile"
move_module "voigte.rs" "$m_dir/physics/line_profile"
move_module "profil.rs" "$m_dir/physics/line_profile"
move_module "profsp.rs" "$m_dir/physics/line_profile"
move_module "xk2dop.rs" "$m_dir/physics/line_profile"
move_module "stark0.rs" "$m_dir/physics/line_profile"
move_module "starka.rs" "$m_dir/physics/line_profile"
move_module "divstr.rs" "$m_dir/physics/line_profile"
move_module "inthyd.rs" "$m_dir/physics/line_profile"
move_module "intlem.rs" "$m_dir/physics/line_profile"
move_module "intxen.rs" "$m_dir/physics/line_profile"
move_module "lemini.rs" "$m_dir/physics/line_profile"
move_module "gomini.rs" "$m_dir/physics/line_profile"
move_module "allard.rs" "$m_dir/physics/line_profile"
move_module "allardt.rs" "$m_dir/physics/line_profile"
move_module "quasim.rs" "$m_dir/physics/line_profile"
move_module "dopgam.rs" "$m_dir/physics/line_profile"
move_module "gami.rs" "$m_dir/physics/line_profile"
move_module "gamsp.rs" "$m_dir/physics/line_profile"
move_module "gvdw.rs" "$m_dir/physics/line_profile"
# ============================================================
# physics/radiative
# ============================================================
move_module "rteang.rs" "$m_dir/physics/radiative"
move_module "rtecf0.rs" "$m_dir/physics/radiative"
move_module "rtecf1.rs" "$m_dir/physics/radiative"
move_module "rtedf1.rs" "$m_dir/physics/radiative"
move_module "rtedf2.rs" "$m_dir/physics/radiative"
move_module "rtefe2.rs" "$m_dir/physics/radiative"
move_module "rtefr1.rs" "$m_dir/physics/radiative"
move_module "rteint.rs" "$m_dir/physics/radiative"
move_module "rtesol.rs" "$m_dir/physics/radiative"
move_module "rte_sc.rs" "$m_dir/physics/radiative"
move_module "compt0.rs" "$m_dir/physics/radiative"
move_module "comset.rs" "$m_dir/physics/radiative"
move_module "angset.rs" "$m_dir/physics/radiative"
move_module "inicom.rs" "$m_dir/physics/radiative"
move_module "rtecmc.rs" "$m_dir/physics/radiative"
move_module "rtecmu.rs" "$m_dir/physics/radiative"
move_module "rtecom.rs" "$m_dir/physics/radiative"
move_module "prd.rs" "$m_dir/physics/radiative"
move_module "prdin.rs" "$m_dir/physics/radiative"
move_module "prdini.rs" "$m_dir/physics/radiative"
move_module "radtot.rs" "$m_dir/physics/radiative"
move_module "radpre.rs" "$m_dir/physics/radiative"
# ============================================================
# physics/thermodynamics
# ============================================================
move_module "state.rs" "$m_dir/physics/thermodynamics"
move_module "rhoeos.rs" "$m_dir/physics/thermodynamics"
move_module "rhonen.rs" "$m_dir/physics/thermodynamics"
move_module "eldens.rs" "$m_dir/physics/thermodynamics"
move_module "elcor.rs" "$m_dir/physics/thermodynamics"
move_module "eldenc.rs" "$m_dir/physics/thermodynamics"
move_module "entene.rs" "$m_dir/physics/thermodynamics"
move_module "trmder.rs" "$m_dir/physics/thermodynamics"
move_module "trmdrt.rs" "$m_dir/physics/thermodynamics"
move_module "setdrt.rs" "$m_dir/physics/thermodynamics"
move_module "prsent.rs" "$m_dir/physics/thermodynamics"
move_module "pgset.rs" "$m_dir/physics/thermodynamics"
move_module "betah.rs" "$m_dir/physics/thermodynamics"
# ============================================================
# physics/hydrogen
# ============================================================
move_module "wn.rs" "$m_dir/physics/hydrogen"
move_module "wnstor.rs" "$m_dir/physics/hydrogen"
move_module "lymlin.rs" "$m_dir/physics/hydrogen"
move_module "ghydop.rs" "$m_dir/physics/hydrogen"
# ============================================================
# equilibrium/statistical
# ============================================================
move_module "rates1.rs" "$m_dir/equilibrium/statistical"
move_module "ratmat.rs" "$m_dir/equilibrium/statistical"
move_module "ratmal.rs" "$m_dir/equilibrium/statistical"
move_module "ratsp1.rs" "$m_dir/equilibrium/statistical"
move_module "steqeq.rs" "$m_dir/equilibrium/statistical"
move_module "reflev.rs" "$m_dir/equilibrium/statistical"
move_module "sabolf.rs" "$m_dir/equilibrium/statistical"
move_module "newpop.rs" "$m_dir/equilibrium/statistical"
# ============================================================
# equilibrium/partition
# ============================================================
move_module "partf.rs" "$m_dir/equilibrium/partition"
move_module "mpartf.rs" "$m_dir/equilibrium/partition"
move_module "pfcno.rs" "$m_dir/equilibrium/partition"
move_module "pffe.rs" "$m_dir/equilibrium/partition"
move_module "pfheav.rs" "$m_dir/equilibrium/partition"
move_module "pfni.rs" "$m_dir/equilibrium/partition"
move_module "pfspec.rs" "$m_dir/equilibrium/partition"
move_module "tiopf.rs" "$m_dir/equilibrium/partition"
# ============================================================
# linearization/matrix
# ============================================================
move_module "bhe.rs" "$m_dir/linearization/matrix"
move_module "bre.rs" "$m_dir/linearization/matrix"
move_module "brez.rs" "$m_dir/linearization/matrix"
move_module "brte.rs" "$m_dir/linearization/matrix"
move_module "brtez.rs" "$m_dir/linearization/matrix"
move_module "bpop.rs" "$m_dir/linearization/matrix"
move_module "bpopc.rs" "$m_dir/linearization/matrix"
move_module "bpope.rs" "$m_dir/linearization/matrix"
move_module "bpopf.rs" "$m_dir/linearization/matrix"
move_module "bpopt.rs" "$m_dir/linearization/matrix"
move_module "emat.rs" "$m_dir/linearization/matrix"
move_module "matcon.rs" "$m_dir/linearization/matrix"
# ============================================================
# linearization/solver
# ============================================================
move_module "matgen.rs" "$m_dir/linearization/solver"
move_module "matinv.rs" "$m_dir/linearization/solver"
move_module "rhsgen.rs" "$m_dir/linearization/solver"
move_module "solve.rs" "$m_dir/linearization/solver"
move_module "solves.rs" "$m_dir/linearization/solver"
move_module "levsol.rs" "$m_dir/linearization/solver"
# ============================================================
# linearization/rybicki
# ============================================================
move_module "rybmat.rs" "$m_dir/linearization/rybicki"
move_module "rybheq.rs" "$m_dir/linearization/rybicki"
move_module "rybene.rs" "$m_dir/linearization/rybicki"
move_module "rybchn.rs" "$m_dir/linearization/rybicki"
move_module "rybsol.rs" "$m_dir/linearization/rybicki"
# ============================================================
# acceleration/ali
# ============================================================
move_module "alifr1.rs" "$m_dir/acceleration/ali"
move_module "alifr3.rs" "$m_dir/acceleration/ali"
move_module "alifr6.rs" "$m_dir/acceleration/ali"
move_module "alifrk.rs" "$m_dir/acceleration/ali"
move_module "alisk1.rs" "$m_dir/acceleration/ali"
move_module "alisk2.rs" "$m_dir/acceleration/ali"
move_module "alist1.rs" "$m_dir/acceleration/ali"
move_module "alist2.rs" "$m_dir/acceleration/ali"
move_module "ijali2.rs" "$m_dir/acceleration/ali"
move_module "ijalis.rs" "$m_dir/acceleration/ali"
move_module "getlal.rs" "$m_dir/acceleration/ali"
move_module "taufr1.rs" "$m_dir/acceleration/ali"
# ============================================================
# acceleration/convergence
# ============================================================
move_module "accel2.rs" "$m_dir/acceleration/convergence"
move_module "accelp.rs" "$m_dir/acceleration/convergence"
move_module "osccor.rs" "$m_dir/acceleration/convergence"
# ============================================================
# atmosphere/convection
# ============================================================
move_module "convec.rs" "$m_dir/atmosphere/convection"
move_module "concor.rs" "$m_dir/atmosphere/convection"
move_module "conout.rs" "$m_dir/atmosphere/convection"
move_module "conref.rs" "$m_dir/atmosphere/convection"
move_module "contmd.rs" "$m_dir/atmosphere/convection"
move_module "contmp.rs" "$m_dir/atmosphere/convection"
# ============================================================
# atmosphere/temperature
# ============================================================
move_module "temper.rs" "$m_dir/atmosphere/temperature"
move_module "temcor.rs" "$m_dir/atmosphere/temperature"
move_module "tlocal.rs" "$m_dir/atmosphere/temperature"
move_module "lucy.rs" "$m_dir/atmosphere/temperature"
move_module "tdpini.rs" "$m_dir/atmosphere/temperature"
# ============================================================
# atmosphere/depth
# ============================================================
move_module "newdm.rs" "$m_dir/atmosphere/depth"
move_module "newdmt.rs" "$m_dir/atmosphere/depth"
move_module "dmder.rs" "$m_dir/atmosphere/depth"
move_module "dmeval.rs" "$m_dir/atmosphere/depth"
move_module "zmrho.rs" "$m_dir/atmosphere/depth"
move_module "column.rs" "$m_dir/atmosphere/depth"
move_module "gridp.rs" "$m_dir/atmosphere/depth"
# ============================================================
# atmosphere/hydrostatic
# ============================================================
move_module "hesolv.rs" "$m_dir/atmosphere/hydrostatic"
move_module "hesol6.rs" "$m_dir/atmosphere/hydrostatic"
# ============================================================
# atmosphere/grey
# ============================================================
move_module "greyd.rs" "$m_dir/atmosphere/grey"
# ============================================================
# atmosphere/odf
# ============================================================
move_module "odf1.rs" "$m_dir/atmosphere/odf"
move_module "odffr.rs" "$m_dir/atmosphere/odf"
move_module "odfhst.rs" "$m_dir/atmosphere/odf"
move_module "odfhyd.rs" "$m_dir/atmosphere/odf"
move_module "odfhys.rs" "$m_dir/atmosphere/odf"
move_module "odfmer.rs" "$m_dir/atmosphere/odf"
# ============================================================
# spectral
# ============================================================
move_module "linpro.rs" "$m_dir/spectral"
move_module "linsel.rs" "$m_dir/spectral"
move_module "linspl.rs" "$m_dir/spectral"
move_module "linfrq.rs" "$m_dir/spectral"
move_module "linovr.rs" "$m_dir/spectral"
move_module "linfxd.rs" "$m_dir/spectral"
move_module "sigmar.rs" "$m_dir/spectral"
move_module "sigave.rs" "$m_dir/spectral"
move_module "sigk.rs" "$m_dir/spectral"
move_module "rossop.rs" "$m_dir/spectral"
move_module "rosstd.rs" "$m_dir/spectral"
move_module "radpre.rs" "$m_dir/spectral"
move_module "radtot.rs" "$m_dir/spectral"
move_module "meanop.rs" "$m_dir/spectral"
move_module "meanopt.rs" "$m_dir/spectral"
# ============================================================
# model_init
# ============================================================
move_module "inilam.rs" "$m_dir/model_init"
move_module "inifrc.rs" "$m_dir/model_init"
move_module "inifrs.rs" "$m_dir/model_init"
move_module "inifrt.rs" "$m_dir/model_init"
move_module "inpdis.rs" "$m_dir/model_init"
move_module "change.rs" "$m_dir/model_init"
move_module "hedif.rs" "$m_dir/model_init"
move_module "chctab.rs" "$m_dir/model_init"
move_module "dwnfr.rs" "$m_dir/model_init"
move_module "dwnfr0.rs" "$m_dir/model_init"
move_module "dwnfr1.rs" "$m_dir/model_init"
move_module "levset.rs" "$m_dir/model_init"
move_module "levgrp.rs" "$m_dir/model_init"
move_module "visini.rs" "$m_dir/model_init"
move_module "grcor.rs" "$m_dir/model_init"
move_module "rap.rs" "$m_dir/model_init"
# ============================================================
# io
# ============================================================
move_module "output.rs" "$m_dir/io"
move_module "rdata.rs" "$m_dir/io"
move_module "rdatax.rs" "$m_dir/io"
move_module "readbf.rs" "$m_dir/io"
move_module "inkul.rs" "$m_dir/io"
move_module "timing.rs" "$m_dir/io"
move_module "getwrd.rs" "$m_dir/io"
move_module "quit.rs" "$m_dir/io"
move_module "prchan.rs" "$m_dir/io"
move_module "princ.rs" "$m_dir/io"
move_module "prnt.rs" "$m_dir/io"
# ============================================================
# utils
# ============================================================
move_module "pzert.rs" "$m_dir/utils"
move_module "pzevld.rs" "$m_dir/utils"
move_module "pzeval.rs" "$m_dir/utils"
move_module "corrwm.rs" "$m_dir/utils"
move_module "coolrt.rs" "$m_dir/utils"
move_module "rechck.rs" "$m_dir/utils"
move_module "russel.rs" "$m_dir/utils"
move_module "moleq.rs" "$m_dir/utils"
move_module "rhonen.rs" "$m_dir/utils"
move_module "rhoeos.rs" "$m_dir/utils"
move_module "radpre.rs" "$m_dir/utils"
move_module "radtot.rs" "$m_dir/utils"
move_module "raph.rs" "$m_dir/utils"
move_module "brte.rs" "$m_dir/utils"
move_module "brtez.rs" "$m_dir/utils"
echo "Done"

438
scripts/refactor_modules.sh Normal file
View File

@ -0,0 +1,438 @@
#!/!/bin/bash
# TLUSTY 模块重构脚本
# 将 src/tlusty/math 中的模块按功能重新组织到新的目录结构
set -e
# 项目根目录
PROJECT_ROOT="C:/Users/fmq/Documents/astro/SpectraRust"
SRC_DIR="$PROJECT_ROOT/src/tlusty"
math_DIR="$PROJECT_ROOT/src/tlusty/math"
new_dir="$PROJECT_ROOT/src/tlusty"
/math"
mkdir -p "$math_dir/math"
mkdir -p "$math_dir/math/special"
mkdir -p "$math_dir/math/solvers"
mkdir -p "$math_dir/math/interpolate"
mkdir -p "$math_dir/math/utils"
mkdir -p "$math_dir/physics/opacity"
mkdir -p "$math_dir/physics/cross_section"
mkdir -p "$math_dir/physics/collision"
mkdir -p "$math_dir/physics/line_profile"
mkdir -p "$math_dir/physics/radiative"
mkdir -p "$math_dir/physics/thermodynamics"
mkdir -p "$math_dir/physics/hydrogen"
mkdir -p "$math_dir/equilibrium"
mkdir -p "$math_dir/linearization"
mkdir -p "$math_dir/acceleration"
mkdir -p "$math_dir/atmosphere"
mkdir -p "$math_dir/spectral"
mkdir -p "$math_dir/model_init"
mkdir -p "$math_dir/io"
mkdir -p "$math_dir/utils"
# ============================================================
# 1. math/special/ - 特殊函数 (expint, expo, erfcx, gauleg, expinx)
# ============================================================
move_module "expo" "$math_dir/math/special"
move_module "expint" "$math_dir/math/special"
move_module "expinx" "$math_dir/math/special"
move_module "erfcx" "$math_dir/math/special"
move_module "gauleg" "$math_dir/math/special"
# ============================================================
# 2. math/solvers/ - 方程求解器 (tridag, lineqs, minv3, cubic, quartc, solve, solves, laguer, ubeta, psolve, levsol)
# ============================================================
move_module "tridag" "$math_dir/math/solvers"
move_module "lineqs" "$math_dir/math/solvers"
move_module "minv3" "$math_dir/math/solvers"
move_module "cubic" "$math_dir/math/solvers"
move_module "quartc" "$math_dir/math/solvers"
move_module "solve" "$math_dir/math/solvers"
move_module "solves" "$math_dir/math/solvers"
move_module "laguer" "$math_dir/math/solvers"
move_module "ubeta" "$math_dir/math/solvers"
move_module "psolve" "$math_dir/math/solvers"
move_module "levsol" "$math_dir/math/solvers"
# ============================================================
# 3. math/interpolate/ - 插值函数 (lagran, yint, ylintp, interpolate, tabint, locate, indexx)
# ============================================================
move_module "lagran" "$math_dir/math/interpolate"
move_module "yint" "$math_dir/math/interpolate"
move_module "ylintp" "$math_dir/math/interpolate"
move_module "interpolate" "$math_dir/math/interpolate"
move_module "tabint" "$math_dir/math/interpolate"
move_module "locate" "$math_dir/math/interpolate"
move_module "indexx" "$math_dir/math/interpolate"
# ============================================================
# 4. math/utils/ - 其他工具 (ubeta)
ubeta, indexx)
# ============================================================
move_module "ubeta" "$math_dir/math/utils"
move_module "indexx" "$math_dir/math/utils"
# ============================================================
# 5. physics/opacity/ - 不透明度计算
move_module "opacf0" "$math_dir/physics/opacity"
move_module "opacf1" "$math_dir/physics/opacity"
move_module "opacfa" "$math_dir/physics/opacity"
move_module "opacfd" "$math_dir/physics/opacity"
move_module "opacfl" "$math_dir/physics/opacity"
move_module "opadd" "$math_dir/physics/opacity"
move_module "opadd0" "$math_dir/physics/opacity"
move_module "opahst" "$math_dir/physics/opacity"
move_module "opaini" "$math_dir/physics/opacity"
move_module "opctab" "$math_dir/physics/opacity"
move_module "opdata" "$math_dir/physics/opacity"
move_module "opfrac" "$math_dir/physics/opacity"
move_module "traini" "$math_dir/physics/opacity"
move_module "meanop" "$math_dir/physics/opacity"
move_module "meanopt" "$math_dir/physics/opacity"
move_module "opact1" "$math_dir/physics/opacity"
move_module "opactd" "$math_dir/physics/opacity"
move_module "opactr" "$math_dir/physics/opacity"
# ============================================================
# 6. physics/cross_section/ - 截面计算
mkdir -p "$math_dir/physics/cross_section/photoion"
mkdir -p "$math_dir/physics/cross_section/bound_free"
mkdir -p "$math_dir/physics/cross_section/free_free"
mkdir -p "$math_dir/physics/cross_section/cia"
mkdir -p "$math_dir/physics/cross_section/rayleigh"
mkdir -p "$math_dir/physics/cross_section/gaunt"
mkdir -p "$math_dir/physics/cross_section/hydrogen"
mkdir -p "$math_dir/physics/cross_section/stark"
mkdir -p "$math_dir/physics/cross_section/broadening"
mkdir -p "$math_dir/physics/cross_section/spectral"
mkdir -p "$math_dir/physics/cross_section/radiative"
mkdir -p "$math_dir/physics/cross_section/equilibrium"
# ============================================================
move_module "cross" "$math_dir/physics/cross_section/photoion"
move_module "verner" "$math_dir/physics/cross_section/photoion"
move_module "vern16" "$math_dir/physics/cross_section/photoion"
move_module "vern18" "$math_dir/physics/cross_section/photoion"
move_module "vern20" "$math_dir/physics/cross_section/photoion"
move_module "vern26" "$math_dir/physics/cross_section/photoion"
move_module "topbas" "$math_dir/physics/cross_section/photoion"
move_module "sigk" "$math_dir/physics/cross_section/photoion"
move_module "sigave" "$math_dir/physics/cross_section/photoion"
move_module "bkhsgo" "$math_dir/physics/cross_section/photoion"
move_module "hidalg" "$math_dir/physics/cross_section/photoion"
move_module "reiman" "$math_dir/physics/cross_section/photoion"
move_module "hephot" "$math_dir/physics/cross_section/photoion"
move_module "carbon" "$math_dir/physics/cross_section/photoion"
move_module "ckoest" "$math_dir/physics/cross_section/photoion"
move_module "sbfch" "$math_dir/physics/cross_section/bound_free"
move_module "sbfhe1" "$math_dir/physics/cross_section/bound_free"
move_module "sbfhmi" "$math_dir/physics/cross_section/bound_free"
move_module "sbfhmi_old" "$math_dir/physics/cross_section/bound_free"
move_module "sbfoh" "$math_dir/physics/cross_section/bound_free"
move_module "ffcros" "$math_dir/physics/cross_section/free_free"
move_module "sffhmi" "$math_dir/physics/cross_section/free_free"
move_module "sffhmi_add" "$math_dir/physics/cross_section/free_free"
move_module "h2minus" "$math_dir/physics/cross_section/free_free"
move_module "cia_h2h" "$math_dir/physics/cross_section/cia"
move_module "cia_h2h2" "$math_dir/physics/cross_section/cia"
move_module "cia_hhe" "$math_dir/physics/cross_section/cia"
move_module "rayleigh" "$math_dir/physics/cross_section/rayleigh"
move_module "rayset" "$math_dir/physics/cross_section/rayleigh"
move_module "gaunt" "$math_dir/physics/cross_section/gaunt"
move_module "gfree" "$math_dir/physics/cross_section/gaunt"
move_module "gntk" "$math_dir/physics/cross_section/gaunt"
move_module "ghydop" "$math_dir/physics/cross_section/hydrogen"
move_module "xk2dop" "$math_dir/physics/cross_section/hydrogen"
move_module "intxen" "$math_dir/physics/cross_section/hydrogen"
move_module "intlem" "$math_dir/physics/cross_section/hydrogen"
move_module "lemini" "$math_dir/physics/cross_section/hydrogen"
move_module "inthyd" "$math_dir/physics/cross_section/stark"
move_module "starka" "$math_dir/physics/cross_section/stark"
move_module "divstr" "$math_dir/physics/cross_section/stark"
move_module "dopgam" "$math_dir/physics/cross_section/broadening"
move_module "gami" "$math_dir/physics/cross_section/broadening"
move_module "gamsp" "$math_dir/physics/cross_section/broadening"
move_module "gvdw" "$math_dir/physics/cross_section/broadening"
move_module "lymlin" "$math_dir/physics/cross_section/hydrogen"
move_module "sghe12" "$math_dir/physics/cross_section/hydrogen"
move_module "sgmer" "$math_dir/physics/cross_section/hydrogen"
move_module "sgmer1" "$math_dir/physics/cross_section/hydrogen"
move_module "sigmar" "$math_dir/physics/cross_section/spectral"
move_module "sigave" "$math_dir/physics/cross_section/spectral"
move_module "rossop" "$math_dir/physics/cross_section/spectral"
move_module "rosstd" "$math_dir/physics/cross_section/spectral"
move_module "radpre" "$math_dir/physics/cross_section/radiative"
move_module "radtot" "$math_dir/physics/cross_section/radiative"
move_module "rechck" "$math_dir/physics/cross_section/radiative"
move_module "russel" "$math_dir/physics/cross_section/equilibrium"
move_module "moleq" "$math_dir/physics/cross_section/equilibrium"
move_module "rhonen" "$math_dir/physics/cross_section/equilibrium"
move_module "rhoeos" "$math_dir/physics/cross_section/equilibrium"
move_module "state" "$math_dir/physics/cross_section/equilibrium"
# ============================================================
# 7. physics/collision/ - 碰撞过程
mkdir -p "$math_dir/physics/collision"
move_module "colh" "$math_dir/physics/collision"
move_module "colhe" "$math_dir/physics/collision"
move_module "colis" "$math_dir/physics/collision"
move_module "collhe" "$math_dir/physics/collision"
move_module "butler" "$math_dir/physics/collision"
move_module "ceh12" "$math_dir/physics/collision"
move_module "cheav" "$math_dir/physics/collision"
move_module "cheavj" "$math_dir/physics/collision"
move_module "cspec" "$math_dir/physics/collision"
move_module "cion" "$math_dir/physics/collision"
move_module "irc" "$math_dir/physics/collision"
move_module "szirc" "$math_dir/physics/collision"
move_module "dielrc" "$math_dir/physics/collision"
move_module "dietot" "$math_dir/physics/collision"
move_module "ctdata" "$math_dir/physics/collision"
# ============================================================
# 8. physics/line_profile/ - 谱线轮廓
mkdir -p "$math_dir/physics/line_profile"
move_module "voigt" "$math_dir/physics/line_profile"
move_module "voigte" "$math_dir/physics/line_profile"
move_module "profil" "$math_dir/physics/line_profile"
move_module "profsp" "$math_dir/physics/line_profile"
move_module "xk2dop" "$math_dir/physics/line_profile"
move_module "stark0" "$math_dir/physics/line_profile"
move_module "starka" "$math_dir/physics/line_profile"
move_module "divstr" "$math_dir/physics/line_profile"
move_module "inthyd" "$math_dir/physics/line_profile"
move_module "intlem" "$math_dir/physics/line_profile"
move_module "intxen" "$math_dir/physics/line_profile"
move_module "lemini" "$math_dir/physics/line_profile"
move_module "gomini" "$math_dir/physics/line_profile"
move_module "allard" "$math_dir/physics/line_profile"
move_module "allardt" "$math_dir/physics/line_profile"
move_module "quasim" "$math_dir/physics/line_profile"
move_module "dopgam" "$math_dir/physics/line_profile"
move_module "gami" "$math_dir/physics/line_profile"
move_module "gamsp" "$math_dir/physics/line_profile"
move_module "gvdw" "$math_dir/physics/line_profile"
# ============================================================
# 9. physics/radiative/ - 辐射转移方程
mkdir -p "$math_dir/physics/radiative"
move_module "rteang" "$math_dir/physics/radiative"
move_module "rtecf0" "$math_dir/physics/radiative"
move_module "rtecf1" "$math_dir/physics/radiative"
move_module "rtedf1" "$math_dir/physics/radiative"
move_module "rtedf2" "$math_dir/physics/radiative"
move_module "rtefe2 "$math_dir/physics/radiative"
move_module "rtefr1" "$math_dir/physics/radiative"
move_module "rteint" "$math_dir/physics/radiative"
move_module "rtesol" "$math_dir/physics/radiative"
move_module "rte_sc" "$math_dir/physics/radiative"
move_module "compt0" "$math_dir/physics/radiative"
move_module "comset" "$math_dir/physics/radiative"
move_module "angset" "$math_dir/physics/radiative"
move_module "inicom" "$math_dir/physics/radiative"
move_module "rtecmc" "$math_dir/physics/radiative"
move_module "rtecmu" "$math_dir/physics/radiative"
move_module "rtecom" "$math_dir/physics/radiative"
move_module "prd" "$math_dir/physics/radiative"
move_module "prdin" "$math_dir/physics/radiative"
move_module "prdini" "$math_dir/physics/radiative"
move_module "radtot" "$math_dir/physics/radiative"
move_module "radpre" "$math_dir/physics/radiative"
# ============================================================
# 10. physics/thermodynamics/ - 热力学
mkdir -p "$math_dir/physics/thermodynamics"
move_module "state" "$math_dir/physics/thermodynamics"
move_module "rhoeos" "$math_dir/physics/thermodynamics"
move_module "rhonen" "$math_dir/physics/thermodynamics"
move_module "eldens" "$math_dir/physics/thermodynamics"
move_module "elcor" "$math_dir/physics/thermodynamics"
move_module "eldenc" "$math_dir/physics/thermodynamics"
move_module "entene" "$math_dir/physics/thermodynamics"
move_module "trmder" "$math_dir/physics/thermodynamics"
move_module "trmdrt" "$math_dir/physics/thermodynamics"
move module "setdrt" "$math_dir/physics/thermodynamics"
move_module "prsent" "$math_dir/physics/thermodynamics"
move_module "pgset" "$math_dir/physics/thermodynamics"
move_module "betah" "$math_dir/physics/thermodynamics"
# ============================================================
# 11. physics/hydrogen/ - 氢原子特殊处理
mkdir -p "$math_dir/physics/hydrogen"
move_module "wn" "$math_dir/physics/hydrogen"
move_module "wnstor" "$math_dir/physics/hydrogen"
move_module "lymlin" "$math_dir/physics/hydrogen"
move_module "ghydop" "$math_dir/physics/hydrogen"
# ============================================================
# 12. equilibrium/ - 平衡计算
mkdir -p "$math_dir/equilibrium"
move_module "rates1" "$math_dir/equilibrium"
move_module "ratmat" "$math_dir/equilibrium"
move_module "ratmal" "$math_dir/equilibrium"
move_module "ratsp1" "$math_dir/equilibrium"
move_module "steqeq" "$math_dir/equilibrium"
move_module "reflev" "$math_dir/equilibrium"
move_module "sabolf" "$math_dir/equilibrium"
move_module "newpop" "$math_dir/equilibrium"
move_module "russel" "$math_dir/equilibrium"
move_module "moleq" "$math_dir/equilibrium"
move_module "partf" "$math_dir/equilibrium"
move_module "mpartf" "$math_dir/equilibrium"
move_module "pfcno" "$math_dir/equilibrium"
move_module "pffe" "$math_dir/equilibrium"
move_module "pfheav" "$math_dir/equilibrium"
move module "pfni" "$math_dir/equilibrium"
move_module "pfspec" "$math_dir/equilibrium"
move_module "tiopf" "$math_dir/equilibrium"
move_module "levset" "$math_dir/equilibrium"
move_module "levgrp" "$math_dir/equilibrium"
# ============================================================
# 13. linearization/ - 完全线性化方法
mkdir -p "$math_dir/linearization"
move_module "bhe" "$math_dir/linearization"
move_module "bre" "$math_dir/linearization"
move module "brez" "$math_dir/linearization"
move module "brte" "$math_dir/linearization"
move module "brtez" "$math_dir/linearization"
move_module "bpop" "$math_dir/linearization"
move_module "bpopc" "$math_dir/linearization"
move module "bpope" "$math_dir/linearization"
move_module "bpopf" "$math_dir/linearization"
move_module "bpopt" "$math_dir/linearization"
move module "emat" "$math_dir/linearization"
move_module "matcon" "$math_dir/linearization"
move_module "matgen" "$math_dir/linearization"
move module "matinv" "$math_dir/linearization"
move module "rhsgen" "$math_dir/linearization"
move module "solve" "$math_dir/linearization"
move module "solves" "$math_dir/linearization"
move module "levsol" "$math_dir/linearization"
move_module "rybmat" "$math_dir/linearization"
move_module "rybheq" "$math_dir/linearization"
move module "rybene" "$math_dir/linearization"
move module "rybchn" "$math_dir/linearization"
move module "rybsol" "$math_dir/linearization"
# ============================================================
# 14. acceleration/ - 加速算法
mkdir -p "$math_dir/acceleration"
move_module "alifr1" "$math_dir/acceleration"
move_module "alifr3" "$math_dir/acceleration"
move module "alifr6" "$math_dir/acceleration"
move module "alifrk" "$math_dir/acceleration"
move module "alisk1" "$math_dir/acceleration"
move module "alisk2" "$math_dir/acceleration"
move module "alist1" "$math_dir/acceleration"
move module "alist2" "$math_dir/acceleration"
move_module "ijali2" "$math_dir/acceleration"
move_module "ijalis" "$math_dir/acceleration"
move_module "getlal" "$math_dir/acceleration"
move_module "accel2" "$math_dir/acceleration"
move_module "accelp" "$math_dir/acceleration"
move_module "osccor" "$math_dir/acceleration"
move_module "taufr1" "$math_dir/acceleration"
# ============================================================
# 15. atmosphere/ - 大气模型
mkdir -p "$math_dir/atmosphere"
move_module "convec" "$math_dir/atmosphere"
move_module "concor" "$math_dir/atmosphere"
move module "conout" "$math_dir/atmosphere"
move_module "conref" "$math_dir/atmosphere"
move module "contmd" "$math_dir/atmosphere"
move_module "contmp" "$math_dir/atmosphere"
move module "temper" "$math_dir/atmosphere"
move_module "temcor" "$math_dir/atmosphere"
move module "tlocal" "$math_dir/atmosphere"
move module "lucy" "$math_dir/atmosphere"
move_module "tdpini" "$math_dir/atmosphere"
move_module "newdm" "$math_dir/atmosphere"
move module "newdmt" "$math_dir/atmosphere"
move module "dmder" "$math_dir/atmosphere"
move_module "dmeval" "$math_dir/atmosphere"
move module "zmrho" "$math_dir/atmosphere"
move module "column" "$math_dir/atmosphere"
move module "gridp" "$math_dir/atmosphere"
move module "hesolv" "$math_dir/atmosphere"
move_module "hesol6" "$math_dir/atmosphere"
move module "greyd" "$math_dir/atmosphere"
move_module "odf1" "$math_dir/atmosphere"
move_module "odffr" "$math_dir/atmosphere"
move_module "odfhst" "$math_dir/atmosphere"
move_module "odfhyd" "$math_dir/atmosphere"
move_module "odfhys" "$math_dir/atmosphere"
move module "odfmer" "$math_dir/atmosphere"
# ============================================================
# 16. spectral/ - 谱线处理
mkdir -p "$math_dir/spectral"
move_module "linpro" "$math_dir/spectral"
move_module "linsel" "$math_dir/spectral"
move_module "linspl" "$math_dir/spectral"
move_module "linfrq" "$math_dir/spectral"
move_module "linovr" "$math_dir/spectral"
move module "linfxd" "$math_dir/spectral"
move_module "sigmar" "$math_dir/spectral"
move module "sigave" "$math_dir/spectral"
move module "sigk" "$math_dir/spectral"
move_module "rossop" "$math_dir/spectral"
move module "rosstd" "$math_dir/spectral"
move module "radpre" "$math_dir/spectral"
move module "radtot" "$math_dir/spectral"
move module "meanop" "$math_dir/spectral"
move module "meanopt" "$math_dir/spectral"
# ============================================================
# 17. model_init/ - 模型初始化
mkdir -p "$math_dir/model_init"
move_module "inilam" "$math_dir/model_init"
move_module "inifrc" "$math_dir/model_init"
move_module "inifrs" "$math_dir/model_init"
move_module "inifrt" "$math_dir/model_init"
move_module "inpdis" "$math_dir/model_init"
move_module "change" "$math_dir/model_init"
move_module "hedif" "$math_dir/model_init"
move_module "chctab" "$math_dir/model_init"
move_module "inifrs" "$math_dir/model_init"
move_module "inifrt" "$math_dir/model_init"
move module "dwnfr" "$math_dir/model_init"
move_module "dwnfr0" "$math_dir/model_init"
move_module "dwnfr1" "$math_dir/model_init"
move_module "levset" "$math_dir/model_init"
move module "levgrp" "$math_dir/model_init"
move module "visini" "$math_dir/model_init"
move_module "grcor" "$math_dir/model_init"
move_module "rap" "$math_dir/model_init"
# ============================================================
# 18. io/ - 输入输出
mkdir -p "$math_dir/io"
move_module "output" "$math_dir/io"
move_module "rdata" "$math_dir/io"
move_module "rdatax" "$math_dir/io"
move_module "readbf" "$math_dir/io"
move_module "inkul" "$math_dir/io"
move_module "timing" "$math_dir/io"
move_module "getwrd" "$math_dir/io"
move_module "quit" "$math_dir/io"
move_module "prchan" "$math_dir/io"
move_module "princ" "$math_dir/io"
move module "prnt" "$math_dir/io"
# ============================================================
# 19. utils - 杂项工具
mkdir -p "$math_dir/utils"
move_module "pzert" "$math_dir/utils"
move_module "pzevld" "$math_dir/utils"
move module "corrwm" "$math_dir/utils"
move_module "dwnfr" "$math_dir/utils"
move_module "dwnfr0" "$math_dir/utils"
move_module "dwnfr1" "$math_dir/utils"
# ============================================================
# 20. Other modules - 杂项
mkdir -p "$math_dir/utils"
move_module "grcor" "$math_dir/utils"
move_module "betah" "$math_dir/utils"
move_module "coolrt" "$math_dir/utils"
move module "rechck" "$math_dir/utils"
move_module "russel" "$math_dir/utils"
move_module "moleq" "$math_dir/utils"
move_module "rhonen" "$math_dir/utils"
move_module "rhoeos" "$math_dir/utils"
move_module "radpre" "$math_dir/utils"
move module "radtot" "$math_dir/utils"
move module "raph" "$math_dir/utils"
move_module "brte" "$math_dir/utils"
move_module "brtez" "$math_dir/utils"
move_module "pzeval" "$math_dir/utils"
move module "pzevld" "$math_dir/utils"
echo "模块 organized by function!"

View File

@ -6,7 +6,7 @@
//! //!
//! 设置光致电离截面数组,用于辐射转移计算。 //! 设置光致电离截面数组,用于辐射转移计算。
use crate::tlusty::math::sigk::{sigk, SigkParams}; use crate::tlusty::math::{sigk, SigkParams, OpData};
use crate::tlusty::state::atomic::AtomicData; use crate::tlusty::state::atomic::AtomicData;
use crate::tlusty::state::constants::{MCROSS, MFREQ}; use crate::tlusty::state::constants::{MCROSS, MFREQ};
@ -115,7 +115,7 @@ pub fn croset(params: &CrosetParams) -> Vec<Vec<f64>> {
itr: it, itr: it,
mode: 0, mode: 0,
atomic, atomic,
opdata: &crate::tlusty::math::topbas::OpData::default(), opdata: &crate::tlusty::math::OpData::default(),
}; };
cross[it][ij] = sigk(&sigk_params); cross[it][ij] = sigk(&sigk_params);
} }
@ -128,7 +128,7 @@ pub fn croset(params: &CrosetParams) -> Vec<Vec<f64>> {
itr: it, itr: it,
mode: 1, mode: 1,
atomic, atomic,
opdata: &crate::tlusty::math::topbas::OpData::default(), opdata: &crate::tlusty::math::OpData::default(),
}; };
cross[it][ij] = sigk(&sigk_params); cross[it][ij] = sigk(&sigk_params);
@ -226,7 +226,7 @@ pub fn crosew(params: &CrosewParams) -> Vec<Vec<f64>> {
itr: it, itr: it,
mode: 0, mode: 0,
atomic, atomic,
opdata: &crate::tlusty::math::topbas::OpData::default(), opdata: &crate::tlusty::math::OpData::default(),
}; };
cross[it][ij] = sigk(&sigk_params); cross[it][ij] = sigk(&sigk_params);
} }
@ -239,7 +239,7 @@ pub fn crosew(params: &CrosewParams) -> Vec<Vec<f64>> {
itr: it, itr: it,
mode: 1, mode: 1,
atomic, atomic,
opdata: &crate::tlusty::math::topbas::OpData::default(), opdata: &crate::tlusty::math::OpData::default(),
}; };
cross[it][ij] = sigk(&sigk_params); cross[it][ij] = sigk(&sigk_params);

View File

@ -7,7 +7,7 @@
//! - 最多 10 个 Doppler 宽度 //! - 最多 10 个 Doppler 宽度
//! - 共 MVOI=2001 个点 //! - 共 MVOI=2001 个点
use crate::tlusty::math::interp::interp; use crate::tlusty::math::interp;
/// Voigt 表步长 (每 Doppler 宽度的步数) /// Voigt 表步长 (每 Doppler 宽度的步数)
const VSTEPS: f64 = 200.0; const VSTEPS: f64 = 200.0;

View File

@ -379,7 +379,7 @@ fn setup_simpson(
_itr: i32, _itr: i32,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
if n % 2 != 1 { if n % 2 != 1 {
return Err(crate::tlusty::math::quit::quit_error( return Err(crate::tlusty::math::quit_error(
"even number of points in Simpson - LINSET", "even number of points in Simpson - LINSET",
n as i32, n as i32,
n as i32, n as i32,
@ -424,7 +424,7 @@ fn setup_modified_simpson(
m: usize, m: usize,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
if n % 2 != 1 { if n % 2 != 1 {
return Err(crate::tlusty::math::quit::quit_error( return Err(crate::tlusty::math::quit_error(
"even number of points in MSimpson - LINSET", "even number of points in MSimpson - LINSET",
n as i32, n as i32,
n as i32, n as i32,
@ -473,7 +473,7 @@ fn setup_modified_simpson(
// 处理 XMAX < 0 的情况(非对称) // 处理 XMAX < 0 的情况(非对称)
if n % 4 != 1 { if n % 4 != 1 {
return Err(crate::tlusty::math::quit::quit_error( return Err(crate::tlusty::math::quit_error(
"conflict in MSimpson - LINSET", "conflict in MSimpson - LINSET",
n as i32, n as i32,
n as i32, n as i32,

View File

@ -10,8 +10,8 @@
use std::path::Path; use std::path::Path;
use super::{FortranReader, IoError, Result}; use super::{FortranReader, IoError, Result};
use crate::tlusty::math::rayset::rayset; use crate::tlusty::math::rayset;
use crate::tlusty::math::rayleigh::{rayleigh, RayleighParams}; use crate::tlusty::math::{rayleigh, RayleighParams};
use crate::tlusty::state::constants::{MDEPTH, MTABR, MTABT}; use crate::tlusty::state::constants::{MDEPTH, MTABR, MTABT};
use crate::tlusty::state::model::{EosPar, NumbOpac, RaySct, RayTbl, TabLop, Vectors}; use crate::tlusty::state::model::{EosPar, NumbOpac, RaySct, RayTbl, TabLop, Vectors};
use crate::tlusty::state::config::BasNum; use crate::tlusty::state::config::BasNum;

View File

@ -0,0 +1,25 @@
//! ali module
mod alifr1;
mod alifr3;
mod alifr6;
mod alifrk;
mod alisk1;
mod alisk2;
mod alist1;
mod alist2;
mod ijali2;
mod ijalis;
mod taufr1;
pub use alifr1::*;
pub use alifr3::*;
pub use alifr6::*;
pub use alifrk::*;
pub use alisk1::*;
pub use alisk2::*;
pub use alist1::*;
pub use alist2::*;
pub use ijali2::*;
pub use ijalis::*;
pub use taufr1::*;

View File

@ -9,7 +9,7 @@
//! 1. 给定主量子数 n 内的所有态合并 //! 1. 给定主量子数 n 内的所有态合并
//! 2. 单重态和三重态分别合并 //! 2. 单重态和三重态分别合并
use super::cheavj::cheavj; use crate::tlusty::math::cheavj;
// ============================================================================ // ============================================================================
// 核心计算函数 // 核心计算函数

View File

@ -3,7 +3,7 @@
//! 重构自 TLUSTY `dietot.f` //! 重构自 TLUSTY `dietot.f`
//! 遍历所有离子和深度点,计算双电子复合速率和伪截面。 //! 遍历所有离子和深度点,计算双电子复合速率和伪截面。
use crate::tlusty::math::dielrc::dielrc; use crate::tlusty::math::dielrc;
use crate::tlusty::state::atomic::{AtoPar, IonPar, LevPar}; use crate::tlusty::state::atomic::{AtoPar, IonPar, LevPar};
use crate::tlusty::state::config::{BasNum, InpPar}; use crate::tlusty::state::config::{BasNum, InpPar};
use crate::tlusty::state::model::{LevAdd, ModPar}; use crate::tlusty::state::model::{LevAdd, ModPar};

View File

@ -0,0 +1,33 @@
//! atomic module
mod chctab;
mod cheav;
mod cheavj;
mod cion;
mod cross;
mod dielrc;
mod dietot;
mod ffcros;
mod gfree;
mod gntk;
mod vern16;
mod vern18;
mod vern20;
mod vern26;
mod verner;
pub use chctab::*;
pub use cheav::*;
pub use cheavj::*;
pub use cion::*;
pub use cross::*;
pub use dielrc::*;
pub use dietot::*;
pub use ffcros::*;
pub use gfree::*;
pub use gntk::*;
pub use vern16::*;
pub use vern18::*;
pub use vern20::*;
pub use vern26::*;
pub use verner::*;

View File

@ -0,0 +1,33 @@
//! continuum module
mod opacf0;
mod opacf1;
mod opacfa;
mod opacfd;
mod opacfl;
mod opact1;
mod opactd;
mod opactr;
mod opadd;
mod opadd0;
mod opahst;
mod opaini;
mod opctab;
mod opdata;
mod opfrac;
pub use opacf0::*;
pub use opacf1::*;
pub use opacfa::*;
pub use opacfd::*;
pub use opacfl::*;
pub use opact1::*;
pub use opactd::*;
pub use opactr::*;
pub use opadd::*;
pub use opadd0::*;
pub use opahst::*;
pub use opaini::*;
pub use opctab::*;
pub use opdata::*;
pub use opfrac::*;

View File

@ -294,13 +294,13 @@ fn crossd(
/// 计算 H⁻ 自由-自由不透明度 SFFHMI /// 计算 H⁻ 自由-自由不透明度 SFFHMI
fn sffhmi(popul_h: f64, fr: f64, t: f64) -> f64 { fn sffhmi(popul_h: f64, fr: f64, t: f64) -> f64 {
// 调用 sffhmi 模块的函数 // 调用 sffhmi 模块的函数
crate::tlusty::math::sffhmi::sffhmi(popul_h, fr, t) crate::tlusty::math::sffhmi(popul_h, fr, t)
} }
/// 计算自由-自由截面 FFCROS /// 计算自由-自由截面 FFCROS
fn ffcros(ion: i32, it: i32, t: f64, fr: f64) -> f64 { fn ffcros(ion: i32, it: i32, t: f64, fr: f64) -> f64 {
// 调用 ffcros 模块的函数 // 调用 ffcros 模块的函数
crate::tlusty::math::ffcros::ffcros(ion, it, t, fr) crate::tlusty::math::ffcros(ion, it, t, fr)
} }
/// 计算氢 Gaunt 因子 GFREE1 /// 计算氢 Gaunt 因子 GFREE1

View File

@ -4,7 +4,7 @@
//! //!
//! 对于给定频率点,计算所有深度点的吸收、发射和散射系数。 //! 对于给定频率点,计算所有深度点的吸收、发射和散射系数。
use super::opctab::{opctab, OpctabParams, OpctabTableData, OpctabModelState, OpctabOutput}; use crate::tlusty::math::{opctab, OpctabParams, OpctabTableData, OpctabModelState, OpctabOutput};
use crate::tlusty::state::constants::{HK, UN}; use crate::tlusty::state::constants::{HK, UN};
/// OPACT1 输入参数 /// OPACT1 输入参数
@ -18,7 +18,7 @@ pub struct Opact1Params<'a> {
/// 选项表标志 (<0: 添加电子散射, >0: 使用选项表) /// 选项表标志 (<0: 添加电子散射, >0: 使用选项表)
pub ioptab: i32, pub ioptab: i32,
/// Rayleigh 参数 (当 ifrayl > 0 时需要) /// Rayleigh 参数 (当 ifrayl > 0 时需要)
pub rayleigh_params: Option<&'a super::rayleigh::RayleighParams<'a>>, pub rayleigh_params: Option<&'a crate::tlusty::math::RayleighParams<'a>>,
} }
/// OPACT1 模型状态 /// OPACT1 模型状态

View File

@ -4,7 +4,7 @@
//! //!
//! 与 OPACT1 类似,但额外计算温度和密度导数。 //! 与 OPACT1 类似,但额外计算温度和密度导数。
use super::opctab::{opctab, OpctabParams, OpctabTableData, OpctabModelState, OpctabOutput}; use crate::tlusty::math::{opctab, OpctabParams, OpctabTableData, OpctabModelState, OpctabOutput};
use crate::tlusty::state::constants::{HK, UN}; use crate::tlusty::state::constants::{HK, UN};
/// 微分步长 /// 微分步长
@ -26,7 +26,7 @@ pub struct OpactdParams<'a> {
/// 选项表标志 /// 选项表标志
pub ioptab: i32, pub ioptab: i32,
/// Rayleigh 参数 /// Rayleigh 参数
pub rayleigh_params: Option<&'a super::rayleigh::RayleighParams<'a>>, pub rayleigh_params: Option<&'a crate::tlusty::math::RayleighParams<'a>>,
} }
/// OPACTD 模型状态 /// OPACTD 模型状态

View File

@ -11,8 +11,8 @@
//! - CH 和 OH 连续不透明度 //! - CH 和 OH 连续不透明度
//! - CIA (碰撞诱导吸收) 不透明度 //! - CIA (碰撞诱导吸收) 不透明度
use super::{cia_h2h, cia_h2h2, cia_h2he, cia_hhe, h2minus, sbfch, sbfoh}; use crate::tlusty::math::{cia_h2h, cia_h2h2, cia_h2he, cia_hhe, h2minus, sbfch, sbfoh, CiaH2h2Data, CiaH2heData, CiaH2hData, CiaHheData};
use crate::tlusty::math::sffhmi::sffhmi; use crate::tlusty::math::sffhmi;
// ============================================================================ // ============================================================================
// 常量 // 常量
@ -146,13 +146,13 @@ pub struct OpaddModel<'a> {
/// 连续跃迁计数 /// 连续跃迁计数
pub ncon: usize, pub ncon: usize,
/// CIA H2-H2 数据 /// CIA H2-H2 数据
pub cia_h2h2_data: &'a cia_h2h2::CiaH2h2Data, pub cia_h2h2_data: &'a CiaH2h2Data,
/// CIA H2-He 数据 /// CIA H2-He 数据
pub cia_h2he_data: &'a cia_h2he::CiaH2heData, pub cia_h2he_data: &'a CiaH2heData,
/// CIA H2-H 数据 /// CIA H2-H 数据
pub cia_h2h_data: &'a cia_h2h::CiaH2hData, pub cia_h2h_data: &'a CiaH2hData,
/// CIA H-He 数据 /// CIA H-He 数据
pub cia_hhe_data: &'a cia_hhe::CiaHheData, pub cia_hhe_data: &'a CiaHheData,
} }
/// OPADD 输出结果。 /// OPADD 输出结果。

View File

@ -10,7 +10,7 @@
//! - H2+ 束缚-自由和自由-自由 //! - H2+ 束缚-自由和自由-自由
//! - He- 自由-自由 //! - He- 自由-自由
use crate::tlusty::math::sbfhmi::sbfhmi; use crate::tlusty::math::sbfhmi;
/// 常量 (从 Fortran PARAMETER 语句) /// 常量 (从 Fortran PARAMETER 语句)
/// H I Rayleigh 散射阈值频率 /// H I Rayleigh 散射阈值频率

View File

@ -7,7 +7,7 @@
//! - 配置 M1FILE 和 M2FILE 数组 //! - 配置 M1FILE 和 M2FILE 数组
//! - 计算 Stark 参数 //! - 计算 Stark 参数
use crate::tlusty::math::stark0::stark0; use crate::tlusty::math::stark0;
/// 最大谱线数(与 Fortran NLMX 一致) /// 最大谱线数(与 Fortran NLMX 一致)
pub const NLMX: usize = 30; pub const NLMX: usize = 30;

View File

@ -9,7 +9,7 @@
//! //!
//! 这是一个简化版本所有插值都是线性的fortran中也是线性插值。 //! 这是一个简化版本所有插值都是线性的fortran中也是线性插值。
use crate::tlusty::math::rayleigh::{rayleigh, RayleighParams}; use crate::tlusty::math::{rayleigh, RayleighParams};
use crate::tlusty::state::model::{EosPar, RaySct}; use crate::tlusty::state::model::{EosPar, RaySct};
/// 参考频率 (FRRAY0) /// 参考频率 (FRRAY0)

View File

@ -18,9 +18,9 @@
//! 求解得到的 DELTA对数温度梯度用于更新温度结构。 //! 求解得到的 DELTA对数温度梯度用于更新温度结构。
use crate::tlusty::state::constants::{HALF, PCK, SIG4P, UN}; use crate::tlusty::state::constants::{HALF, PCK, SIG4P, UN};
use super::convec::{convec, ConvecConfig, ConvecParams}; use crate::tlusty::math::{convec, ConvecConfig, ConvecParams};
use super::cubic::{cubic, CubicCon}; use crate::tlusty::math::{cubic, CubicCon};
use super::conout::format_conout_header; use crate::tlusty::math::format_conout_header;
// ============================================================================ // ============================================================================
// 常量 // 常量

View File

@ -9,10 +9,10 @@
//! - 考虑辐射耗散效应 //! - 考虑辐射耗散效应
//! - 参考 Mihalas 恒星大气理论 //! - 参考 Mihalas 恒星大气理论
use super::trmder::{trmder, TrmderConfig, TrmderParams}; use crate::tlusty::math::{trmder, TrmderConfig, TrmderParams};
use super::trmdrt::{trmdrt, TrmdrtParams}; use crate::tlusty::math::{trmdrt, TrmdrtParams};
use super::prsent::{prsent, PrsentParams, ThermTables}; use crate::tlusty::math::{prsent, PrsentParams, ThermTables};
use super::eldens::EldensConfig; use crate::tlusty::math::EldensConfig;
use crate::tlusty::state::constants::{UN, HALF}; use crate::tlusty::state::constants::{UN, HALF};
// ============================================================================ // ============================================================================

View File

@ -0,0 +1,15 @@
//! convection module
mod concor;
mod conout;
mod conref;
mod contmd;
mod contmp;
mod convec;
pub use concor::*;
pub use conout::*;
pub use conref::*;
pub use contmd::*;
pub use contmp::*;
pub use convec::*;

View File

@ -7,9 +7,9 @@
//! - 分析各元素对电子密度的贡献 //! - 分析各元素对电子密度的贡献
//! - 输出电子供体信息 //! - 输出电子供体信息
use crate::tlusty::math::moleq::{moleq_pure, MoleqParams}; use crate::tlusty::math::{moleq_pure, MoleqParams};
use crate::tlusty::math::rhonen::{rhonen_pure, RhonenParams}; use crate::tlusty::math::{rhonen_pure, RhonenParams};
use crate::tlusty::math::state::{state_pure, StateParams}; use crate::tlusty::math::{state_pure, StateParams};
use crate::tlusty::state::constants::{MDEPTH, MLEVEL}; use crate::tlusty::state::constants::{MDEPTH, MLEVEL};
/// 最大温度表点数 /// 最大温度表点数

View File

@ -8,10 +8,10 @@
//! - 计算电荷守恒和粒子守恒 //! - 计算电荷守恒和粒子守恒
//! - 计算内能和熵 //! - 计算内能和熵
use crate::tlusty::math::lineqs::lineqs; use crate::tlusty::math::lineqs;
use crate::tlusty::math::moleq::{moleq_pure, MoleqParams, MoleculeEqData}; use crate::tlusty::math::{moleq_pure, MoleqParams, MoleculeEqData};
use crate::tlusty::math::mpartf::{mpartf, MpartfResult}; use crate::tlusty::math::{mpartf, MpartfResult};
use crate::tlusty::math::state::{state_pure, StateParams}; use crate::tlusty::math::{state_pure, StateParams};
use crate::tlusty::state::constants::{BOLK, HMASS, UN, TWO, HALF}; use crate::tlusty::state::constants::{BOLK, HMASS, UN, TWO, HALF};
/// ELDENS 配置参数 /// ELDENS 配置参数

View File

@ -2,7 +2,7 @@
//! //!
//! 重构自 TLUSTY `entene.f`。 //! 重构自 TLUSTY `entene.f`。
use crate::tlusty::math::mpartf::mpartf; use crate::tlusty::math::mpartf;
const EV2ERG: f64 = 1.6018e-12; const EV2ERG: f64 = 1.6018e-12;
const ENTCON: f64 = 103.973; const ENTCON: f64 = 103.973;

View File

@ -0,0 +1,19 @@
//! eos module
mod eldenc;
mod eldens;
mod entene;
mod moleq;
mod rhoeos;
mod rhonen;
mod russel;
mod steqeq;
pub use eldenc::*;
pub use eldens::*;
pub use entene::*;
pub use moleq::*;
pub use rhoeos::*;
pub use rhonen::*;
pub use russel::*;
pub use steqeq::*;

View File

@ -7,8 +7,8 @@
//! - 计算电子密度、熵、内能 //! - 计算电子密度、熵、内能
//! - 计算质量密度和平均分子量 //! - 计算质量密度和平均分子量
use crate::tlusty::math::mpartf::{mpartf, MpartfResult}; use crate::tlusty::math::{mpartf, MpartfResult};
use crate::tlusty::math::russel::{russel, MoleculeData, RusselParams, RusselOutput, MAX_ELEM, MAX_MOL}; use crate::tlusty::math::{russel, MoleculeData, RusselParams, RusselOutput, MAX_ELEM, MAX_MOL};
use crate::tlusty::state::constants::{BOLK, HMASS}; use crate::tlusty::state::constants::{BOLK, HMASS};
/// 常量 /// 常量

View File

@ -13,7 +13,7 @@
//! 2. 使用牛顿迭代法求解密度,使得计算的压力等于给定压力 //! 2. 使用牛顿迭代法求解密度,使得计算的压力等于给定压力
//! 3. 收敛条件:相对误差 < 1e-5 或达到最大迭代次数 //! 3. 收敛条件:相对误差 < 1e-5 或达到最大迭代次数
use super::{prsent, PrsentParams, ThermTables}; use crate::tlusty::math::{prsent, PrsentParams, ThermTables};
use crate::tlusty::state::constants::BOLK; use crate::tlusty::state::constants::BOLK;
/// 平均分子量相关常数(氢原子质量 / 2.3 /// 平均分子量相关常数(氢原子质量 / 2.3

View File

@ -6,7 +6,7 @@
//! - 从给定的温度和质量密度迭代求解总粒子密度和电子密度 //! - 从给定的温度和质量密度迭代求解总粒子密度和电子密度
//! - 使用 eldens 计算电子密度 //! - 使用 eldens 计算电子密度
use crate::tlusty::math::eldens::{eldens_pure, EldensConfig, EldensOutput, EldensParams}; use crate::tlusty::math::{eldens_pure, EldensConfig, EldensOutput, EldensParams};
use crate::tlusty::state::constants::{HMASS, UN}; use crate::tlusty::state::constants::{HMASS, UN};
/// RHONEN 输入参数 /// RHONEN 输入参数

View File

@ -7,7 +7,7 @@
//! - 使用 Newton-Raphson 方法求解 Russell 方程 //! - 使用 Newton-Raphson 方法求解 Russell 方程
//! - 计算电离平衡分布 //! - 计算电离平衡分布
use crate::tlusty::math::mpartf::mpartf; use crate::tlusty::math::mpartf;
/// 常量 /// 常量
const ECONST: f64 = 4.3426e-1; const ECONST: f64 = 4.3426e-1;

View File

@ -5,10 +5,10 @@
//! 计算氢的碰撞电离和碰撞激发速率。 //! 计算氢的碰撞电离和碰撞激发速率。
//! 标准表达式来自 Mihalas, Heasley, and Auer (1975)。 //! 标准表达式来自 Mihalas, Heasley, and Auer (1975)。
use super::butler::butler; use crate::tlusty::math::butler;
use super::ceh12::ceh12; use crate::tlusty::math::ceh12;
use super::cspec::cspec; use crate::tlusty::math::cspec;
use super::irc::irc; use crate::tlusty::math::irc;
use crate::tlusty::data::{COLH_CCOOL, COLH_CHOT}; use crate::tlusty::data::{COLH_CCOOL, COLH_CHOT};
use crate::tlusty::state::constants::{EH, HK, TWO, UN}; use crate::tlusty::state::constants::{EH, HK, TWO, UN};

View File

@ -9,11 +9,11 @@
//! - 支持多种碰撞速率公式Seaton、Allen、Van Regemorter 等) //! - 支持多种碰撞速率公式Seaton、Allen、Van Regemorter 等)
//! - 处理表格化碰撞数据 //! - 处理表格化碰撞数据
use super::cion::cion; use crate::tlusty::math::cion;
use super::colh::{colh, ColhAtomicData, ColhOutput, ColhParams}; use crate::tlusty::math::{colh, ColhAtomicData, ColhOutput, ColhParams};
use super::cspec::cspec; use crate::tlusty::math::cspec;
use super::irc::irc; use crate::tlusty::math::irc;
use super::ylintp::ylintp; use crate::tlusty::math::ylintp;
use crate::tlusty::state::constants::{EH, HK, TWO, UN}; use crate::tlusty::state::constants::{EH, HK, TWO, UN};
// ============================================================================ // ============================================================================

View File

@ -6,7 +6,7 @@
//! 使用 Bell 1980 的数据表进行双线性插值计算 H⁻ 自由-自由吸收系数。 //! 使用 Bell 1980 的数据表进行双线性插值计算 H⁻ 自由-自由吸收系数。
use crate::tlusty::data::{H2MINUS_FFKAPP, H2MINUS_FFLAMB, H2MINUS_FFTHET}; use crate::tlusty::data::{H2MINUS_FFKAPP, H2MINUS_FFLAMB, H2MINUS_FFTHET};
use crate::tlusty::math::locate::locate; use crate::tlusty::math::locate;
// 常量 // 常量
const BOLK: f64 = 1.380649e-16; // 玻尔兹曼常数 (erg/K) const BOLK: f64 = 1.380649e-16; // 玻尔兹曼常数 (erg/K)

View File

@ -8,8 +8,8 @@
//! 3. 状态方程 //! 3. 状态方程
//! 4. z-m 关系 //! 4. z-m 关系
use crate::tlusty::math::erfcx::erfcx; use crate::tlusty::math::erfcx;
use crate::tlusty::math::matinv::matinv; use crate::tlusty::math::matinv;
const UN: f64 = 1.0; const UN: f64 = 1.0;
const HALF: f64 = 0.5; const HALF: f64 = 0.5;

View File

@ -7,11 +7,11 @@
//! - 使用 Newton-Raphson 迭代方法 //! - 使用 Newton-Raphson 迭代方法
//! - 给定声速(总压力/密度),求解压力和深度分布 //! - 给定声速(总压力/密度),求解压力和深度分布
use crate::tlusty::math::erfcx::erfcx; use crate::tlusty::math::erfcx;
use crate::tlusty::math::matinv::matinv; use crate::tlusty::math::matinv;
use crate::tlusty::math::rhonen::{rhonen_pure, RhonenParams}; use crate::tlusty::math::{rhonen_pure, RhonenParams};
use crate::tlusty::math::steqeq::{steqeq_pure, SteqeqConfig, SteqeqParams}; use crate::tlusty::math::{steqeq_pure, SteqeqConfig, SteqeqParams};
use crate::tlusty::math::wnstor::wnstor; use crate::tlusty::math::wnstor;
use crate::tlusty::state::constants::{HALF, MDEPTH, TWO, UN}; use crate::tlusty::state::constants::{HALF, MDEPTH, TWO, UN};
/// HESOLV 辅助参数PRSAUX COMMON 块) /// HESOLV 辅助参数PRSAUX COMMON 块)

Some files were not shown because too many files have changed in this diff Show More