Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dixon_Degassing issues #123

Open
PennyWieser opened this issue Aug 31, 2020 · 9 comments
Open

Dixon_Degassing issues #123

PennyWieser opened this issue Aug 31, 2020 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@PennyWieser
Copy link
Collaborator

This is probably related to the still unresolved dixon issues (I tried running DanR's code using Python3 - no luck)

The Dixon degassing paths in VolatileCalc for an open system don't quite match VESIcal for the liquid, but match very well for the vapour...

image

Bit better at lower pressures
image

Interestingly, at least on the server, a model with 2 wt% H2O 500 ppm C never stops calculating (nor does it return an error). Would be interested if it does the same thing locally.

See Testing_Dixon script and excel file

@PennyWieser PennyWieser added the bug Something isn't working label Aug 31, 2020
@PennyWieser PennyWieser changed the title Dixon_Degassing Dixon_Degassing issues Aug 31, 2020
@simonwmatthews
Copy link
Collaborator

It appears that the fractionate_vapour variable isn't doing anything. I will look into this more this week.

@simonwmatthews
Copy link
Collaborator

Ignore my previous message, fractionate_vapour doesn't exist, but fractionate_vapor does... What are you setting as the initial pressure for the calculations? You can get very different results with different starting pressures. Using the same conditions in the Dixon 1995 paper (2wt% CO2, 1wt% H2O, 1200 bar start), I seem to be able to reproduce their results (though this could be similar to your second calculation).

The freezing might be if its failing to find a starting pressure for some reason- I'll try to get it to return an error instead.

@simonwmatthews
Copy link
Collaborator

The closed-system degassing models should be insensitive to the chosen starting point. So I'm really struggling to find the origin of the offset. Perhaps it is, as you suggested, related to the small difference we have seen before. I'll keep thinking.

@kaylai
Copy link
Owner

kaylai commented Sep 10, 2020

Having a related issue (or perhaps the same issue that Penny experienced) with Dixon degassing paths. When running Penny's Dixon calibration notebook (File: S2_Testing_Dixon_1997_VolatileCalc.ipynb), the execution hangs (sometimes it does complete, but it takes a long time...) on code cells [14] and [16] which looks like this:

Cell [14]

myfile_degass_input= v.ExcelFile('S2_Testing_Dixon_1997_VolatileCalc.xlsx',   input_type='wtpercent', sheet_name='Degassing_In')
data_degass_input = myfile_degass_input.data

SampleName_1H_500C=0
bulk_comp_1H_500C=myfile_degass_input.get_sample_oxide_comp(SampleName_1H_500C)
SampleName_1H_2000C=2
bulk_comp_1H_2000C=myfile_degass_input.get_sample_oxide_comp(SampleName_1H_2000C)

# Open system - fractionate vapor =1
open_df_1H_500C = v.calculate_degassing_path(sample=bulk_comp_1H_500C, temperature=1200, model='Dixon', fractionate_vapor=1).result
open_df_1H_2000C = v.calculate_degassing_path(sample=bulk_comp_1H_2000C, temperature=1200, model='Dixon', fractionate_vapor=1).result

Cell [16]

SampleName_2H_500C=2
bulk_comp_2H_500C=myfile_degass_input.get_sample_oxide_comp(SampleName_2H_500C)
open_df_2H_500C = v.calculate_degassing_path(sample=bulk_comp_2H_500C, temperature=1200, model='Dixon', fractionate_vapor=1).result

When cell [14] does complete. I get these error messages printed:

../../../../VESIcal.py:1720: RuntimeWarning: pressure exceeds 1000 bar, which Iacono-Marziano et al. (2012) suggest as an upper calibration limit of the Dixon (1997, Pi-SiO2 simpl.) Model, 
  w.warn(self.calib_check,RuntimeWarning)
../../../../VESIcal.py:5921: RuntimeWarning: Saturation pressure not found.
  xx0 = model.calculate_saturation_pressure(sample=sample,**kwargs)
../../../../VESIcal.py:5863: RuntimeWarning: Saturation pressure not found.
  satP = self.calculate_saturation_pressure(sample,**kwargs)
../../../../VESIcal.py:2719: RuntimeWarning: divide by zero encountered in double_scalars
  Temp2 = Temp1 - Q * self.FNF(Temp1, TK, A, B, P) / F_1
../../../../VESIcal.py:2703: RuntimeWarning: invalid value encountered in double_scalars
  return R * TK / (V - B) - A / ((V * V + B * V) * TK**0.5) - P

I'm assuming that a searching algorithm is getting trapped in some local minimum or maximum? But not really sure. Any thoughts?

@kaylai
Copy link
Owner

kaylai commented Sep 10, 2020

Important update!!! I figured out that the only way I can get those cells to finish executing is if I interrupt the kernel a couple of times (or maybe I could just wait hours and it would complete on it's own...). And it seems like the results might vary depending on when I interrupt it... see these plots I created after interrupting the kernel (compare to what Penny posted above):
plots-ex

@simonwmatthews
Copy link
Collaborator

What happens if you call .calculate_saturation_pressure() for that sample?

@kaylai
Copy link
Owner

kaylai commented Sep 11, 2020

Just ran a test, and all three samples (variable names bulk_comp_1H_500C, bulk_comp_1H_2000C, and bulk_comp_2H_500C) produce saturation pressures with Dixon of 1141.1248917704636, 1455.1129399216368, and 1455.1129399216368 bars, respectively.

Both the excel file with the input data and the jupyter notebook used to run all this is in manuscrupt > Supplement > Jupyter Notebooks > S2_Dixon

@simonwmatthews
Copy link
Collaborator

For the 2000 ppmw CO2 and 1wt% H2O case, the input sample has the wrong H2O and CO2 concentrations (it has 2 wt% and 500 ppmw). When I changed these after the sample is selected, the results are much closer, but not perfect still. However, it doesn't crash. I'm still not sure why it crashes on some samples. I'm still trying to fix that.

@PennyWieser
Copy link
Collaborator Author

Oops my bad, was changing inputs around to try to suss it out, must have swapped it at some point. Sorry for the additional confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants