Skip to content

Commit 655d1b6

Browse files
Merge pull request #35 from GralDispersionModel/V2309R
V2311
2 parents 581ad10 + cd0cc9b commit 655d1b6

38 files changed

+982
-416
lines changed

src/.vscode/tasks.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,17 @@
2626
{
2727
"label": "build self contained exe Windows",
2828
"type": "shell",
29-
"command": "dotnet publish -r win10-x64 -c Release --self-contained /p:PublishSingleFile=true /p:PublishTrimmed=true /p:IncludeNativeLibrariesForSelfExtract=true",
29+
"command": "dotnet publish -c Release -p:PublishSingleFile=true -p:PublishTrimmed=true --self-contained true -p:IncludeNativeLibrariesForSelfExtract=true",
30+
"group": {
31+
"kind": "build",
32+
"isDefault": true
33+
},
34+
"problemMatcher": "$msCompile"
35+
},
36+
{
37+
"label": "build release AOT for Windows",
38+
"type": "shell",
39+
"command": "dotnet publish -r win-x64 -c Release",
3040
"group": {
3141
"kind": "build",
3242
"isDefault": true

src/CleanUp.cs

+232
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
#region Copyright
2+
///<remarks>
3+
/// <Graz Lagrangian Particle Dispersion Model>
4+
/// Copyright (C) [2023] [Markus Kuntner]
5+
/// This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
6+
/// the Free Software Foundation version 3 of the License
7+
/// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
8+
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
9+
/// You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
10+
///</remarks>
11+
#endregion
12+
13+
using System;
14+
using System.Threading.Tasks;
15+
16+
namespace GRAL_2001
17+
{
18+
partial class Program
19+
{
20+
/// <summary>
21+
/// Clean the memory when the app has been finished or interrupted
22+
/// </summary>
23+
public static void CleanUpMemory()
24+
{
25+
DZK = null;
26+
DZK_Trans = null;
27+
HOKART = null;
28+
HoKartTrans = null;
29+
if (StretchFlexible != null)
30+
{
31+
StretchFlexible.Clear();
32+
}
33+
StretchFlexible = null;
34+
Conz3d = null;
35+
MeasurementHeight = null;
36+
XKO = null;
37+
YKO = null;
38+
ZKO = null;
39+
AH = null;
40+
AHE = null;
41+
ZSP = null;
42+
DDX = null;
43+
DDY = null;
44+
UWIN = null;
45+
VWIN = null;
46+
WWIN = null;
47+
Z0Gral = null;
48+
USternGral = null;
49+
OLGral = null;
50+
Z0Gramm = null;
51+
Ustern = null;
52+
Ob = null;
53+
SC_Gral = null;
54+
AKL_GRAMM = null;
55+
56+
ObsWindU = null;
57+
ObsWindV = null;
58+
U0 = null;
59+
V0 = null;
60+
UK = null;
61+
VK = null;
62+
WK = null;
63+
AHK = null;
64+
AHKOri = null;
65+
KKART = null;
66+
ADVDOM = null;
67+
VEG = null;
68+
COV = null;
69+
ReceptorX = null;
70+
ReceptorY = null;
71+
ReceptorZ = null;
72+
ReceptorNearbyBuilding = null;
73+
if (ReceptorName != null)
74+
{
75+
ReceptorName.Clear();
76+
}
77+
ReceptorName = null;
78+
ReceptorIInd = null;
79+
ReceptorJInd = null;
80+
ReceptorKInd = null;
81+
ReceptorIIndFF = null;
82+
ReceptorJIndFF = null;
83+
ReceptorKIndFF = null;
84+
ReceptorConc = null;
85+
ReceptorParticleMaxConc = null;
86+
ReceptorTotalConc = null;
87+
88+
OPP_LANE = null;
89+
TUN_ENTR = null;
90+
91+
PS_SG = null;
92+
PS_Mode = null;
93+
94+
PS_V_sed = null;
95+
PS_V_Dep = null;
96+
PS_ER_Dep = null;
97+
PS_Absolute_Height = null;
98+
PS_TimeSeriesTemperature = null;
99+
PS_TimeSeriesVelocity = null;
100+
if (PS_TimeSerTempValues != null)
101+
{
102+
PS_TimeSerTempValues.Clear();
103+
}
104+
PS_TimeSerTempValues = null;
105+
if (PS_TimeSerVelValues != null)
106+
{
107+
PS_TimeSerVelValues.Clear();
108+
}
109+
PS_TimeSerVelValues = null;
110+
111+
LS_ER = null;
112+
LS_X1 = null;
113+
LS_X2 = null;
114+
LS_Y1 = null;
115+
LS_Y2 = null;
116+
LS_Z1 = null;
117+
LS_Z2 = null;
118+
LS_Laerm = null;
119+
LS_Width = null;
120+
LS_SG = null;
121+
LS_Mode = null;
122+
LS_V_sed = null;
123+
LS_V_Dep = null;
124+
LS_ER_Dep = null;
125+
LS_Absolute_Height = null;
126+
127+
TS_ER = null;
128+
TS_T = null;
129+
TS_V = null;
130+
TS_X1 = null;
131+
TS_Y1 = null;
132+
TS_Z1 = null;
133+
TS_X2 = null;
134+
TS_Y2 = null;
135+
TS_Z2 = null;
136+
TS_SG = null;
137+
TS_Area = null;
138+
TS_Width = null;
139+
TS_Height = null;
140+
TS_cosalpha = null;
141+
TS_sinalpha = null;
142+
TS_Mode = null;
143+
TS_V_sed = null;
144+
TS_V_Dep = null;
145+
TS_ER_Dep = null;
146+
TS_Absolute_Height = null;
147+
TS_TimeSeriesTemperature = null;
148+
TS_TimeSeriesVelocity = null;
149+
if (TS_TimeSerTempValues != null)
150+
{
151+
TS_TimeSerTempValues.Clear();
152+
}
153+
TS_TimeSerTempValues = null;
154+
if (TS_TimeSerVelValues != null)
155+
{
156+
TS_TimeSerVelValues.Clear();
157+
}
158+
TS_TimeSerVelValues = null;
159+
160+
AS_X = null;
161+
AS_Y = null;
162+
AS_Z = null;
163+
AS_dX = null;
164+
AS_dY = null;
165+
AS_dZ = null;
166+
AS_ER = null;
167+
AS_SG = null;
168+
AS_Mode = null;
169+
AS_V_sed = null;
170+
AS_V_Dep = null;
171+
AS_ER_Dep = null;
172+
AS_Absolute_Height = null;
173+
174+
ParticleSource = null;
175+
SourceType = null;
176+
ParticleSG = null;
177+
Xcoord = null;
178+
YCoord = null;
179+
ZCoord = null;
180+
ParticleMass = null;
181+
ParticleVsed = null;
182+
ParticleVdep = null;
183+
ParticleMode = null;
184+
185+
DIV = null;
186+
DPM = null;
187+
UKS = null;
188+
VKS = null;
189+
WKS = null;
190+
DPMNEW = null;
191+
VerticalIndex = null;
192+
UsternObstaclesHelpterm = null;
193+
UsternTerrainHelpterm = null;
194+
195+
PS_PartNumb = null;
196+
TS_PartNumb = null;
197+
LS_PartNumb = null;
198+
AS_PartNumb = null;
199+
200+
Conz3dp = null;
201+
Conz3dm = null;
202+
Q_cv0 = null;
203+
DisConcVar = null;
204+
Depo_conz = null;
205+
Conz4d = null;
206+
Conz5d = null;
207+
ConzSsum = null;
208+
EmFacTimeSeries = null;
209+
210+
if (MeteoTimeSer != null)
211+
{
212+
MeteoTimeSer.Clear();
213+
}
214+
MeteoTimeSer = null;
215+
if (MeteopgtLst != null)
216+
{
217+
MeteopgtLst.Clear();
218+
}
219+
MeteopgtLst = null;
220+
221+
TransientDepo = null;
222+
if (WetDepoPrecipLst != null)
223+
{
224+
WetDepoPrecipLst.Clear();
225+
}
226+
227+
// Release the memory
228+
System.GC.Collect(System.GC.MaxGeneration, GCCollectionMode.Aggressive, true, true);
229+
System.GC.WaitForPendingFinalizers();
230+
}
231+
}
232+
}

src/DiagnosticFlowfield.cs

+10-10
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ EQUATION TDMA (PATANKAR 1980, S125)*/
8888
int maxTasks = 1;
8989
if (IterationLoops % 4 == 0)
9090
{
91-
maxTasks = Math.Max(1, Program.pOptions.MaxDegreeOfParallelism + Math.Abs(Environment.TickCount % 4));
92-
Parallel.ForEach(Partitioner.Create(2, Program.NJJ, Math.Max(4, (int)(Program.NJJ / maxTasks))), range =>
91+
maxTasks = Math.Max(1, Program.IPROC + Math.Abs(Environment.TickCount % 4));
92+
Parallel.ForEach(Partitioner.Create(2, Program.NJJ, Math.Max(4, (int)(Program.NJJ / maxTasks))), Program.pOptions, range =>
9393
//Parallel.For(2, Program.NJJ, Program.pOptions, j =>
9494
{
9595
Span<float> PIMP = stackalloc float[Program.NKK + 2];
@@ -153,8 +153,8 @@ EQUATION TDMA (PATANKAR 1980, S125)*/
153153
}
154154
else if (IterationLoops % 4 == 1)
155155
{
156-
maxTasks = Math.Max(1, Program.pOptions.MaxDegreeOfParallelism + Math.Abs(Environment.TickCount % 4));
157-
Parallel.ForEach(Partitioner.Create(2, Program.NJJ, Math.Max(4, (int)(Program.NJJ / maxTasks))), range =>
156+
maxTasks = Math.Max(1, Program.IPROC + Math.Abs(Environment.TickCount % 4));
157+
Parallel.ForEach(Partitioner.Create(2, Program.NJJ, Math.Max(4, (int)(Program.NJJ / maxTasks))), Program.pOptions, range =>
158158
//Parallel.For(2, Program.NJJ, Program.pOptions, j1 =>
159159
{
160160
Span<float> PIMP = stackalloc float[Program.NKK + 2];
@@ -220,8 +220,8 @@ EQUATION TDMA (PATANKAR 1980, S125)*/
220220
}
221221
else if (IterationLoops % 4 == 2)
222222
{
223-
maxTasks = Math.Max(1, Program.pOptions.MaxDegreeOfParallelism + Math.Abs(Environment.TickCount % 4));
224-
Parallel.ForEach(Partitioner.Create(2, Program.NJJ, Math.Max(4, (int)(Program.NJJ / maxTasks))), range =>
223+
maxTasks = Math.Max(1, Program.IPROC + Math.Abs(Environment.TickCount % 4));
224+
Parallel.ForEach(Partitioner.Create(2, Program.NJJ, Math.Max(4, (int)(Program.NJJ / maxTasks))), Program.pOptions, range =>
225225
//Parallel.For(2, Program.NJJ, Program.pOptions, j1 =>
226226
{
227227
Span<float> PIMP = stackalloc float[Program.NKK + 2];
@@ -286,8 +286,8 @@ EQUATION TDMA (PATANKAR 1980, S125)*/
286286
}
287287
else
288288
{
289-
maxTasks = Math.Max(1, Program.pOptions.MaxDegreeOfParallelism + Math.Abs(Environment.TickCount % 4));
290-
Parallel.ForEach(Partitioner.Create(2, Program.NJJ, Math.Max(4, (int)(Program.NJJ / maxTasks))), range =>
289+
maxTasks = Math.Max(1, Program.IPROC + Math.Abs(Environment.TickCount % 4));
290+
Parallel.ForEach(Partitioner.Create(2, Program.NJJ, Math.Max(4, (int)(Program.NJJ / maxTasks))), Program.pOptions, range =>
291291
//Parallel.For(2, Program.NJJ, Program.pOptions, j =>
292292
{
293293
Span<float> PIMP = stackalloc float[Program.NKK + 2];
@@ -351,8 +351,8 @@ EQUATION TDMA (PATANKAR 1980, S125)*/
351351
}
352352

353353
//correcting velocities
354-
maxTasks = Math.Max(1, Program.pOptions.MaxDegreeOfParallelism + Math.Abs(Environment.TickCount % 4));
355-
Parallel.ForEach(Partitioner.Create(2, Program.NII, Math.Max(4, (int)(Program.NII / maxTasks))), range =>
354+
maxTasks = Math.Max(1, Program.IPROC + Math.Abs(Environment.TickCount % 4));
355+
Parallel.ForEach(Partitioner.Create(2, Program.NII, Math.Max(4, (int)(Program.NII / maxTasks))), Program.pOptions, range =>
356356
//Parallel.For(2, Program.NII, Program.pOptions, i =>
357357
{
358358
float DDPX = 0;

src/GRAL.csproj

+8-5
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,25 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
6-
<VersionPrefix>23.09.0</VersionPrefix>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<VersionPrefix>23.11.6</VersionPrefix>
77
<Authors>Dietmar Oettl;Markus Kuntner</Authors>
88
<NeutralLanguage>en-US</NeutralLanguage>
99
<AssemblyTitle>GRAL</AssemblyTitle>
1010
<ServerGarbageCollection>true</ServerGarbageCollection>
1111
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
1212
<Optimize>true</Optimize>
13-
<TieredCompilation>true</TieredCompilation>
13+
<TieredCompilation>false</TieredCompilation>
1414
<TieredCompilationQuickJit>false</TieredCompilationQuickJit>
1515
<DOTNET_TC_QuickJitForLoops>false</DOTNET_TC_QuickJitForLoops>
1616
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
17-
<TieredPGO>true</TieredPGO>
17+
<TieredPGO>false</TieredPGO>
1818
<DOTNET_EnableDiagnostics>false</DOTNET_EnableDiagnostics>
1919
<DOTNET_ENABLE_PROFILING>false</DOTNET_ENABLE_PROFILING>
20-
<RetainVMGarbageCollection>true</RetainVMGarbageCollection>
20+
<RetainVMGarbageCollection>false</RetainVMGarbageCollection>
21+
<!--
22+
<PublishAot>true</PublishAot>
23+
-->
2124
</PropertyGroup>
2225

2326
</Project>

src/GRAL.sln

-25
This file was deleted.

0 commit comments

Comments
 (0)