{"id":23831952,"url":"https://github.com/csdms/bmi-example-fortran","last_synced_at":"2026-02-13T00:38:38.516Z","repository":{"id":47395902,"uuid":"180462013","full_name":"csdms/bmi-example-fortran","owner":"csdms","description":"An example of wrapping a model written in Fortran with a BMI","archived":false,"fork":false,"pushed_at":"2024-12-19T19:53:34.000Z","size":98,"stargazers_count":5,"open_issues_count":3,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-09-10T16:56:06.121Z","etag":null,"topics":["bmi","csdms","fortran"],"latest_commit_sha":null,"homepage":"https://bmi.csdms.io/","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csdms.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-09T23:00:37.000Z","updated_at":"2025-07-03T00:02:32.000Z","dependencies_parsed_at":"2024-01-02T07:05:03.115Z","dependency_job_id":"0b5bb02f-1965-4aa9-b81a-9438dc6e7e86","html_url":"https://github.com/csdms/bmi-example-fortran","commit_stats":{"total_commits":63,"total_committers":2,"mean_commits":31.5,"dds":"0.015873015873015928","last_synced_commit":"6909f22b61b0b3fec0d3b0d0bdec7ee58e4ad8a0"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/csdms/bmi-example-fortran","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csdms%2Fbmi-example-fortran","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csdms%2Fbmi-example-fortran/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csdms%2Fbmi-example-fortran/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csdms%2Fbmi-example-fortran/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csdms","download_url":"https://codeload.github.com/csdms/bmi-example-fortran/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csdms%2Fbmi-example-fortran/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274568492,"owners_count":25309281,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-11T02:00:13.660Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bmi","csdms","fortran"],"created_at":"2025-01-02T14:16:43.037Z","updated_at":"2026-02-13T00:38:33.490Z","avatar_url":"https://github.com/csdms.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Basic Model Interface](https://img.shields.io/badge/CSDMS-Basic%20Model%20Interface-green.svg)](https://bmi.readthedocs.io/)\n[![Build/Test](https://github.com/csdms/bmi-example-fortran/workflows/Build/Test/badge.svg)](https://github.com/csdms/bmi-example-fortran/actions?query=workflow%3ABuild%2FTest)\n\n# bmi-example-fortran\n\nAn example of implementing the\n[Fortran bindings](https://github.com/csdms/bmi-fortran)\nfor the CSDMS [Basic Model Interface](https://bmi.csdms.io) (BMI).\n\n## Overview\n\nThis is an example of implementing a BMI\nfor a simple model that  solves the diffusion equation\non a uniform rectangular plate\nwith Dirichlet boundary conditions.\nTests and examples of using the BMI are provided.\nThe model is written in Fortran 90.\nThe BMI is written in Fortran 2003.\n\nThis repository is organized with the following directories:\n\n\u003cdl\u003e\n    \u003cdt\u003eheat\u003c/dt\u003e\n\t\u003cdd\u003eHolds the model and a sample main program\u003c/dd\u003e\n    \u003cdt\u003ebmi_heat\u003c/dt\u003e\n\t\u003cdd\u003eHolds the BMI for the model and a main program to run the\n    model through its BMI\u003c/dd\u003e\n\t\u003cdt\u003etest\u003c/dt\u003e\n\t\u003cdd\u003eUnit tests for the BMI-ed model\u003c/dd\u003e\n    \u003cdt\u003eexample\u003c/dt\u003e\n\t\u003cdd\u003eExamples of controlling the model through its BMI\u003c/dd\u003e\n\u003c/dl\u003e\n\n## Build/Install\n\nThis example can be built on Linux, macOS, and Windows.\n\n**Prerequisites:**\n* A Fortran compiler\n* CMake or [Fortran Package Manager](https://fpm.fortran-lang.org/)\n* If using CMake, the Fortran BMI bindings. Follow the build and\n  install directions given in the\n  [README](https://github.com/csdms/bmi-fortran/blob/master/README.md)\n  in that repository.  You can choose to build them from source or\n  install them through a conda binary. If using fpm, the binding\n  will be automatically downloaded and built for you.\n* pkg-config\n\n### CMake - Linux and macOS\n\nTo configure and build this example from source with CMake,\nusing the current Fortran BMI version, run\n\n    cmake -B _build -DCMAKE_INSTALL_PREFIX=\u003cpath-to-installation\u003e\n    cmake --build _build\n\nwhere `\u003cpath-to-installation\u003e` is the base directory\nin which the Fortran BMI bindings have been installed\n(`/usr/local` is the default).\nWhen installing into a conda environment,\nuse the `$CONDA_PREFIX` environment variable.\n\nThen, to install:\n\n    cmake --install _build\n\nThe installation will look like\n(on macOS, using v2.0 of the Fortran BMI specification):\n\n```bash\n.\n|-- bin\n|   |-- run_bmiheatf\n|   `-- run_heatf\n|-- include\n|   |-- bmif_2_0.mod\n|   |-- bmiheatf.mod\n|   `-- heatf.mod\n`-- lib\n    |-- libbmif.a\n    |-- libbmif.2.1.4.dylib\n    |-- libbmif.dylib -\u003e libbmif.2.1.4.dylib\n    |-- libbmiheatf.dylib\n    |-- libheatf.dylib\n    `-- pkgconfig\n        |-- bmif.pc\n        |-- bmiheatf.pc\n        `-- heatf.pc\n```\n\nRun unit tests and examples of using the sample implementation with\n\n    ctest --test-dir _build\n\n### CMake - Windows\n\nAn additional prerequisite is needed for Windows:\n\n* Microsoft Visual Studio 2017 or Microsoft Build Tools for Visual Studio 2017\n\nTo configure and build this example from source with CMake\nusing the current Fortran BMI version,\nrun the following in a [Developer Command Prompt](https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs)\n\n    cmake -B _build -L -G Ninja -DCMAKE_INSTALL_PREFIX=\u003cpath-to-installation\u003e\n\tcmake --build _build\n\nwhere `\u003cpath-to-installation\u003e` is the base directory\nin which the Fortran BMI bindings have been installed.\nThe default is `\"C:\\Program Files (x86)\"`.\nNote that quotes and an absolute path are needed.\nWhen using a conda environment, use `\"%CONDA_PREFIX%\\Library\"`.\n\nThen, to install:\n\n\tcmake --install _build\n\nRun unit tests and examples of using the sample implementation with\n\n    ctest --test-dir _build\n\n\n### Fortran Package Manager (fpm)\n\nIf you don't already have fpm installed, you can do so via Conda:\n\n    conda install fpm -c conda-forge\n\nThen, to build and install:\n\n    fpm build --profile release\n    fpm install --prefix \u003cpath-to-installation\u003e\n\nwhere `\u003cpath-to-installation\u003e` is the base directory in which to\ninstall the model. Installation is optional.\n\nTo run the tests:\n\n    fpm test -- test/sample.cfg\n\nHere, `test/sample.cfg` is passed as a command line parameter to the\nrun executables, and tells the tests where to find the test config\nfile.\n\nTo run all of the examples:\n\n    fpm run --example --all -- example\n\nSimilarly, `example` tells the example executables to look in the\n`example` directory for config files. To run individual tests:\n\n    fpm run --example \u003cexample-name\u003e -- example\n\nWhere `\u003cexample-name\u003e` is the name of the example to run. To see\na list of available examples, run `fpm run --example`. Note that the\nnon-BMI heat model executable is not built by default when using fpm.\nIf you want to build and install this too, you can do so from the\nheat directory:\n\n    cd heat\n    fpm build --profile release\n    fpm install --prefix \u003cpath-to-installation\u003e\n\n\n## Use\n\nRun the heat model through its BMI with the `run_bmiheatf` program,\nwhich takes a model configuration file\n(see the [example](./example) directory for a sample)\nas a required parameter.\nIf `run_bmiheatf` is in your path, run it with\n\n    run_bmiheatf test1.cfg\n\nOutput from the model is written to the file **bmiheatf.out**\nin the current directory.\n\nIf you built the model using fpm, you can alternatively run the\nprogram using\n\n    fpm run -- test.cfg","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsdms%2Fbmi-example-fortran","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsdms%2Fbmi-example-fortran","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsdms%2Fbmi-example-fortran/lists"}