1C
2C
3C$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
4C EOS06MISC_MOD
5C$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
6C 10/20/26 MHP via Claude
7C code changed to convert COMMON/EOS06MISC/ into this module, completing
8C stages 3 and 4 (KNOWN_ISSUES.md issue 37).
9C
10C Imported with a blanket USE, the convention for the conversion.
11C All 9 declarations of this block were identical, so the USE
12C imports exactly the names the declaration already made global in
13C each scoping unit and cannot change meaning.
14C
15C The types restate what every declaring unit already gave them
16C explicitly. L1-L4 are INTEGER*4 despite the L: calcad.f, the one
17C declaring file with an IMPLICIT LOGICAL*4(L) rule, always typed them
18C INTEGER*4 explicitly. SAVE is explicit rather than relying on module
19C variables being implicitly saved, which holds only from Fortran 2008
20C while ifort Classic predates it. That matches COMMON's semantics.
21C
22C The dimension parameters are PRIVATE: they are OPAL06 table
23C dimensions, which each importing unit also declares (issue 10).
24C
25C The INDEX, NTA and NRA initializers moved here from esac06.f, because
26C DATA on a USE-associated name is rejected. The value lists are copied
27C verbatim. The originals used implied-DO lists covering each whole
28C array, written here as whole-array DATA, which stores the same values.
29 MODULE EOS06MISC_MOD
30
31 IMPLICIT NONE
32 SAVE
33
34 INTEGER*4, PARAMETER, PRIVATE :: MX = 5
35 INTEGER*4, PARAMETER, PRIVATE :: MV = 10
36 INTEGER*4, PARAMETER, PRIVATE :: NR = 169
37 INTEGER*4, PARAMETER, PRIVATE :: NT = 197
38
39 REAL*8 :: ESACT
40 REAL*8 :: EOS(MV)
41 REAL*8 :: Q(4)
42 REAL*8 :: H(4)
43 REAL*8 :: XXH
44 INTEGER*4 :: L1
45 INTEGER*4 :: L2
46 INTEGER*4 :: L3
47 INTEGER*4 :: L4
48 INTEGER*4 :: K1
49 INTEGER*4 :: K2
50 INTEGER*4 :: K3
51 INTEGER*4 :: K4
52 INTEGER*4 :: IP
53 INTEGER*4 :: IQ
54 REAL*8 :: ZZ(MX)
55 INTEGER*4 :: IRI(10)
56 INTEGER*4 :: INDEX(10)
57 INTEGER*4 :: NTA(NR)
58 INTEGER*4 :: NRA(NT)
59
60 DATA INDEX/1,2,3,4,5,6,7,8,9,10/
61 DATA NTA/87*197,7*191,190,2*189,185,179,170,2*149,
62 x x 133,125,123,122,120,115,113,107,102,2*80,72,68,66,64,62,56,54,
63 x x 52,51,2*50,49,47,2*45,43,42,28*40,39,37,36,35,34,32,31,30,
64 x x 29,27,26/
65 DATA NRA/ 26*169, 168, 2*167, 166, 165, 164,
66 x x 2*163, 162, 161, 160, 2*159, 158, 2*130, 129, 2*128,
67 x x 2*126, 2*125, 124, 122, 121, 2*120, 2*119, 6*118, 2*117,
68 x x 2*116, 2*115, 4*114, 8*113, 22*111, 5*110, 6*109, 2*108,
69 x x 5*107, 2*106, 105, 2*104, 8*103, 16*102, 21*100, 9* 99,
70 x x 6* 98, 4* 97, 95, 94, 6* 87/
71
72 END MODULE EOS06MISC_MOD
1"""Python version of eos06misc_mod.f (YREC 7be4133): results and workspace
2of the OPAL 2006 EOS interpolation, formerly COMMON/EEOS06/, /AAEOS06/,
3/BBEOS06/ and /BEOS06/.
4
5Translates: eos06misc_mod.f#EOS06MISC_MOD (7be4133)
6
7Routines that USE EOS06MISC_MOD import this module and write
8``eos06misc_mod.<name>``. Arrays have index 0 unused.
9"""
10
11import numpy as np
12
13# Table dimensions (PRIVATE in the Fortran) (Fortran lines 34–37).
14_MX = 5
15_MV = 10
16_NR = 169
17_NT = 197
18
19# Fortran lines 39–58.
20esact = 0.0 # one quantity at (T6, rho) (t6rinteos06)
21eos = np.zeros(_MV + 1) # the interpolated quantities (esac06); nine are computed
22q = np.zeros(5) # quadratics in T (t6rinteos06)
23h = np.zeros(5) # quadratics in rho (t6rinteos06)
24xxh = 0.0 # set and read nowhere (unused in the Fortran too)
25l1 = 0 # density indices around the point (esac06)
26l2 = 0
27l3 = 0
28l4 = 0
29k1 = 0 # temperature indices (esac06)
30k2 = 0
31k3 = 0
32k4 = 0
33ip = 0 # points used in each direction (esac06)
34iq = 0
35zz = np.zeros(_MX + 1) # Z of each table (readcoeos06)
36iri = np.zeros(11, dtype=int) # inverse of index (seteos06)
37index = np.arange(11) # storage order of the quantities, 1..10
38# Number of temperatures for each density, and of densities for each
39# temperature (initializers, expanded from the DATA repeat counts)
40# (Fortran lines 60–70).
41nta = np.array([0, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
42 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
43 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
44 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
45 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
46 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
47 197, 197, 197, 197, 197, 191, 191, 191, 191, 191, 191, 191, 190, 189,
48 189, 185, 179, 170, 149, 149, 133, 125, 123, 122, 120, 115, 113, 107,
49 102, 80, 80, 72, 68, 66, 64, 62, 56, 54, 52, 51, 50, 50, 49, 47, 45, 45,
50 43, 42, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
51 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 39, 37, 36, 35, 34, 32,
52 31, 30, 29, 27, 26])
53nra = np.array([0, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
54 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
55 168, 167, 167, 166, 165, 164, 163, 163, 162, 161, 160, 159, 159, 158,
56 130, 130, 129, 128, 128, 126, 126, 125, 125, 124, 122, 121, 120, 120,
57 119, 119, 118, 118, 118, 118, 118, 118, 117, 117, 116, 116, 115, 115,
58 114, 114, 114, 114, 113, 113, 113, 113, 113, 113, 113, 113, 111, 111,
59 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
60 111, 111, 111, 111, 111, 111, 110, 110, 110, 110, 110, 109, 109, 109,
61 109, 109, 109, 108, 108, 107, 107, 107, 107, 107, 106, 106, 105, 104,
62 104, 103, 103, 103, 103, 103, 103, 103, 103, 102, 102, 102, 102, 102,
63 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 100, 100, 100,
64 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
65 100, 100, 100, 100, 99, 99, 99, 99, 99, 99, 99, 99, 99, 98, 98, 98, 98,
66 98, 98, 97, 97, 97, 97, 95, 94, 87, 87, 87, 87, 87, 87])
67
68assert len(nta) == _NR + 1 and len(nra) == _NT + 1