Skip to content

Commit 0ad6173

Browse files
authored
Merge pull request #322 from LLNL/feature/ASPHClassic
Bringing back our old ASPH idealH algorithm as a new option, ASPHClassic
2 parents 69b1459 + 5f2c63d commit 0ad6173

22 files changed

+993
-339
lines changed

RELEASE_NOTES.md

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Notable changes include:
3333
during assignement, equality, and cloning operations. This is intended to help ensure our Physics advance during time integration
3434
is correct.
3535
* Performance regression testing is now available. All developers are encouraged to run the performance testing suite for any code changes that might impact performance. See documentation for more details.
36+
* Added our old ASPH IdealH H update as an option. While it is not as reliable as our current default ASPH, it does not require building the Voronoi and is therefore signifcantly faster.
3637
3738
* Build changes / improvements:
3839
* Distributed source directory must always be built now.

src/CRKSPH/CRKSPHHydros.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ def CRKSPH(dataBase,
8787
# Smoothing scale update
8888
if smoothingScaleMethod is None:
8989
if ASPH:
90-
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
90+
if isinstance(ASPH, str) and ASPH.upper() == "CLASSIC":
91+
smoothingScaleMethod = eval(f"ASPHClassicSmoothingScale{ndim}d({HUpdate}, W)")
92+
else:
93+
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
9194
else:
9295
smoothingScaleMethod = eval(f"SPHSmoothingScale{ndim}d({HUpdate}, W)")
9396
result._smoothingScaleMethod = smoothingScaleMethod

src/FSISPH/FSISPHHydros.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ def FSISPH(dataBase,
123123
# Smoothing scale update
124124
if smoothingScaleMethod is None:
125125
if ASPH:
126-
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
126+
if isinstance(ASPH, str) and ASPH.upper() == "CLASSIC":
127+
smoothingScaleMethod = eval(f"ASPHClassicSmoothingScale{ndim}d({HUpdate}, W)")
128+
else:
129+
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
127130
else:
128131
smoothingScaleMethod = eval(f"SPHSmoothingScale{ndim}d({HUpdate}, W)")
129132
result._smoothingScaleMethod = smoothingScaleMethod

src/GSPH/GSPHHydros.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ def GSPH(dataBase,
7575
# Smoothing scale update
7676
if smoothingScaleMethod is None:
7777
if ASPH:
78-
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
78+
if isinstance(ASPH, str) and ASPH.upper() == "CLASSIC":
79+
smoothingScaleMethod = eval(f"ASPHClassicSmoothingScale{ndim}d({HUpdate}, W)")
80+
else:
81+
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
7982
else:
8083
smoothingScaleMethod = eval(f"SPHSmoothingScale{ndim}d({HUpdate}, W)")
8184
result._smoothingScaleMethod = smoothingScaleMethod
@@ -159,7 +162,10 @@ def MFM(dataBase,
159162
# Smoothing scale update
160163
if smoothingScaleMethod is None:
161164
if ASPH:
162-
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
165+
if isinstance(ASPH, str) and ASPH.upper() == "CLASSIC":
166+
smoothingScaleMethod = eval(f"ASPHClassicSmoothingScale{ndim}d({HUpdate}, W)")
167+
else:
168+
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
163169
else:
164170
smoothingScaleMethod = eval(f"SPHSmoothingScale{ndim}d({HUpdate}, W)")
165171
result._smoothingScaleMethod = smoothingScaleMethod
@@ -248,7 +254,10 @@ def MFV(dataBase,
248254
# Smoothing scale update
249255
if smoothingScaleMethod is None:
250256
if ASPH:
251-
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
257+
if isinstance(ASPH, str) and ASPH.upper() == "CLASSIC":
258+
smoothingScaleMethod = eval(f"ASPHClassicSmoothingScale{ndim}d({HUpdate}, W)")
259+
else:
260+
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
252261
else:
253262
smoothingScaleMethod = eval(f"SPHSmoothingScale{ndim}d({HUpdate}, W)")
254263
result._smoothingScaleMethod = smoothingScaleMethod

src/Integrator/Integrator.cc

+2
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ Integrator(DataBase<Dimension>& dataBase,
113113
mAllowDtCheck(false),
114114
mRequireConnectivity(true),
115115
mRequireGhostConnectivity(false),
116+
mRequireOverlapConnectivity(false),
117+
mRequireIntersectionConnectivity(false),
116118
mDataBasePtr(&dataBase),
117119
mPhysicsPackages(physicsPackages),
118120
mRigorousBoundaries(false),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#-------------------------------------------------------------------------------
2+
# ASPHClassicSmoothingScale
3+
#-------------------------------------------------------------------------------
4+
from PYB11Generator import *
5+
from SmoothingScaleBase import *
6+
7+
@PYB11template("Dimension")
8+
class ASPHClassicSmoothingScale(SmoothingScaleBase):
9+
10+
PYB11typedefs = """
11+
using Scalar = typename %(Dimension)s::Scalar;
12+
using Vector = typename %(Dimension)s::Vector;
13+
using Tensor = typename %(Dimension)s::Tensor;
14+
using SymTensor = typename %(Dimension)s::SymTensor;
15+
using ThirdRankTensor = typename %(Dimension)s::ThirdRankTensor;
16+
using TimeStepType = typename Physics<%(Dimension)s>::TimeStepType;
17+
"""
18+
19+
#...........................................................................
20+
# Constructors
21+
def pyinit(self,
22+
HUpdate = "HEvolutionType",
23+
W = "const TableKernel<%(Dimension)s>&"):
24+
"ASPHClassicSmoothingScale constructor"
25+
26+
#...........................................................................
27+
# Virtual methods
28+
@PYB11virtual
29+
def initializeProblemStartup(self,
30+
dataBase = "DataBase<%(Dimension)s>&"):
31+
"""An optional hook to initialize once when the problem is starting up.
32+
Typically this is used to size arrays once all the materials and NodeLists have
33+
been created. It is assumed after this method has been called it is safe to
34+
call Physics::registerState for instance to create full populated State objects."""
35+
return "void"
36+
37+
@PYB11virtual
38+
def registerDerivatives(self,
39+
dataBase = "DataBase<%(Dimension)s>&",
40+
derivs = "StateDerivatives<%(Dimension)s>&"):
41+
"Register the derivatives/change fields for updating state."
42+
return "void"
43+
44+
@PYB11virtual
45+
@PYB11const
46+
def evaluateDerivatives(self,
47+
time = "const Scalar",
48+
dt = "const Scalar",
49+
dataBase = "const DataBase<%(Dimension)s>&",
50+
state = "const State<%(Dimension)s>&",
51+
derivs = "StateDerivatives<%(Dimension)s>&"):
52+
"Increment the derivatives."
53+
return "void"
54+
55+
@PYB11virtual
56+
@PYB11const
57+
def label(self):
58+
return "std::string"
59+
60+
@PYB11virtual
61+
@PYB11const
62+
def dumpState(self, file="FileIO&", pathName="const std::string&"):
63+
"Serialize under the given path in a FileIO object"
64+
return "void"
65+
66+
@PYB11virtual
67+
def restoreState(self, file="const FileIO&", pathName="const std::string&"):
68+
"Restore state from the given path in a FileIO object"
69+
return "void"
70+
71+
#...........................................................................
72+
# Attributes
73+
WT = PYB11property("const TableKernel<%(Dimension)s>&", "WT", doc="The interpolation kernel")
74+
zerothMoment = PYB11property("const FieldList<%(Dimension)s, Scalar>&", "zerothMoment", doc="The zeroth moment storage FieldList")
75+
firstMoment = PYB11property("const FieldList<%(Dimension)s, Vector>&", "firstMoment", doc="The first moment storage FieldList")
76+
secondMoment = PYB11property("const FieldList<%(Dimension)s, SymTensor>&", "secondMoment", doc="The second moment storage FieldList")

src/PYB11/SmoothingScale/SmoothingScale_PYB11.py

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
'"SmoothingScale/FixedSmoothingScale.hh"',
1717
'"SmoothingScale/SPHSmoothingScale.hh"',
1818
'"SmoothingScale/ASPHSmoothingScale.hh"',
19+
'"SmoothingScale/ASPHClassicSmoothingScale.hh"',
1920
'"SmoothingScale/ASPHSmoothingScaleUserFilter.hh"',
2021
'"SmoothingScale/ASPHRadialFunctor.hh"',
2122
'"SmoothingScale/polySecondMoment.hh"',
@@ -41,6 +42,7 @@
4142
from FixedSmoothingScale import FixedSmoothingScale
4243
from SPHSmoothingScale import SPHSmoothingScale
4344
from ASPHSmoothingScale import ASPHSmoothingScale
45+
from ASPHClassicSmoothingScale import ASPHClassicSmoothingScale
4446
from ASPHSmoothingScaleUserFilter import ASPHSmoothingScaleUserFilter
4547
from ASPHRadialFunctor import ASPHRadialFunctor
4648

@@ -52,6 +54,7 @@
5254
FixedSmoothingScale{ndim}d = PYB11TemplateClass(FixedSmoothingScale, template_parameters="{Dimension}")
5355
SPHSmoothingScale{ndim}d = PYB11TemplateClass(SPHSmoothingScale, template_parameters="{Dimension}")
5456
ASPHSmoothingScale{ndim}d = PYB11TemplateClass(ASPHSmoothingScale, template_parameters="{Dimension}")
57+
ASPHClassicSmoothingScale{ndim}d = PYB11TemplateClass(ASPHClassicSmoothingScale, template_parameters="{Dimension}")
5558
ASPHSmoothingScaleUserFilter{ndim}d = PYB11TemplateClass(ASPHSmoothingScaleUserFilter, template_parameters="{Dimension}")
5659
ASPHRadialFunctor{ndim}d = PYB11TemplateClass(ASPHRadialFunctor, template_parameters="{Dimension}")
5760

src/SPH/PSPHHydros.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ def PSPH(dataBase,
7575
# Smoothing scale update
7676
if smoothingScaleMethod is None:
7777
if ASPH:
78-
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
78+
if isinstance(ASPH, str) and ASPH.upper() == "CLASSIC":
79+
smoothingScaleMethod = eval(f"ASPHClassicSmoothingScale{ndim}d({HUpdate}, W)")
80+
else:
81+
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
7982
else:
8083
smoothingScaleMethod = eval(f"SPHSmoothingScale{ndim}d({HUpdate}, W)")
8184
result._smoothingScaleMethod = smoothingScaleMethod

src/SPH/SPHHydros.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ def SPH(W,
121121
if smoothingScaleMethod is None:
122122
WH = W.baseKernel1d if GeometryRegistrar.coords() == CoordinateType.Spherical else W
123123
if ASPH:
124-
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, WH)")
124+
if isinstance(ASPH, str) and ASPH.upper() == "CLASSIC":
125+
smoothingScaleMethod = eval(f"ASPHClassicSmoothingScale{ndim}d({HUpdate}, WH)")
126+
else:
127+
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, WH)")
125128
else:
126129
smoothingScaleMethod = eval(f"SPHSmoothingScale{ndim}d({HUpdate}, WH)")
127130
result._smoothingScaleMethod = smoothingScaleMethod

0 commit comments

Comments
 (0)