From 7f1120f6ede55b1ee12ad4a94a74dcccf68fc451 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Thu, 14 Nov 2024 16:45:49 +0000
Subject: [PATCH] BUG: solarCalculator: time wraparound. Fixes #3258

---
 .../radiation/submodels/solarCalculator/solarCalculator.C     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C b/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C
index 9cf0a65f6ba..dbe83f7abd9 100644
--- a/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C
+++ b/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2015-2022 OpenCFD Ltd.
+    Copyright (C) 2015-2024 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -95,7 +95,7 @@ void Foam::solarCalculator::calculateBetaTheta()
 
     dict_.readEntry("startTime", startTime_);
 
-    const scalar LST =  startTime_ + runTime/3600.0;
+    const scalar LST = startTime_ + std::fmod(runTime/3600.0, 24);
 
     const scalar LON = dict_.get<scalar>("longitude");
 
-- 
GitLab