Open KerrMadeleine opened 1 month ago
This is an update of #1813 to modern standards and currently just open for discussion
When you say " the plug-in produces different initial temperature fields for the same prm file", do you mean "different initial temperature fields from run to tun", or different from what?
You've got these warnings and errors:
/home/runner/work/aspect/aspect/include/aspect/initial_composition/random_perturbation.h:90:46: error: expected identifier before numeric constant
90 | std::mt19937 random_number_generator(1);
| ^
/home/runner/work/aspect/aspect/include/aspect/initial_composition/random_perturbation.h:90:46: error: expected ‘,’ or ‘...’ before numeric constant
/home/runner/work/aspect/aspect/include/aspect/initial_composition/random_perturbation.h: In instantiation of ‘class aspect::InitialComposition::RandomPerturbation<2>’:
/home/runner/work/aspect/aspect/source/initial_composition/random_perturbation.cc:121:5: required from here
/home/runner/work/aspect/aspect/source/initial_composition/random_perturbation.cc:55:5: error: ‘double aspect::InitialComposition::RandomPerturbation<dim>::initial_composition(const dealii::Point<dim>&, unsigned int) const [with int dim = 2]’ can be marked override [-Werror=suggest-override]
55 | RandomPerturbation<dim>::
| ^~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/aspect/aspect/source/initial_composition/random_perturbation.cc:100:5: error: ‘void aspect::InitialComposition::RandomPerturbation<dim>::parse_parameters(dealii::ParameterHandler&) [with int dim = 2]’ can be marked override [-Werror=suggest-override]
100 | RandomPerturbation<dim>::parse_parameters (ParameterHandler &prm)
| ^~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/aspect/aspect/include/aspect/initial_composition/random_perturbation.h: In instantiation of ‘class aspect::InitialComposition::RandomPerturbation<3>’:
/home/runner/work/aspect/aspect/source/initial_composition/random_perturbation.cc:121:5: required from here
/home/runner/work/aspect/aspect/source/initial_composition/random_perturbation.cc:55:5: error: ‘double aspect::InitialComposition::RandomPerturbation<dim>::initial_composition(const dealii::Point<dim>&, unsigned int) const [with int dim = 3]’ can be marked override [-Werror=suggest-override]
55 | RandomPerturbation<dim>::
| ^~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/aspect/aspect/source/initial_composition/random_perturbation.cc:100:5: error: ‘void aspect::InitialComposition::RandomPerturbation<dim>::parse_parameters(dealii::ParameterHandler&) [with int dim = 3]’ can be marked override [-Werror=suggest-override]
100 | RandomPerturbation<dim>::parse_parameters (ParameterHandler &prm)
| ^~~~~~~~~~~~~~~~~~~~~~~
@bangerth You are right of course. However, we never made the last try to produce a thread-safe version work (#1813), because that one produced non-reproducible random number series even on a single process and neither I nor @KerrMadeleine could figure out why. That is why we decided to go with the algorithm that works for the current version of ASPECT and think about thread-safety if it will ever be necessary.
I have revisited the Random initial composition (which also includes random initial temperature) and attempted to test that the random number generator MT19937 produces the same sequence of random numbers given the same seed. The generator random_number_generator is a private member of the Initial temperature class and seeded with the integer 1. Seeding the RNG with a hash which uses the position value of each point to generate a combined hash has been removed as well as the option to randomly seed the random number generator. Still, with the RNG seed fixed to 1, the plug-in produces different initial temperature fields for the same prm file.
This *.prm file is: '''
Test to check the status of the random initial temperature perturbation
plugin.
#
set Output directory = output-test-2 set Dimension = 2
subsection Boundary velocity model set Tangential velocity boundary indicators = left, right, bottom, top end
subsection Mesh refinement set Initial global refinement = 1 end
subsection Postprocess set List of postprocessors = temperature statistics, visualization subsection Visualization set Output format = gnuplot end end
subsection Material model set Model name = simpler end
set End time = 0 subsection Geometry model set Model name = box end
subsection Gravity model set Model name = vertical end
subsection Initial temperature model set List of model names = function, random perturbation subsection Random perturbation set Magnitude = 0.2 set Use random seed = false end
subsection Function set Function expression = 0.5 end
end
subsection Boundary temperature model set List of model names = box set Fixed temperature boundary indicators = top, bottom #MCK added
subsection Box #MCK added set Bottom temperature = 1 set Top temperature = 0 end
end '''