-
Notifications
You must be signed in to change notification settings - Fork 1
jbuffo/Liquidus-1.0
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
{\rtf1\ansi\ansicpg1252\cocoartf1404\cocoasubrtf460 {\fonttbl\f0\fswiss\fcharset0 Helvetica;} {\colortbl;\red255\green255\blue255;} \margl1440\margr1440\vieww12120\viewh9340\viewkind0 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \f0\fs24 \cf0 README for MATLAB function liquidus.m\ \ liquidus.m is a MATLAB function that utilized the equilibrium chemistry package FREZCHEM v6.2 to calculate the liquidus curve for a given solution. The function takes as inputs a variety of solutes as well as temperature and concentration ranges.\ \ FUNCTION OPERATION.\ \'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\ Once opening the .zip folder containing the required files, the function can be run in MATLAB (either in the GUI or through terminal). To initiate the code, in the command window type:\ \ liquidus(T_HIGH, T_LOW, C_HIGH, C_LOW, INC, SALINITY, Na, K, Ca, Mg, Cl, Sulfate, Nitrate)\ \ where:\ \ T_HIGH (Kelvin)- is the upper temperature range you are interested in testing ( \b MUST BE BELOW 274.15K \b0 ), it is best to use a temperature above the liquidus (273.5 is always a safe bet)\ T_LOW (Kelvin)- is the lower temperature range you are interested in testing (so far I have gone to 243.15K, but it should be able to handle lower temps)\ C_HIGH (Multiplication factor to act on SALINITY value)- is the upper range of concentration you are interested in testing ( \b IMPORTANT: This is a multiplication factor for concentration and will be multiplied by your SALINITY value. Thus for a salinity value of 34ppt a C_HIGH of 7 will test up to 238ppt \b0 )\ C_LOW (Multiplication factor to act on SALINITY value) - is the lower range of concentration you are interested in testing ( \b IMPORTANT: DO NOT USE ZERO FOR THIS VALUE \b0 - other parts of the code depend on this value being a non-zero number, down to 0.1 is totally fine)\ INC (Number) - Is the increment you want the function to run in when sweeping from T_LOW to T_HIGH and C_LOW to C_HIGH. This effects your mesh accuracy and ultimately your final liquidus curve accuracy, but also increases runtime for smaller increments \b \ul (IMPORTANT: THE VALUE USED FOR \'91INC\'92 MUST SPLIT \i BOTH \i0 (T_HIGH-T_LOW) \i AND \i0 (C_HIGH-C_LOW) INTO AN INTEGER NUMBER OF STEPS.) \b0 \ \ulnone SALINITY (ppt) - Salinity of your initial solution in parts per thousand\ Na (mol/kg) - Sodium molality\ K (mol/kg) - Potassium molality\ Ca (mol/kg) - Calcium molality\ Mg (mol/kg) - Magnesium molality\ Cl (mol/kg) - Chloride molality\ Sulfate (mol/kg) - Sulfate molality\ Nitrate (mol/kg) - Nitrate molality\ \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \cf0 \'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\ \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \cf0 \ example input: Seawater Composition from 260.5K-273.5K and 3.4ppt-275.4ppt\ \ liquidus(273.5, 260.5, 8.1, 0.1, 0.5, 34, 0.469, 0.0102, 0.0103, 0.0528, 0.546, 0.0282, 0.0)\ \ \ \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \cf0 FUNCTION OUTPUT\ \'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\ \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \cf0 If running in the MATLAB GUI the code will produce a 3D plot displaying the relationships between concentration, temperature, and moles of ice formed (based on an initial mass of 1kg H2O), as well as both the graphical representation of the liquidus fit line and the functional form of the fit line.\ \ Additionally a MATLAB matrix file named \'91Coefficients.mat\'92 will be created. This file contains a 3-entry matrix with the coefficients for the fit line. \ \ The array in the file is named P2 and has the form P2=[a, b, c] where these are the coefficients for the quadratic liquidus fit line that has the form:\ \ Tmelt(S)=a*(S^2)+b*S+c\ \ Where Tmelt is the freezing/melting point of the solution in Kelvin, and S is salinity in ppt.\ \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \cf0 \'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\ \ \ \ NOTES\ - This is definitely a very rough code and there are likely pitfalls that are not mentioned in this README\ - If the code is not converging it is due to the FREZCHEM code which is written in Fortran77 and is simply called by the MATLAB script, it therefore DOES NOT have a kill switch built in\ - The code can take some time to run, as for each temperature and concentration value FREZCHEM is called upon (ideally there would be some machine learning step that would try a temperature/concentration in the region of the previous liquidus point, but that will be added in future generations of this code)\ - Reminder - if you decrease \'91INC\'92 from 1.0 to 0.5 the number of computations required to run the code will increase by a factor of 4. This means 2.0 to 0.25 increases computation count by a factor of 64.\ - Start \'91big\'92 - use a large value of \'91INC\'92 to begin with (and maybe smaller values for C_HIGH-C_LOW and T_HIGH-T_LOW to get a feel for how long the runs take) - you can also use \'92tic\'92 and \'91toc\'92 in MATLAB to time runs\ - The code is certainly not the most beautiful or elegant one in the world and I plan to improve it in future versions, as well as add precipitate tracking, utilizing newer versions of FREZCHEM so more solutes can be included, improved computational efficiency, etc. - That being said, feel free to mess with the ugly AF source code as much as you want\ - \b Coefficients.mat file gets rewritten every time - either move it out of your directory to save it or edit the source code to save uniquely named files \b0 \ \ FREZCHEM documentation: {\field{\*\fldinst{HYPERLINK "https://www.dri.edu/images/stories/research/projects/FrezChem/Release_Notes_6.2.pdf"}}{\fldrslt https://www.dri.edu/images/stories/research/projects/FrezChem/Release_Notes_6.2.pdf}}\ \ FEEDBACK IS ALWAYS GREAT! ENJOY!\ \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \cf0 \ \ \ \ }
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Packages 0
No packages published