diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..f19b804 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,13 @@ +--- +title: "Contributor Code of Conduct" +--- + +As contributors and maintainers of this project, +we pledge to follow the [The Carpentries Code of Conduct][coc]. + +Instances of abusive, harassing, or otherwise unacceptable behavior +may be reported by following our [reporting guidelines][coc-reporting]. + + +[coc-reporting]: https://docs.carpentries.org/topic_folders/policies/incident-reporting.html +[coc]: https://docs.carpentries.org/topic_folders/policies/code-of-conduct.html diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..7632871 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,79 @@ +--- +title: "Licenses" +--- + +## Instructional Material + +All Carpentries (Software Carpentry, Data Carpentry, and Library Carpentry) +instructional material is made available under the [Creative Commons +Attribution license][cc-by-human]. The following is a human-readable summary of +(and not a substitute for) the [full legal text of the CC BY 4.0 +license][cc-by-legal]. + +You are free: + +- to **Share**---copy and redistribute the material in any medium or format +- to **Adapt**---remix, transform, and build upon the material + +for any purpose, even commercially. + +The licensor cannot revoke these freedoms as long as you follow the license +terms. + +Under the following terms: + +- **Attribution**---You must give appropriate credit (mentioning that your work + is derived from work that is Copyright (c) The Carpentries and, where + practical, linking to ), provide a [link to the + license][cc-by-human], and indicate if changes were made. You may do so in + any reasonable manner, but not in any way that suggests the licensor endorses + you or your use. + +- **No additional restrictions**---You may not apply legal terms or + technological measures that legally restrict others from doing anything the + license permits. With the understanding that: + +Notices: + +* You do not have to comply with the license for elements of the material in + the public domain or where your use is permitted by an applicable exception + or limitation. +* No warranties are given. The license may not give you all of the permissions + necessary for your intended use. For example, other rights such as publicity, + privacy, or moral rights may limit how you use the material. + +## Software + +Except where otherwise noted, the example programs and other software provided +by The Carpentries are made available under the [OSI][osi]-approved [MIT +license][mit-license]. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +## Trademark + +"The Carpentries", "Software Carpentry", "Data Carpentry", and "Library +Carpentry" and their respective logos are registered trademarks of [Community +Initiatives][ci]. + +[cc-by-human]: https://creativecommons.org/licenses/by/4.0/ +[cc-by-legal]: https://creativecommons.org/licenses/by/4.0/legalcode +[mit-license]: https://opensource.org/licenses/mit-license.html +[ci]: https://communityin.org/ +[osi]: https://opensource.org diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..62d6b95 --- /dev/null +++ b/config.yaml @@ -0,0 +1,82 @@ +#------------------------------------------------------------ +# Values for this lesson. +#------------------------------------------------------------ + +# Which carpentry is this (swc, dc, lc, or cp)? +# swc: Software Carpentry +# dc: Data Carpentry +# lc: Library Carpentry +# cp: Carpentries (to use for instructor training for instance) +# incubator: The Carpentries Incubator +carpentry: 'incubator' + +# Overall title for pages. +title: 'Introduction to Modern Fortran' + +# Date the lesson was created (YYYY-MM-DD, this is empty by default) +created: '2023-08-04' + +# Comma-separated list of keywords for the lesson +keywords: 'software, data, lesson, The Carpentries, Fortran' + +# Life cycle stage of the lesson +# possible values: pre-alpha, alpha, beta, stable +life_cycle: 'pre-alpha' + +# License of the lesson materials (recommended CC-BY 4.0) +license: 'CC-BY 4.0' + +# Link to the source repository for this lesson +# source: 'https://github.com/carpentries/fortran' +source: 'https://github.com/astroDimitrios/intro-to-modern-fortran' + +# Default branch of your lesson +branch: 'main' + +# Who to contact if there are any issues +contact: 'd.theodorakis@metoffice.gov.uk' + +# Navigation ------------------------------------------------ +# +# Use the following menu items to specify the order of +# individual pages in each dropdown section. Leave blank to +# include all pages in the folder. +# +# Example ------------- +# +# episodes: +# - introduction.md +# - first-steps.md +# +# learners: +# - setup.md +# +# instructors: +# - instructor-notes.md +# +# profiles: +# - one-learner.md +# - another-learner.md + +# Order of episodes in your lesson +episodes: +- introduction.Rmd + +# Information for Learners +learners: + +# Information for Instructors +instructors: + +# Learner Profiles +profiles: + +# Customisation --------------------------------------------- +# +# This space below is where custom yaml items (e.g. pinning +# sandpaper and varnish versions) should live +sandpaper: astroDimitrios/sandpaper +pegboard: astroDimitrios/pegboard +varnish: astroDimitrios/varnish + + diff --git a/index.md b/index.md new file mode 100644 index 0000000..e1dd22d --- /dev/null +++ b/index.md @@ -0,0 +1,58 @@ +--- +site: sandpaper::sandpaper_site +--- + +This is a new lesson built with [The Carpentries Workbench][workbench]. It is currently in pre-alpha development by the [Edinburgh Parallel Computing Centre][epcc-link], the [National Centre for Atmospheric Science][ncas-link], the [National Oceanography Centre][noc-link], and the [UK Met Office][uk-met-link]. + +This course is aimed at users and developers who know how to program, +but have little or no experience in Fortran, and those who may wish to +have a refresher in Fortran. + +::::::::::::::::::::::::::::::::::::: prereq + +### Prerequisites + +Learners *must* be familiar with the basic concepts of +programming: variables, logic, flow of control, loops, functions and +so on. No knowledge of Fortran is assumed. Previous programming +experience might typically be in the context C/C++ or python. +If you know no programming, we suggest this course on Fortran is not +the place to start. + +:::::::::::::::::::::::::::::::::::::::::::: + +Fortran (a contraction of Formula Translation) was the first programming +language to have a standard (in 1954), but has changed significantly over +the years. More recent standards (the latest being Fortran 2018) come +under the umbrella term "Modern Fortran". Fortran retains very great +significance in many areas of scientific and numerical computing, +particularly for applications such as quantum chemistry, plasmas, and in +numerical weather prediction and climate models. + +This course provides an introduction to the basics of writing Fortran. +It will cover basic syntax, variables, expressions and assignments, +flow of control, and introductions to i/o and user-defined types. +Common Fortran idioms are introduced and contrasted with those +available in C-like languages; the course will try to focus on +real usage rather than formal descriptions. + +At the end of the course you should be able to understand many Fortran +programs and be confident to start to write well-structured and portable +Fortran. Fortran is a rather "large" language, so it is not possible to +cover all its features in a two day course. Further elements of Fortran +are discussed in the "Intermediate Modern Fortran" course. + +The course requires a Fortran compiler, for which a local machine or +laptop may be appropriate [1]. If you do not have access to a Fortran +compiler, course training accounts on archer2 will be available which +provide access to various compilers. Use of a text editor will be +required (some may prefer an IDE, but we do not intend to consider or +support IDEs). + +[1] This may typically be GFortran, freely available as part of + Gnu Compiler Collection (GCC). + See e.g., [Link to GFortran install page on fortran-lang][install-gfortran] + + +[workbench]: https://carpentries.github.io/sandpaper-docs + diff --git a/instructor-notes.md b/instructor-notes.md new file mode 100644 index 0000000..6494d35 --- /dev/null +++ b/instructor-notes.md @@ -0,0 +1,5 @@ +--- +title: Instructor Notes +--- + +This is a placeholder file. Please add content here. diff --git a/introduction.md b/introduction.md new file mode 100644 index 0000000..a57e531 --- /dev/null +++ b/introduction.md @@ -0,0 +1,220 @@ +--- +title: 'Introduction' +teaching: 10 +exercises: 10 +--- + +::::::::::::::::::::::::::::::::::::: questions + +- What is Fortran? + +:::::::::::::::::::::::::::::::::::::::::::::::: + +::::::::::::::::::::::::::::::::::::: objectives + +- Understand some of Fortrans colourful history + +:::::::::::::::::::::::::::::::::::::::::::::::: + +## Introduction +A very simple program might be: + +```fortran +program example1 + + ! An example program prints "Hello World" to the screen + + print * , "Hello World" + +end program example1 +``` + +Formally, a Fortran program consists of one or more lines made up of +Fortran _statements_. Line breaks are significant (e.g., there are +no semi-colons `;` required here). + +Comments are introduced with an exclamation mark `!`, and may trail +other statements. + +The `program` statement is roughly doing the equivalent job of `main()` +in C/C++. However, note there is not (and must not be) a return statement. + +::::::::::::::::::::::::::::::::::::: challenge + +## Compiling your first program + +Check now you can compile and run the first example program `example1.f90`. + +:::::::::::::::: solution + +Using `ftn`: + +```shell +$ something something something +``` + +::::::::::::::::::::::::: +::::::::::::::::::::::::::::::::::::::::::::::: + +### Formal description + +``` + [ program [program-name] ] + [ specification-part ] + [ exectuable-part ] + [ contains + internal-subprogram-part ] + end [program-name] +``` + +Optional components are represented with square brackets `[...]`. It +follows that the shortest standard-conforming program will be (see +`example2.f90`): + +```fortran +end +``` + +If the `program-name` is present, it must be at both the beginning and +the end, and must be the same in both places. + +We will return to the `contains` statement in the context of modules. + +## `print` statement + +In general + +```fortran + print format [ , output-item-list ] +``` + +where the `format` is a format specifier (discussed later) and the +`output-item-list` is a comma-separated list of values/variables +to be printed to the standard output. + +If the format is a `*` (a so-called free-format) the implementation +is allowed to apply a default format for a given type of item. + + +## Alternative + +Consider the following program (available as `example3.f90`): + +```fortran +program example3 + + use iso_fortran_env, only : output_unit + + write (output_unit, *) "Hello ", "world" + +end program example3 +``` + +This example shows a more general way to provide some output. Here we are +also going to employ the `use` statement to import a symbol from the +(intrinsic) module `iso_fortran_env`. The symbol is `output_unit` which +identifies the default standard output (cf. `stdout`). + + +### `use` statement + +Formally, + +```fortran + use [[ , module-nature] ::] module-name [ , only : [only-list]] +``` + +If `module-nature` is present, it must be either `intrinsic` or +`non_intrinsic`. The implementation must provide certain intrinsic +modules such `iso_fortran_env`. + +There is no formal namespace mechanism in Fortran (cf. C++), so +restrictions on which symbols are visible can be made via an optional +`only-list`. If there is no `only-list` then all the public symbols +from `module-name` will be visible. + + +### `write` statement + +Formally, + +```fortran + write (io-control-spec-list) [output-item-list] +``` + +where the `output-item-list` is a comma separated list of items to +be output. The `io-control-spec-list` has a large number of potential +arguments (again comma separated). For formatted output, these must +include at least a unit number and a format: + +```fortran + write ([unit = ] io-unit, [fmt = ] format) [output-item-list] +``` + +where the `io-unit` is a valid integer unit number, and the `format` +is a format-specifier (as for `print`). + +Examples are + +```fortran + write (unit = output_unit, fmt = *) + write (output_unit, *) + write (*, *) +``` + +C programmers looking for a new-line like symbol will notice that none +has appeared so far. The default situation is that both `print` and +`write` generate a new-line automatically. The `*` symbol in the context +of `io-unit` is a default output unit (usually the screen). + +We will return to the `write` statement and format-specifiers in more +detail in the context of i/o to external files. + +## Some comments on style + +Modern Fortran is not case sensitive. Older versions required capitals, +a style which has persisted to the present day in some places. So you +may see things such as + +```fortran +PROGRAM example1 + + PRINT *, "Hello World" + +END PROGRAM example1 +``` + +As modern etiquette tends to regard capitals as shouting, this can cause +some strain. In addition, as the compiler will accept mixed +case, an additional tool would be required to enforce style (if +enforcement was wanted). + +This course therefore prefers an all lower-case style. + +::::::::::::::::::::::::::::::::::::: challenge + +## Writing your first program + +Write a program which prints out the actual values of the symbols +`output_unit`, `error_unit`, and `input_unit` +(all from `iso_fortran_env`) to the screen. + +If you haven't used the `only` clause in your `use iso_fortran_env`, +add it now. What happens to the results if you miss out one of the +symbols referenced from the `only` clause? This behaviour will be +explained in the following section. + +:::::::::::::::: solution + +A version of this program is available as `exercise1.f90`. + +::::::::::::::::::::::::: +::::::::::::::::::::::::::::::::::::::::::::::: + +::::::::::::::::::::::::::::::::::::: keypoints + +- A Fortran program is made up of one or more _statements_ which are separated by line breaks +- Comments are declared with an `!` and may trail other statements + +:::::::::::::::::::::::::::::::::::::::::::::::: + diff --git a/learner-profiles.md b/learner-profiles.md new file mode 100644 index 0000000..75b2c5c --- /dev/null +++ b/learner-profiles.md @@ -0,0 +1,5 @@ +--- +title: FIXME +--- + +This is a placeholder file. Please add content here. diff --git a/links.md b/links.md new file mode 100644 index 0000000..b300146 --- /dev/null +++ b/links.md @@ -0,0 +1,21 @@ + + +[pandoc]: https://pandoc.org/MANUAL.html +[r-markdown]: https://rmarkdown.rstudio.com/ +[rstudio]: https://www.rstudio.com/ +[carpentries-workbench]: https://carpentries.github.io/sandpaper-docs/ + +[contact]: mailto:d.theodorakis@metoffice.gov.uk + +[epcc-link]: https://www.epcc.ed.ac.uk/ +[ncas-link]: https://ncas.ac.uk/ +[noc-link]: https://noc.ac.uk/ +[uk-met-link]: https://www.metoffice.gov.uk/ + +[install-gfortran]: https://fortran-lang.org/learn/os_setup/install_gfortran/ + +[emacs-link]: https://www.gnu.org/software/emacs/ +[emacs-init-link]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html \ No newline at end of file diff --git a/md5sum.txt b/md5sum.txt new file mode 100644 index 0000000..facf4d3 --- /dev/null +++ b/md5sum.txt @@ -0,0 +1,12 @@ +"file" "checksum" "built" "date" +"CODE_OF_CONDUCT.md" "c93c83c630db2fe2462240bf72552548" "site/built/CODE_OF_CONDUCT.md" "2024-11-15" +"LICENSE.md" "b24ebbb41b14ca25cf6b8216dda83e5f" "site/built/LICENSE.md" "2024-11-15" +"config.yaml" "d2267d8f4b7506c689db7eb30c1cfc22" "site/built/config.yaml" "2024-11-15" +"index.md" "460111f6ab60c07fef2cb1b2e5569475" "site/built/index.md" "2024-11-15" +"links.md" "3310192ccfeabb362f34db338a2abfee" "site/built/links.md" "2024-11-15" +"episodes/introduction.Rmd" "82188ceeb809ba0eeb51ec3918a65b95" "site/built/introduction.md" "2024-11-15" +"instructors/instructor-notes.md" "5cf113fd22defb29d17b64597f3c9bc0" "site/built/instructor-notes.md" "2024-11-15" +"learners/reference.md" "527a12e217602daae51c5fd9ef8958df" "site/built/reference.md" "2024-11-15" +"learners/setup.md" "1b73687bdfcf991db8219860a21dbd89" "site/built/setup.md" "2024-11-15" +"profiles/learner-profiles.md" "5fe5bf7537072422b91ed393ada03f9a" "site/built/learner-profiles.md" "2024-11-15" +"renv/profiles/lesson-requirements/renv.lock" "00c9123ac4e78600837ec392ddaca30e" "site/built/renv.lock" "2024-11-15" diff --git a/reference.md b/reference.md new file mode 100644 index 0000000..97b2a44 --- /dev/null +++ b/reference.md @@ -0,0 +1,7 @@ +--- +title: Reference +--- + +## Glossary + +This is a placeholder file. Please add content here. diff --git a/renv.lock b/renv.lock new file mode 100644 index 0000000..f00d882 --- /dev/null +++ b/renv.lock @@ -0,0 +1,342 @@ +{ + "R": { + "Version": "4.4.2", + "Repositories": [ + { + "Name": "carpentries", + "URL": "https://carpentries.r-universe.dev" + }, + { + "Name": "carpentries_archive", + "URL": "https://carpentries.github.io/drat" + }, + { + "Name": "CRAN", + "URL": "https://cran.rstudio.com" + } + ] + }, + "Packages": { + "R6": { + "Package": "R6", + "Version": "2.5.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "470851b6d5d0ac559e9d01bb352b4021" + }, + "base64enc": { + "Package": "base64enc", + "Version": "0.1-3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "543776ae6848fde2f48ff3816d0628bc" + }, + "bslib": { + "Package": "bslib", + "Version": "0.8.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "base64enc", + "cachem", + "fastmap", + "grDevices", + "htmltools", + "jquerylib", + "jsonlite", + "lifecycle", + "memoise", + "mime", + "rlang", + "sass" + ], + "Hash": "b299c6741ca9746fb227debcb0f9fb6c" + }, + "cachem": { + "Package": "cachem", + "Version": "1.1.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "fastmap", + "rlang" + ], + "Hash": "cd9a672193789068eb5a2aad65a0dedf" + }, + "cli": { + "Package": "cli", + "Version": "3.6.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "b21916dd77a27642b447374a5d30ecf3" + }, + "digest": { + "Package": "digest", + "Version": "0.6.37", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "33698c4b3127fc9f506654607fb73676" + }, + "evaluate": { + "Package": "evaluate", + "Version": "1.0.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "3fd29944b231036ad67c3edb32e02201" + }, + "fastmap": { + "Package": "fastmap", + "Version": "1.2.0", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "aa5e1cd11c2d15497494c5292d7ffcc8" + }, + "fontawesome": { + "Package": "fontawesome", + "Version": "0.5.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "htmltools", + "rlang" + ], + "Hash": "c2efdd5f0bcd1ea861c2d4e2a883a67d" + }, + "fs": { + "Package": "fs", + "Version": "1.6.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "7f48af39fa27711ea5fbd183b399920d" + }, + "glue": { + "Package": "glue", + "Version": "1.8.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "5899f1eaa825580172bb56c08266f37c" + }, + "highr": { + "Package": "highr", + "Version": "0.11", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "xfun" + ], + "Hash": "d65ba49117ca223614f71b60d85b8ab7" + }, + "htmltools": { + "Package": "htmltools", + "Version": "0.5.8.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "base64enc", + "digest", + "fastmap", + "grDevices", + "rlang", + "utils" + ], + "Hash": "81d371a9cc60640e74e4ab6ac46dcedc" + }, + "jquerylib": { + "Package": "jquerylib", + "Version": "0.1.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "htmltools" + ], + "Hash": "5aab57a3bd297eee1c1d862735972182" + }, + "jsonlite": { + "Package": "jsonlite", + "Version": "1.8.9", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "methods" + ], + "Hash": "4e993b65c2c3ffbffce7bb3e2c6f832b" + }, + "knitr": { + "Package": "knitr", + "Version": "1.48", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "evaluate", + "highr", + "methods", + "tools", + "xfun", + "yaml" + ], + "Hash": "acf380f300c721da9fde7df115a5f86f" + }, + "lifecycle": { + "Package": "lifecycle", + "Version": "1.0.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "rlang" + ], + "Hash": "b8552d117e1b808b09a832f589b79035" + }, + "memoise": { + "Package": "memoise", + "Version": "2.0.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "cachem", + "rlang" + ], + "Hash": "e2817ccf4a065c5d9d7f2cfbe7c1d78c" + }, + "mime": { + "Package": "mime", + "Version": "0.12", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "tools" + ], + "Hash": "18e9c28c1d3ca1560ce30658b22ce104" + }, + "rappdirs": { + "Package": "rappdirs", + "Version": "0.3.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "5e3c5dc0b071b21fa128676560dbe94d" + }, + "renv": { + "Package": "renv", + "Version": "1.0.11", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "utils" + ], + "Hash": "47623f66b4e80b3b0587bc5d7b309888" + }, + "rlang": { + "Package": "rlang", + "Version": "1.1.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "3eec01f8b1dee337674b2e34ab1f9bc1" + }, + "rmarkdown": { + "Package": "rmarkdown", + "Version": "2.29", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "bslib", + "evaluate", + "fontawesome", + "htmltools", + "jquerylib", + "jsonlite", + "knitr", + "methods", + "tinytex", + "tools", + "utils", + "xfun", + "yaml" + ], + "Hash": "df99277f63d01c34e95e3d2f06a79736" + }, + "sass": { + "Package": "sass", + "Version": "0.4.9", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R6", + "fs", + "htmltools", + "rappdirs", + "rlang" + ], + "Hash": "d53dbfddf695303ea4ad66f86e99b95d" + }, + "tinytex": { + "Package": "tinytex", + "Version": "0.54", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "xfun" + ], + "Hash": "3ec7e3ddcacc2d34a9046941222bf94d" + }, + "xfun": { + "Package": "xfun", + "Version": "0.49", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "stats", + "tools" + ], + "Hash": "8687398773806cfff9401a2feca96298" + }, + "yaml": { + "Package": "yaml", + "Version": "2.3.10", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "51dab85c6c98e50a18d7551e9d49f76c" + } + } +} diff --git a/setup.md b/setup.md new file mode 100644 index 0000000..9bf39cd --- /dev/null +++ b/setup.md @@ -0,0 +1,74 @@ +--- +title: Setup +--- + +## Data Sets + +Download the [zip file](https://github.com/astroDimitrios/intro-to-modern-fortran) and unzip it to your Desktop or check out this [git repository](). +This file contains data and skeleton code which we will use throughout the course. + +## Software Setup + +::::::::::::::::::::::::::::::::::::::: discussion + +### Details + +Before the start of the course please ensure that you have access to a Fortran compiler, and if necessary an account on *archer2*. + +::::::::::::::::::::::::::::::::::::::::::::::::::: + +:::::::::::::::: solution + +### archer2 + +For details of how to log into an archer2 account, see [archer2 quickstart guide link](https://docs.archer2.ac.uk/quick-start/quickstart-users/). + +The default Fortran compiler on archer2 is the Cray Fortran compiler invoked using `ftn`. For example, + +```shell +$ cd section1.01 +$ ftn example1.f90 +``` + +should generate an executable with the default name `a.out`. + +::::::::::::::::::::::::: + +:::::::::::::::: solution + +### GFortran + +If you are not taking this course on archer2 we recommend installing the [GFortran][install-gfortran] compiler. + +::::::::::::::::::::::::: + +## Text Editors and Integrated Development Environments (IDEs) + +While Fortran files are plain text and can be edited with any plain text editor, it is recommened that you use an editor that is capable of _syntax highlighting_. Setup instructions for some editors are available below. + +### Emacs + +[Emacs][emacs-link] is a cross-platform text editor available for Linux, MacOS, and Windows. Emacs applies syntax highlighting for most Fortran files, but additional file extensions, such as `.X90` may be valid Fortran files but will not be picked up in Emacs _f90-mode_. This mode allows for tab-completion of Fortran statements and the addition of a drop-down menu that provides additional Fortran-related options. + +Files can be manually set to f90-mode using `M-x f90-mode`, but file extensions can be added to your [Emacs initialization file][emacs-init-link] to ensure that these are recognised when opened. The format for this is +```lisp +(setq auto-mode-alist + (append '(("\\.mf90" . f90-mode) + ("\\.X90" . f90-mode) + ) auto-mode-alist)) +``` +::::::::::::::::: tab + +### Windows/MacOS + +From your home directory, initialization settings can be placed within your `.emacs.d/init.el` file. + +### Linux + +Initialization settings can be placed within your `~/.config/emacs/init.el` file. This location follows the Linux desktop environment guidelines. + +### Legacy (cross platform) + +The `.emacs` or `.emacs.el` file is an older method of configuring Emacs. This file is held in your home directory. + +:::::::::::::::::::::::::