From 8a2b88a9b2760f042ae234eafac27bec2f41b7ac Mon Sep 17 00:00:00 2001 From: danieldouglas92 Date: Tue, 12 Nov 2024 11:08:46 -0700 Subject: [PATCH 1/3] convert water content from percent to a fraction --- .../oceanic_plate_models/composition/tian2019_water_content.cc | 2 +- .../composition/tian2019_water_content.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/world_builder/features/oceanic_plate_models/composition/tian2019_water_content.cc b/source/world_builder/features/oceanic_plate_models/composition/tian2019_water_content.cc index 4794a54f5..b98d98e19 100644 --- a/source/world_builder/features/oceanic_plate_models/composition/tian2019_water_content.cc +++ b/source/world_builder/features/oceanic_plate_models/composition/tian2019_water_content.cc @@ -179,7 +179,7 @@ namespace WorldBuilder double partition_coefficient = calculate_water_content(lithostatic_pressure, slab_temperature); - partition_coefficient = std::min(max_water_content, partition_coefficient); + partition_coefficient = std::min(max_water_content, partition_coefficient) / 100; for (unsigned int i = 0; i < compositions.size(); ++i) { diff --git a/source/world_builder/features/subducting_plate_models/composition/tian2019_water_content.cc b/source/world_builder/features/subducting_plate_models/composition/tian2019_water_content.cc index 0835b4c4c..1175e0fec 100644 --- a/source/world_builder/features/subducting_plate_models/composition/tian2019_water_content.cc +++ b/source/world_builder/features/subducting_plate_models/composition/tian2019_water_content.cc @@ -172,7 +172,7 @@ namespace WorldBuilder double partition_coefficient = calculate_water_content(lithostatic_pressure, slab_temperature); - partition_coefficient = std::min(max_water_content, partition_coefficient); + partition_coefficient = std::min(max_water_content, partition_coefficient) / 100; for (unsigned int i = 0; i < compositions.size(); ++i) { From ee2d7dd775090482eca415151307c3a33d999d1e Mon Sep 17 00:00:00 2001 From: danieldouglas92 Date: Tue, 12 Nov 2024 11:14:03 -0700 Subject: [PATCH 2/3] fix a typo, add comments --- doc/JOSS/1.0/paper.md | 2 +- .../oceanic_plate_models/composition/tian2019_water_content.cc | 3 ++- .../composition/tian2019_water_content.cc | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/JOSS/1.0/paper.md b/doc/JOSS/1.0/paper.md index a534605dc..6eb311bd8 100644 --- a/doc/JOSS/1.0/paper.md +++ b/doc/JOSS/1.0/paper.md @@ -48,7 +48,7 @@ affiliations: index: 2 - name: GEOMAR Helmholtz-Zentrum für Ozeanforschung, Kiel, Germany index: 3 - - name: Universiy of Florida, USA + - name: University of Florida, USA index: 4 - name: Clemson University, USA index: 5 diff --git a/source/world_builder/features/oceanic_plate_models/composition/tian2019_water_content.cc b/source/world_builder/features/oceanic_plate_models/composition/tian2019_water_content.cc index b98d98e19..de1ab1192 100644 --- a/source/world_builder/features/oceanic_plate_models/composition/tian2019_water_content.cc +++ b/source/world_builder/features/oceanic_plate_models/composition/tian2019_water_content.cc @@ -178,7 +178,8 @@ namespace WorldBuilder const double slab_temperature = world->properties(position_in_cartesian_coordinates.get_array(), depth, {{{1,0,0}}})[0]; double partition_coefficient = calculate_water_content(lithostatic_pressure, slab_temperature); - + // The partition_coefficient is output as a percentage, but geodynamic modeling software + // typically deal with fractions, so we divide by 100 below partition_coefficient = std::min(max_water_content, partition_coefficient) / 100; for (unsigned int i = 0; i < compositions.size(); ++i) diff --git a/source/world_builder/features/subducting_plate_models/composition/tian2019_water_content.cc b/source/world_builder/features/subducting_plate_models/composition/tian2019_water_content.cc index 1175e0fec..f0407b08b 100644 --- a/source/world_builder/features/subducting_plate_models/composition/tian2019_water_content.cc +++ b/source/world_builder/features/subducting_plate_models/composition/tian2019_water_content.cc @@ -171,7 +171,8 @@ namespace WorldBuilder const double slab_temperature = world->properties(position_in_cartesian_coordinates.get_array(), depth, {{{1,0,0}}})[0]; double partition_coefficient = calculate_water_content(lithostatic_pressure, slab_temperature); - + // The partition_coefficient is output as a percentage, but geodynamic modeling software + // typically deal with fractions, so we divide by 100 below partition_coefficient = std::min(max_water_content, partition_coefficient) / 100; for (unsigned int i = 0; i < compositions.size(); ++i) From 8f4b946825a18be2352e764b2ed586abbab4fa4c Mon Sep 17 00:00:00 2001 From: danieldouglas92 Date: Tue, 12 Nov 2024 13:19:59 -0700 Subject: [PATCH 3/3] Add changelog, update test --- CHANGELOG.md | 6 +-- .../water_content_subducting_plate.dat | 4 +- .../screen-output.log | 48 +++++++++---------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64114bb09..2a6c31b66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,9 +16,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - There is now a properties_output_size function, which returns the size of the output vector/array returned by the properties functions for a given properties input vector \[Menno Fraters; 2024-10-27; [#765](https://github.com/GeodynamicWorldBuilder/WorldBuilder/pull/765)\] - Added 2d and 3d versions of the properties function to the C wrapper \[Menno Fraters; 2024-10-27; [#765](https://github.com/GeodynamicWorldBuilder/WorldBuilder/pull/765)\] -## Changed - -## Fixed +### Changed +- The tian2019 composition model now returns a mass fraction instead of a mass percentage. \[Daniel Douglas; 2024-11-12; [#767](https://github.com/GeodynamicWorldBuilder/WorldBuilder/pull/767)\] +### Fixed ## [1.0.0] ### Added diff --git a/tests/gwb-dat/water_content_subducting_plate.dat b/tests/gwb-dat/water_content_subducting_plate.dat index 0a66e195d..29d6f645e 100644 --- a/tests/gwb-dat/water_content_subducting_plate.dat +++ b/tests/gwb-dat/water_content_subducting_plate.dat @@ -2,7 +2,7 @@ # file. # Now define parameters: # dim = 2 -# compositions = 1 +# compositions = 2 # x y d T C0 50e3 0e3 1e3 50e3 0e3 4e3 @@ -26,4 +26,4 @@ 210e3 0e3 92.5e3 210e3 0e3 95e3 210e3 0e3 97.5e3 -210e3 0e3 100e3 \ No newline at end of file +210e3 0e3 100e3 diff --git a/tests/gwb-dat/water_content_subducting_plate/screen-output.log b/tests/gwb-dat/water_content_subducting_plate/screen-output.log index 3aecb3992..8c763dd43 100644 --- a/tests/gwb-dat/water_content_subducting_plate/screen-output.log +++ b/tests/gwb-dat/water_content_subducting_plate/screen-output.log @@ -1,24 +1,24 @@ -# x z d T vx vz c0 tag -50e3 0e3 1e3 312.405 0 0 0 0 -50e3 0e3 4e3 430.229 0 0 0 0 -50e3 0e3 8e3 584.338 0 0 0 0 -50e3 0e3 11e3 695.831 0 0 0 0 -210e3 0e3 55e3 1322.25 0 2 0 1 -210e3 0e3 57.5e3 1203.62 0 2 0 1 -210e3 0e3 60e3 1034.33 0 2 0 1 -210e3 0e3 62.5e3 849.688 0 2 0 1 -210e3 0e3 65e3 697.68 0 2 0 1 -210e3 0e3 67.5e3 614.688 0 2 0 1 -210e3 0e3 70e3 616.639 0 2 0 1 -210e3 0e3 72.5e3 652.908 0 2 0 1 -210e3 0e3 75e3 687.783 0 2 0 1 -210e3 0e3 77.5e3 721.222 0 2 0 1 -210e3 0e3 80e3 753.193 0 2 0 1 -210e3 0e3 82.5e3 783.675 0 2 0 1 -210e3 0e3 85e3 812.658 0 2 0 1 -210e3 0e3 87.5e3 839.142 0 2 0 1 -210e3 0e3 90e3 863.691 0 2 0 1 -210e3 0e3 92.5e3 886.838 0 2 0 1 -210e3 0e3 95e3 908.585 0 2 0 1 -210e3 0e3 97.5e3 928.938 0 2 0 1 -210e3 0e3 100e3 947.908 0 2 0 1 +# x z d T vx vz c0 c1 tag +50e3 0e3 1e3 312.405 0 0 0 0.03 0 +50e3 0e3 4e3 430.229 0 0 0 0.01 0 +50e3 0e3 8e3 584.338 0 0 0 0.005 0 +50e3 0e3 11e3 695.831 0 0 0 0.02 0 +210e3 0e3 55e3 1322.25 0 2 0 0 1 +210e3 0e3 57.5e3 1203.62 0 2 0 0.00372427 1 +210e3 0e3 60e3 1034.33 0 2 0 0.00510104 1 +210e3 0e3 62.5e3 849.688 0 2 0 0.00689769 1 +210e3 0e3 65e3 697.68 0 2 0 0.01 1 +210e3 0e3 67.5e3 614.688 0 2 0 0.01 1 +210e3 0e3 70e3 616.639 0 2 0 0.005 1 +210e3 0e3 72.5e3 652.908 0 2 0 0.005 1 +210e3 0e3 75e3 687.783 0 2 0 0.005 1 +210e3 0e3 77.5e3 721.222 0 2 0 0.02 1 +210e3 0e3 80e3 753.193 0 2 0 0.02 1 +210e3 0e3 82.5e3 783.675 0 2 0 0.02 1 +210e3 0e3 85e3 812.658 0 2 0 0.02 1 +210e3 0e3 87.5e3 839.142 0 2 0 0.02 1 +210e3 0e3 90e3 863.691 0 2 0 0.02 1 +210e3 0e3 92.5e3 886.838 0 2 0 0.0191775 1 +210e3 0e3 95e3 908.585 0 2 0 0.0130946 1 +210e3 0e3 97.5e3 928.938 0 2 0 0.00908444 1 +210e3 0e3 100e3 947.908 0 2 0 0.00640881 1