Skip to content

[Feature] Ability to set initial accumulated plastic strain#184

Open
mitchellmcm27 wants to merge 7 commits intoJuliaGeodynamics:mainfrom
mitchellmcm27:mitchellmcm27/feature-initial_aps
Open

[Feature] Ability to set initial accumulated plastic strain#184
mitchellmcm27 wants to merge 7 commits intoJuliaGeodynamics:mainfrom
mitchellmcm27:mitchellmcm27/feature-initial_aps

Conversation

@mitchellmcm27
Copy link
Contributor

@mitchellmcm27 mitchellmcm27 commented Aug 27, 2025

I want to add the ability to set the initial APS, similar to how we can set the initial temperature and phases on the domain. Although pretty simple, this feature involves coordinated PRs in LaMEM, LaMEM.jl and GeophysicalModelGenerator.jl (see below). The changes are meant to be fully backwards compatible. I am leaving this as a draft as I want to get some feedback on the approach.

For more details, see the PR in the LaMEM repo (UniMainzGeo/LaMEM#41)

Summary of changes

LaMEM.jl (JuliaGeodynamics/LaMEM.jl#92)

  • adds APS as a property of Grid and passes it to CartData
  • adds ability to plot plast_strain as a cross-section (name matches Paraview field)
  • adds out_ptr_APS option to include APS on passive tracers (defaults to 0)

GeophysicalModelGenerator.jl (this PR)

  • writes APS from Grid as an additional property in the marker binary file (defaults to 0 if not given)
  • increments the file header to enable backwards compatibility

LaMEM (UniMainzGeo/LaMEM#41)

  • sets initial APS, if present, from marker binary file
  • interprets the file header (previously ignored) as a version number to maintain backwards compatibility
  • outputs APS as a field on markers
  • optionally outputs APS as a field on passive tracers (defaults to no APS output)
  • confirmed all tests pass locally

@github-actions
Copy link

github-actions bot commented Nov 24, 2025

Your PR no longer requires formatting changes. Thank you for your contribution!

use if-blocks to set Phases, Temp, and APS
@boriskaus
Copy link
Member

It would also be good if you can fix the test; seems to break in GMT (perhaps they made some internal changes to that code)

@mitchellmcm27
Copy link
Contributor Author

OK @boriskaus there seems to be an issue with some versions of GMT.jl (or maybe ultimately GMT itself).

The test essentially reads a geotiff file and extracts the value at a specific point.

When I activate Project.toml with GMT = "1" I end up with version 1.15.1

Reading and plotting the tif file with

test2 = import_GeoTIFF("test_files/UTM2GTIF.TIF"
heatmap(convert(GeoData,test2),field=:layer1, colormap = :grays, colorrange = (0, 255)
image

If I update GMT in Project.toml to GMT = "1.35" I get the correct image and the test now passes

image

I'm not sure which specific version of GMT has the bug, but maybe we should update the dependency to 1.35? I can do that in this PR if you want.

@mitchellmcm27
Copy link
Contributor Author

Can confirm that all of tests pass with GMT 1.35.0.
I'll go ahead set the version to ">=1.35.0" in this PR, but let me know if something else would be better.

@boriskaus
Copy link
Member

Yes sure. Limiting the GMT version is the better way to go

@mitchellmcm27
Copy link
Contributor Author

Looks like some of the tests failed to download the topo data from GMT. Maybe a temporary issue? Is there a way to rerun the tests after some time?

@boriskaus
Copy link
Member

Yes you can rerun failed ones

1.15.1 evidently had a bug reading geotiffs. Confirmed 1.17 does not have this bug.
@mitchellmcm27
Copy link
Contributor Author

OK, I found that GMT 1.17 resolves the bug reading the geotiff, so relaxed the version range.
The 2 remaining failing tests seem to be a separate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants