/dtu_fortan_macos

This is a public repository for students at DTU to implement Fortran on macOs. Mainly used in the course FEM

Primary LanguageFortran

dtu_fortan_macos

This is how to run fortran on mac. This is a public repository for students at DTU to implement Fortran on macOs. Mainly used in the course FEM. Disclaimer, I take no responibility for malware or any other faults to your computer. The guide works for M chips aswell.

STEPS for making fortran using MacOS.

  1. I reccomend using VS code and download fortran extension. https://code.visualstudio.com/ <--- VS code https://marketplace.visualstudio.com/items?itemName=Gimly81.fortran <- extension

  2. Download homebrew, follow this guide: https://brew.sh/

  3. Use homebrew to install fortran, follow this guide: https://formulae.brew.sh/formula/gcc

  4. When thats done download or fork this repository, guide to how: https://docs.github.com/en/get-started/quickstart/fork-a-repo

  5. To run the fortran code use the key-shortcuts command + shift + B, needs to be done a couple of times. NB! if you get, Fatal Error: Cannot open module file 'filename' for reading at (1): No such file or directory. or something similar. Just try command + shift + B a couple of more times. Fortran needs to create some .mod files to work.

  6. In the terminal you should se "Hello World, fortran on mac".

If you see the print Hello World, you have sucsessfully installed fortran on mac. For DTU students

  1. Unzip the code given by lecturer
  2. import it into the Day5basisCode folder.
  3. go into .vscode folder then into the tasks.json file.
  4. Uncomment lines 17-30
  5. delete lines 8-16
  6. delete the hello.f90 and hello_program files from the folder.
  7. command + shift + b, follow instructions in terminal :)

TIPS: If you encour error copy your code and error message to chatgpt ;)