Skip to content

Commit dd15f74

Browse files
authored
Merge pull request #638 from bobmyhill/rm_funcs
Remove duplicate EoS functions
2 parents 5e5249b + 3731a1a commit dd15f74

25 files changed

+398
-831
lines changed

.github/workflows/coverage.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ jobs:
3232
3333
- name: Check coverage change
3434
run: |
35-
python -m pip install git+https://github.com/geodynamics/burnman@main
36-
mkdir main_tests
37-
cd main_tests
35+
mkdir main
36+
cd main
3837
git clone https://github.com/geodynamics/burnman
39-
cp burnman/tests/*.py .
40-
rm -fr burnman
41-
cd ../
42-
coverage run -m unittest discover ./main_tests
38+
cd burnman
39+
git status
40+
python -m pip install -e .[dev]
41+
coverage run -m unittest discover ./tests
4342
coverage report > main_coverage.tmp
4443
main_coverage=$(coverage report --precision=7 --format=total)
45-
rm -fr main_tests
44+
cd ../..
45+
rm -fr main
4646
python -m pip install -q -e .[dev]
4747
coverage run -m unittest discover ./tests
4848
coverage report > new_coverage.tmp

burnman/calibrants/Dorogokupets_2007.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -367,25 +367,23 @@ def _F_th(temperature, x, params):
367367
return F_qh + F_anh + F_el + F_def
368368

369369

370-
def _helmholtz_energy(volume, temperature, params):
371-
# Equation 6
372-
E = do_cold_eos.molar_internal_energy(0.0, 0.0, volume, params)
373-
370+
def _thermal_helmholtz_energy(volume, temperature, params):
374371
# Just after Equation 6b
375372
Vrel = volume / params["V_0"]
376373
Fth = _F_th(temperature, Vrel, params)
377374
Fth0 = _F_th(params["T_0"], Vrel, params)
378375

379376
# Equation 5
380-
return E + gas_constant * (Fth - Fth0)
377+
return gas_constant * (Fth - Fth0)
381378

382379

383380
def _pressure(volume, temperature, params):
381+
cold_pressure = do_cold_eos.pressure(temperature, volume, params)
384382
dV = params["V_0"] * 1.0e-7
385383

386-
F1 = _helmholtz_energy(volume + dV / 2.0, temperature, params)
387-
F0 = _helmholtz_energy(volume - dV / 2.0, temperature, params)
388-
return -(F1 - F0) / dV
384+
F1 = _thermal_helmholtz_energy(volume + dV / 2.0, temperature, params)
385+
F0 = _thermal_helmholtz_energy(volume - dV / 2.0, temperature, params)
386+
return cold_pressure - (F1 - F0) / dV
389387

390388

391389
class Ag(Calibrant):

burnman/classes/mineral.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ def _delta_volume(pressure, volume, temperature):
213213
self.set_state(
214214
self.method.pressure(temperature, volume, self.params), temperature
215215
)
216+
self._cached["_molar_volume_unmodified"] = volume
216217

217218
"""
218219
Properties from equations of state
@@ -430,7 +431,7 @@ def grueneisen_parameter(self):
430431
and (np.abs(self._property_modifiers["dGdP"]) < eps)
431432
and (np.abs(self._property_modifiers["d2GdT2"]) < eps)
432433
):
433-
return self.method.grueneisen_parameter(
434+
return self.method._grueneisen_parameter(
434435
self.pressure, self.temperature, self.molar_volume, self.params
435436
)
436437
else:

0 commit comments

Comments
 (0)