commit 9afba90bfed37296149d454278adaa92dff065e7
parent cd45b184134fe11199318aa3b74fa7954b7d3fd6
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 2 Sep 2025 18:58:44 +0200
Improve the stardis meteo plugin test
Use stardis to calculate a set of temperatures. Display them with the
surface temperature corresponding to the observation time. This output
can then be used to plot a comparison between the surface temperature
and the temperature estimated by Monte Carlo.
Diffstat:
1 file changed, 38 insertions(+), 5 deletions(-)
diff --git a/src/test_stardis_smeteo_ground_temperature.sh b/src/test_stardis_smeteo_ground_temperature.sh
@@ -130,11 +130,44 @@ ground 5 6 7 8 9 10 11 12 > ground_xXyY.stl
# Generate the Stardis input file
stardis_input > stardis_model.txt
-# Used Stardis to Calculate the ground temperature on January 10, 1850
-# at 01:30:
-# 783000 = (9 [day] * 24 [h] + 1 [h]) * 3600 [s] + 30 [m] * 60 [s]
-time="783000" # [s]
-stardis -V3 -M stardis_model.txt -s ground_Z.stl,"${time}"
+# Use Stardis to calculate the ground temperature
+date="01-MAY-2020 01:30:00" # 1st date on which temperature is calculated
+nsimu="32" # Overall number of simulations
+
+# Define the sed commands to extract the ${nsimu} dates from the
+# meteorological file
+i=0;
+n="";
+while [ "${i}" -lt "${nsimu}" ]; do
+ n="${n}N;"
+ i="$((i+1))"
+done
+
+# Run the simulations
+ sed -n "/^${date}/{${n}p;}" "${smeteo}" \
+| while read -r i; do
+ # Remove duplicate spaces in the line
+ entry="$(echo "${i}" |sed 's/[[:space:]]\{1,\}/ /g')"
+
+ # Obtain the surface temperature [K]. This will serve as a reference
+ # against which the Monte Carlo estimate of the ground temperature
+ # will be compared.
+ Tsrf="$(echo "${entry}" | cut -d' ' -f3)"
+
+ # Get date time in seconds
+ time="$(echo "${entry}" | cut -d' ' -f14)" # [day/1850]
+ time="$(echo "${time} * 24*3600" | bc -l | cut -d'.' -f1)" # [s]
+
+ date="$(echo "${entry}" | cut -d' ' -f1-2)"
+
+ # Run stardis to retrieve the expected value and standard error of the
+ # ground temperature estimate.
+ mc="$(stardis -a wos -M stardis_model.txt -s ground_Z.stl,"${time}" \
+ | cut -d' ' -f1-2)"
+
+ printf '%s %s %s\n' "${date}" "${Tsrf}" "${mc}"
+done
+
# TODO: check the Stardis result against a reference, most likely the
# surface temperature provided by the Meteorological file at the time of