Best text editor for MFIX FORTRAN files?

Hey MFIX gurus!

I was wondering if anyone had a favored (free) text editor for the MFIX source code? I’m a big fan of Visual Studio Code, but I’ve been a bit disappointed in text highlighting with the Modern Fortran extension. It can’t identify modules (yet) so the coloring is a bit off/misleading. I’ve attached a screenshot so you can see what I mean. Let me know if you guys have any suggestions!

You can first install “Modern Fortran” Plugin as follows:

Then, change the default association with .f file from Fixed-form Fortran to free-form Fortran, which is shown below:

2 Likes

Oh awesome! This looks much better. Thank you!

True, the VS Code will automatically view .f file as fixed-form Fortran, but actually the source code of MFiX was wrote in F90, so you need to change the association of VS code.

Yes, the standard convention is .f for fixed-form Fortran and .f90 for free-form Fortran. MFiX doesn’t follow that standard convention; it’s almost all free-form and we use .f pretty much everywhere. So in most editors from VS Code to Emacs, need to adjust from the default settings.

Julia: The most recent versions of MFiX have a built-in code editor, have you tried it?
It does code highlighting, and is nicely integrated with MFiX (particularly in handling of user-defined keywords).

If the build-in editor does not meet your needs, or you have suggestions for improvements, please let us know so we can improve it for future versions.

(I’m a lifelong Emacs user, so I use Emacs to edit Fortran code. But I’m not sure I’d suggest that to someone who is not already immersed in Emacs)

  • Charles

Charles: Interesting! I had always assumed the editor was for managing and editing .mfx input files only. I will start using this for source code modifications as well. If I have any suggestions I will let you know!

Actually, the built-in editor lets you edit everything BUT the mfix input file!! Editing the project file would cause it to be out-of-sync with the settings in the interface. We have not yet implemented updating all the menus, etc to match user edits in the input file. This may be implemented in a future release, but for now the GUI is ‘in control’ of the input file and the editor view is read-only. If you want to edit .mfx input files directly, you must exit MFiX, edit the project file, and then restart MFiX and reload the project. But we don’t generally recommend doing this! The point of the GUI is to provide an easier way of creating and modifying MFiX simulations - if users are finding themselves needing to edit .mfx files regularly, then we haven’t done our job.

1 Like

Charles,

Is updating nodesi/nodesj/nodesk directly from the GUI also an option you all are working on implementing? Currently I have to close the GUI and edit the mfx file manually to update these for an MPI parallel run, but it would be nice to edit them directly in the GUI somewhere!

Those parameters are set in the dialog that appears when you click “Run” (the so called “run popup”). We consider them more as parameters of the job submission than of the model itself. Let me know if this is not working for you, or if you have a different suggestion for where these controls should be located.

Ah okay, I see it now! I do setups on my PC and the actual build and run through the command line on our university supercomputing cluster. I’m not sure that I can open the GUI on our supercomputer (although I can try) so it would be nice to set nodesi/j/k through the GUI during setup somehow. But I see what you’re saying, that you want the nodes options to be dependent on whether you chose SMP/DMP or serial for the build. Hmmm. Not sure the best way around that, but for me it would be nice to set these parameters in the Run tab! Maybe the Run tab could have a section to specify nodes i/j/k IF running in parallel, and then if the user chooses a serial build, be overwritten by nodes i/j/k=1 ?

Hi Julia,
I have a basic question regarding the installation and configuration of MFix on my university’s supercomputer. I’m not quite familiar with its architecture and I didn’t find MFix on its software list, while it does have Conda, so I’m curious if you had the same situation before and how you fix it.
Thanks a lot.

Alec,

Yes, I did something very similar back in April! I made a pretty detailed tutorial for this with my university’s supercomputer, I’ll attach the relevant slides. Let me know if you have more questions. This tutorial is for configuring DMP runs (MPI-based parallelization).

1 Like

Hi Julia,
Thanks a lot for your beautiful slides. Now I can successfully install conda and mfix environment on our supercomputer, but I’m kinda confused with the DMP setup, two questions are as follows:

  1. What is the demsep-parallel.sh and where can I find it?
  2. Looks like I cannot see the reinstallation of mpi4py in the 3rd slide.
    Thank you for the kind help and I really appreciate it.

demsetup-parallel.sh is just a reference shell file (text file containing Linux bash commands), you can see all the contents I’ve provided in the screenshot on slide 3. The cropped text for mpi4py is:

[declarations of environmental variables like MPIFC=/mpif90] pip install --upgrade mpi4py --no-binary mpi4py --force

You should really only use these powerpoint slides as a general reference for your setup procedure, though. Setup commands are specific to each supercomputer based on how your cluster is set up, what modules are available, etc. You will need to reach out to your university’s supercomputing center to get information about how to make your own shell files and perform these steps.

Hi Julia,
Thanks for the explanation. I will contact our supercomputer manager for the details to setup MPI. Regarding the demsetup-parallel.sh file, I just cannot find it, sorry my question is a bit basic, but where can I find this file and like what you said copy and paste the code to the terminal?
Thanks a lot for your kind help.

Alec,

I made this demsetup_parallel.sh file for my own university’s supercomputer, so you can’t find it anywhere. You don’t need it, so don’t worry about it. If you show your university’s supercomputing center the section below from slide 3, they should be able to help you figure out how to run the analogous commands on your cluster.

Hi Julia,
That’s really fantastic, I will contact our supercomputer manager and hope everything will be fine.
Thank you!

Hi Charles, I’m trying to run through a series of simulation with mfix. That said, I need to change parameters in an automated fashion and generate hundreds of .mfx files. Does the the built-in editor allow me to do this please? Or do you have any recommendation on how to do this? Thank you!

Jack

I suggest using Nodeworks. It is a “plugin” for MFiX that will allow you to create a design of experiments, create model directories and output files, and submit them to a HPC queue.

https://mfix.netl.doe.gov/doc/nodeworks/20.2.0//mfix-plugin/index.html