{"id":27650117,"url":"https://github.com/halterw/a_simple_computer_program","last_synced_at":"2026-03-10T13:04:16.933Z","repository":{"id":41492872,"uuid":"493582462","full_name":"halterw/A_simple_computer_program","owner":"halterw","description":"A simple computer program for calculating stress and strain rate in 2D viscous inclusion-matrix systems","archived":false,"fork":false,"pushed_at":"2024-02-19T16:10:12.000Z","size":1959,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-30T20:44:33.588Z","etag":null,"topics":["finite-difference-method","iterative-methods","numerical-modelling","viscous-inclusion"],"latest_commit_sha":null,"homepage":"","language":"MATLAB","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/halterw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2022-05-18T08:50:16.000Z","updated_at":"2024-08-07T14:51:42.000Z","dependencies_parsed_at":"2024-01-24T17:30:27.817Z","dependency_job_id":"fb9d1258-c14c-4295-ac1d-61cbd18960f1","html_url":"https://github.com/halterw/A_simple_computer_program","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/halterw/A_simple_computer_program","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halterw%2FA_simple_computer_program","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halterw%2FA_simple_computer_program/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halterw%2FA_simple_computer_program/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halterw%2FA_simple_computer_program/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/halterw","download_url":"https://codeload.github.com/halterw/A_simple_computer_program/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halterw%2FA_simple_computer_program/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30334412,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T12:41:07.687Z","status":"ssl_error","status_checked_at":"2026-03-10T12:41:06.728Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["finite-difference-method","iterative-methods","numerical-modelling","viscous-inclusion"],"created_at":"2025-04-24T03:28:01.455Z","updated_at":"2026-03-10T13:04:16.911Z","avatar_url":"https://github.com/halterw.png","language":"MATLAB","readme":"# A simple computer program for calculating stress and strain rate in 2D viscous inclusion-matrix systems\nFinite difference algorithm using iterative solver to simuLate 2D viscous deformation.\n\nCode versions for [Matlab](https://mathworks.com/en/products/matlab.html) and freely available [GNU Octave](https://octave.org/).\n\nPublished in [W.R. Halter, E. Macherel, and S.M. Schmalholz (2022) JSG](https://doi.org/10.1016/j.jsg.2022.104617).\n\n- Some of our published model configurations can be found in [Examples_Matlab](/Examples_Matlab/) or [Examples_Octave](/Examples_Octave/) for didactical purpose and to ensure the reproducibility of our results.\n\n- Some errors were found in the original version of the published code. \nThe codes on this GitHub page were since corrected. The original (wrong) codes can still be looked at in the folder [Previous_code_versions](/Previous_code_versions/).\nFor more details about the errors in the previous code versions and their correction, check the [corrigendum 1](https://doi.org/10.1016/j.jsg.2022.104665) and [corrigendum 2](https://doi.org/10.1016/j.jsg.2024.105071).\n\nAll codes on this page are free software under the Creative Commons CC-BY-NC-ND license.\n\n### Pure shear vs. simple shear\n\nFig. 6a \u0026 6b compare the two implemented boundary conditions. We chose a hard rectangular inclusion.  \nBoth codes are completely identical except for line 5\n\n```matlab\nps          = 1;        % ps = 1 models pure shear; ps = 0 models simple shear\n```\n\nwhere in Fig. 6a we activate pure shear, whereas in Fig. 6b we activate simple shear.\n\u003cfigure\u003e\n    \u003cimg src=\"figures/Fig_06a_output.png\" width=\"800\"\u003e\n    \u003cfigcaption\u003eFig. 6a setup: hard rectangular inclusion, pure shear\u003c/figcaption\u003e\n\u003c/figure\u003e\n\u003cfigure\u003e\n    \u003cimg src=\"figures/Fig_06b_output.png\" width=\"800\"\u003e\n    \u003cfigcaption\u003eFig. 6b: hard rectangular inclusion, simple shear\u003c/figcaption\u003e\n\u003c/figure\u003e\n\n\n\n\n### Linear viscous vs. power-law viscous\n\nFig. 8a \u0026 8b compare the two implemented viscous rheologies. We chose a weak elliptical inclusion.  \n\nIn both figures the inclusion is linear viscous. In Fig. 8a, also the matrix is linear viscous, whereas in Fig. 8b the matrix uses a combined flow-law, including a power-law viscosity. More details about the chosen model configuration in Halter et al. 2022.  \n\nBoth codes are completely identical except for line 19\n\n```matlab\nn_exp       = 5;\n```\n\nwhere in Fig. 8b we chose a power-law exponent \u003e 1. \n\n\u003cfigure\u003e\n    \u003cimg src=\"figures/Fig_08a_output.png\" width=\"800\"\u003e\n    \u003cfigcaption\u003eFig. 8a: soft elliptical inclusion, linear viscous\u003c/figcaption\u003e\n\u003c/figure\u003e\n\u003cfigure\u003e\n    \u003cimg src=\"figures/Fig_08b_output.png\" width=\"800\"\u003e\n    \u003cfigcaption\u003eFig. 8b: soft elliptical inclusion, power-law viscous\u003c/figcaption\u003e\n\u003c/figure\u003e\n\n\n### Multiple inclusions\n\nFig. 9 illustrates the interaction between multiple inclusions. This model configuration is calculated on a higher resolution (901 x 601) and takes multiple hours to fully converge. Results will be added later.\n\n\n### Garnet\n\nIn Fig. 10 we want to investigate whether we can infer the pressure field inside and around a rigid garnet porphyroblast. To define the shape of the garnet we created a polygon using Matlab's [ginput](https://ch.mathworks.com/help/matlab/ref/ginput.html) function on a photo of a real rock.\n\n\u003cfigure\u003e\n    \u003cimg src=\"figures/Fig_10_output.png\" width=\"800\"\u003e\n    \u003cfigcaption\u003eFig. 10: garnet inclusion\u003c/figcaption\u003e\n\u003c/figure\u003e\n\n\nNote the error convergence behaviour. In this example, the (absolute) error reaches a plateau before fully converging to the bottom. This behaviour is typical for the pseudo-transient method.\n\n### Boudinage\n\nIn Fig. 11 we show the pressure and stress distribution inside and between 2 separating boudin blocks. Feel free to modify the code visualization to confirm that the horizontal total stress (Sxx) is indeed continuous across the weak gap, as discussed in Halter et al. 2022.\n\n\n\u003cfigure\u003e\n    \u003cimg src=\"figures/Fig_11_output.png\" width=\"800\"\u003e\n    \u003cfigcaption\u003eFig. 11: boudinage\u003c/figcaption\u003e\n\u003c/figure\u003e\n\n### Computation time\n\nAn overview of approximate calculation times obtained on a commercial laptop (Lenovo ThinkPad P1 gen 3). \n\n| Model configuration                 | Resolution (nx,ny) | Tolerance | Computation time (seconds) |\n|-------------------------------------|--------------------|-----------|----------------------------|\n| Fig. 6a - Rectangle pure shear      | (201,201)          | 1e-6      |                        450 |\n| Fig. 6b - Rectangle simple shear    | (201,201)          | 1e-6      |                        450 |\n| Fig. 8a - Ellipse linear viscous    | (201,201)          | 1e-6      |                        207 |\n| Fig. 8b - Ellipes power-law viscous | (201,201)          | 1e-6      |                        162 |\n| Fig. 10 - Garnet                    | (301,186)          | 1e-6      |                        803 |\n| Fig. 11 - Boudinage                 | (201,201)          | 1e-6      |                         28 |\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalterw%2Fa_simple_computer_program","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhalterw%2Fa_simple_computer_program","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalterw%2Fa_simple_computer_program/lists"}