Author Topic: Fortran call alphamelts  (Read 710 times)

matrix

  • Newbie
  • *
  • Posts: 6
    • View Profile
Fortran call alphamelts
« on: April 26, 2019, 07:45:11 pm »
Hi all,

I came up with an idea for the calculation of alphamelts as a subroutine embeded  in Fortran program. Fortran is much faster in numerical calculations (e.g., nonlinear heat conduction with layers of iterations, my case), while alphamelts is specificlly designed for (T,P,X) of rocks and it's needed in my case too, so I put alphamelts in my Fortran code. All you need is: 1. declare a character variable, e.g., cmdstr, at the begining of Fortran code; 2. add one line 'call system(cmdstr)' where needed. For example, cmdstr='E:\MELTS\run_alphamelts.command -f E:\MELTS\frac_xtal_env.txt -p E:\MELTS\test\ -b E:\MELTS\testbatch.txt', and in testbatch.txt the .melts file should be in absolute path, e.g., 'E:\MELTS\test.melts'. Just make sure all files are in absolute path.

Hope this is helpful.

Mingming


Paula

  • Administrator
  • Hero Member
  • *****
  • Posts: 439
    • View Profile
    • My GPS Division profile
Re: Fortran call alphamelts
« Reply #1 on: May 05, 2019, 09:24:07 am »
Hi Mingming,

Thanks for sharing! When the alphaMELTS 2 code is tidied up enough to go public, you'll be able to make direct calls from Fortran (similar to what alphaMELTS for MALTAB/Python does). But in the meantime, this is a neat trick that I didn't know about.

Paula

matrix

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Fortran call alphamelts
« Reply #2 on: May 25, 2019, 01:16:38 am »
Wow, that's really cool. Hope geoscience programmers love it.


Mingming