Skip to content

Commit

Permalink
Merge pull request #664 from Wang-yijun/random_number_seed
Browse files Browse the repository at this point in the history
Add test with a different random number seed and add comments
  • Loading branch information
MFraters authored Feb 23, 2024
2 parents 9239916 + e0ea609 commit c84d2c6
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 1 deletion.
3 changes: 2 additions & 1 deletion source/world_builder/world.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ namespace WorldBuilder
prm.declare_entry("features", Types::PluginSystem("",Features::Interface::declare_entries, {"model"}),"A list of features.");

prm.declare_entry("random number seed", Types::Int(-1),
"Use random number seed input to generate random numbers.");
"This allows the input of a preferred random number seed to generate random numbers."
" If no input is given, this value is -1 and triggers the use of default seed = 1.");

}
prm.leave_subsection();
Expand Down
54 changes: 54 additions & 0 deletions tests/gwb-dat/random_uniform_texture_all_features_seed1.wb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"version": "0.6",
"coordinate system":{"model":"cartesian"},
"random number seed":1,
"features":
[
{
"model":"continental plate", "name":"Overriding Plate", "max depth":100e3,
"coordinates":[[0,0],[0,1000e3],[1500e3,1000e3],[1500e3,0]],
"temperature models":[{"model":"uniform", "temperature":293}],
"composition models":[{"model":"uniform", "compositions":[0]}],
"grains models": [{"model":"random uniform distribution deflected", "compositions":[0], "grain sizes":[-1],
"normalize grain sizes":[true], "deflections":[0.1]}]
},

{
"model":"oceanic plate", "name":"Subducting Plate", "max depth":100e3,
"coordinates":[[1500e3,0],[1500e3,1000e3],[2500e3,1000e3],[2500e3,0]],
"temperature models":[{"model":"uniform", "temperature":293}],
"composition models":[{"model":"uniform", "compositions":[1]}],
"grains models": [{"model":"random uniform distribution deflected", "compositions":[0], "grain sizes":[-1],
"normalize grain sizes":[true], "deflections":[0.2]}]
},

{
"model":"mantle layer", "name":"Mantle", "min depth":100e3,
"coordinates":[[0,0],[0,1000e3],[2500e3,1000e3],[2500e3,0]],
"temperature models":[{"model":"uniform", "temperature":293}],
"composition models":[{"model":"uniform", "compositions":[2]}],
"grains models": [{"model":"random uniform distribution deflected", "compositions":[0], "grain sizes":[-1],
"normalize grain sizes":[true], "deflections":[0.3]}]
},

{
"model":"subducting plate", "name":"Slab", "min depth":0e3,
"coordinates":[[1500e3,0],[1500e3,500e3],[1500e3,1000e3]], "dip point":[10, 10],
"segments":[{"length":500e3, "thickness":[100e3], "angle":[50]}],
"temperature models":[{"model":"uniform", "temperature":10}],
"composition models":[{"model":"uniform", "compositions":[3]}],
"grains models": [{"model":"random uniform distribution deflected", "compositions":[0], "grain sizes":[-1],
"normalize grain sizes":[true], "deflections":[0.4]}]
},

{
"model":"fault", "name":"Fault", "min depth":0e3,
"coordinates":[[1000e3,0],[1000e3,500e3],[1000e3,1000e3]], "dip point":[10, 10],
"segments":[{"length":200e3, "thickness":[200e3], "angle":[90]}],
"temperature models":[{"model":"uniform", "temperature":10}],
"composition models":[{"model":"uniform", "compositions":[4]}],
"grains models": [{"model":"random uniform distribution deflected", "compositions":[0], "grain sizes":[-1],
"normalize grain sizes":[true], "deflections":[0.5]}]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# x y z d g T c0 c1 c2 c3 c4 gs0-0 gm0-0[0:0] gm0-0[0:1] gm0-0[0:2] gm0-0[1:0] gm0-0[1:1] gm0-0[1:2] gm0-0[2:0] gm0-0[2:1] gm0-0[2:2] tag
300e3 500e3 0 50e3 293 1 0 0 0 0 1 -0.800914 -0.591593 -0.0924877 0.566088 -0.798439 0.205035 -0.195143 0.111859 0.974375 0
1400e3 500e3 0 50e3 293 1 0 0 0 0 1 -0.955406 -0.180561 0.233658 0.103564 -0.945899 -0.307488 0.276538 -0.269578 0.922418 0
1600e3 500e3 0 50e3 293 0 1 0 0 0 1 -0.298222 -0.867278 -0.398613 0.862937 -0.423456 0.275724 -0.407925 -0.261751 0.874691 1
1800e3 500e3 0 50e3 293 0 1 0 0 0 1 -0.684602 -0.394635 0.612848 0.550037 -0.831389 0.0790752 0.478309 0.391224 0.786234 1
500e3 500e3 0 300e3 293 0 0 1 0 0 1 -0.422225 -0.823232 0.379494 0.267122 -0.513044 -0.81574 0.86624 -0.243055 0.436523 2
2000e3 500e3 0 400e3 293 0 0 1 0 0 1 -0.191783 -0.93082 -0.311117 0.966116 -0.234847 0.107082 -0.172739 -0.280039 0.94432 2
1500e3 500e3 0 50e3 10 0 0 0 1 0 1 -0.46567 -0.645243 0.60565 0.87519 -0.437189 0.207144 0.131125 0.62652 0.768296 3
1400e3 500e3 0 200e3 10 0 0 0 1 0 1 -0.9776 -0.197078 0.0738833 0.155499 -0.912865 -0.377488 0.14184 -0.357544 0.923062 3
950e3 500e3 0 50e3 10 0 0 0 0 1 1 0.407186 -0.895089 -0.181701 0.733709 0.202085 0.648716 -0.54394 -0.397464 0.739021 4
1050e3 500e3 0 50e3 10 0 0 0 0 1 1 -0.728705 -0.338593 -0.595268 -0.202176 -0.724117 0.659379 -0.654305 0.600841 0.459212 4
950e3 500e3 0 210e3 293 0 0 1 0 0 1 -0.815387 -0.468934 -0.339477 0.54922 -0.441202 -0.709717 0.183032 -0.765142 0.617298 2
1050e3 500e3 0 210e3 293 0 0 1 0 0 1 -0.328436 -0.805474 -0.493297 0.917498 -0.148023 -0.36917 0.224338 -0.573848 0.787637 2
20 changes: 20 additions & 0 deletions tests/gwb-dat/random_uniform_texture_all_features_seed1000.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This is a comment in the data
# file.
# Now define parameters:
# dim = 3
# compositions = 5
# grain compositions = 1
# number of grains = 1
# x y z d c1 c2 c3 c4
300e3 500e3 0 50e3
1400e3 500e3 0 50e3
1600e3 500e3 0 50e3
1800e3 500e3 0 50e3
500e3 500e3 0 300e3
2000e3 500e3 0 400e3
1500e3 500e3 0 50e3
1400e3 500e3 0 200e3
950e3 500e3 0 50e3
1050e3 500e3 0 50e3
950e3 500e3 0 210e3
1050e3 500e3 0 210e3

0 comments on commit c84d2c6

Please sign in to comment.