SF2, MATLAB, and Python: how I model

My work is done using the Slush Fund 2.0 Mushy Layer Model of Buffo et al (2020; 2018). The code is designed in MATAB to solve a series of differential equations. My job involves adjusting the preexisting constants for the conditions by which I am studying. Then there are chemistry specific variables I have to change for each type of chemistry I solve (e.g. HCN). Then, I have to run the model for a series of initial conditions to get a full picture of what I am working with. The trick is recognizing that the model itself does not give exactly the information I need, so I have to devise an approach where I can easily use these results to produce the final product I am looking for. The SF2 model gives a 1D profile of how much an impurity will freeze into ice, if that ice formed in an infinite ocean. I want how much impurity would freeze into ice in a closed 2D system where you have ice freezing from the top and bottom.

However, I can I import these results into the 2D heat transfer python model of Chivers et al (2021) where I use a series of profiles that can be correlated to specific conditions to predict what a 2D system would look like. Like the SF2 model, this is easily done by incorporating the chemical and physical properties into the code for the scenario(s) I am studying. This is a bit trickier because I am not nearly as familiar with python as I am in MATLAB. I have worked in MATLAB for years, and even after “learning” MATLAB, I had to force myself into using it for everyday tasks to get really familiar with it. This means I have to ask for a lot more help when working with Python. What’s more, when I finally get the 2D result I’m looking for, I import the results back into MATLAB where I can more easily produce the final figures using these results. I essentially have a 2D matrix of impurity concentration for each position in the melt pond. I can easily plot this, but there are a number of other ways these results can be visualized to quantify and convey what the system looks like. For full details, see Hedgepeth et al (2021, in revision; DPS 2020).

Python and MATLAB are very similar in what they do. However, Python is free and MATLAB is not. They each are basically fancy calculators that are capable of solving a series of problems through a number of approaches. They may be capable of doing more, but this is all I am familiar with. The way they do it are slightly different, largely in syntax (i.e. how you type out the code), but they are very similar. They are overwhelming in their capabilities, but they offer a great deal of customization in how problems can be solved. What’s more, a well devised code can be multipurpose, allowing others to build on the work you’ve done.

One thought on “SF2, MATLAB, and Python: how I model

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s