HajimeKawahara / exojax

🐈 Automatic differentiable spectrum modeling of exoplanets/brown dwarfs using JAX, compatible with NumPyro and JAXopt
http://secondearths.sakura.ne.jp/exojax/
MIT License
45 stars 14 forks source link

Optimal Elower max #331

Closed HajimeKawahara closed 1 year ago

HajimeKawahara commented 1 year ago

The memory use of PreMODIT depends on the maximum value of Elower. We would optimize the max Elower which does not affect the cross section.

I made optgrid.py in pretimodit branch. a sample is given in endtoend/misc/optimal_elower.py

xsmode assumes ESLOG in wavenumber space: mode=premodit
HITRAN exact name= H2(16O)
Background atmosphere:  H2
Reading .database/H2O/1H2-16O/POKAZATEL/1H2-16O__POKAZATEL__06400-06500.trans.bz2
Reading .database/H2O/1H2-16O/POKAZATEL/1H2-16O__POKAZATEL__06500-06600.trans.bz2
.broad is used.
Broadening code level= a1
default broadening parameters are used for  12  J lower states in  63  states
Elower max in mdb =  34652.3 cm-1
OpaPremodit: init w/o params setting
OpaPremodit: params manually set.
Tref changed: 296.0K->296.0K
/home/kawahara/exojax/src/exojax/spec/initspec.py:199: UserWarning: elower is not np.float64 but float32
  warnings.warn(tag + ' is not np.float64 but ' + str(arr.dtype))
uniqidx: 100%|██████████████████████████████████████████| 12/12 [00:03<00:00,  3.33it/s]
Premodit: Twt= 900.0 K Tref= 296.0 K
 64%|███████████████████████████████▏                 | 221/347 [01:16<00:46,  2.72it/s]optimal Elower max =  12670.090812683105 cm-1

The original max Elower is 34652.3 cm-1 but at 900 K 0.01bar, the optimal Elower max (within accuracy =1%) is only 12670 cm-1. This compresses the memory use to 1/3.

HajimeKawahara commented 1 year ago

Addressed in #332