Skip to content

Commit

Permalink
Merge pull request #322 from LLNL/feature/ASPHClassic
Browse files Browse the repository at this point in the history
Bringing back our old ASPH idealH algorithm as a new option, ASPHClassic
  • Loading branch information
jmikeowen authored Jan 9, 2025
2 parents 69b1459 + 5f2c63d commit 0ad6173
Show file tree
Hide file tree
Showing 22 changed files with 993 additions and 339 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Notable changes include:
during assignement, equality, and cloning operations. This is intended to help ensure our Physics advance during time integration
is correct.
* 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.
* 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.
* Build changes / improvements:
* Distributed source directory must always be built now.
Expand Down
5 changes: 4 additions & 1 deletion src/CRKSPH/CRKSPHHydros.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ def CRKSPH(dataBase,
# Smoothing scale update
if smoothingScaleMethod is None:
if ASPH:
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
if isinstance(ASPH, str) and ASPH.upper() == "CLASSIC":
smoothingScaleMethod = eval(f"ASPHClassicSmoothingScale{ndim}d({HUpdate}, W)")
else:
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
else:
smoothingScaleMethod = eval(f"SPHSmoothingScale{ndim}d({HUpdate}, W)")
result._smoothingScaleMethod = smoothingScaleMethod
Expand Down
5 changes: 4 additions & 1 deletion src/FSISPH/FSISPHHydros.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ def FSISPH(dataBase,
# Smoothing scale update
if smoothingScaleMethod is None:
if ASPH:
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
if isinstance(ASPH, str) and ASPH.upper() == "CLASSIC":
smoothingScaleMethod = eval(f"ASPHClassicSmoothingScale{ndim}d({HUpdate}, W)")
else:
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
else:
smoothingScaleMethod = eval(f"SPHSmoothingScale{ndim}d({HUpdate}, W)")
result._smoothingScaleMethod = smoothingScaleMethod
Expand Down
15 changes: 12 additions & 3 deletions src/GSPH/GSPHHydros.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ def GSPH(dataBase,
# Smoothing scale update
if smoothingScaleMethod is None:
if ASPH:
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
if isinstance(ASPH, str) and ASPH.upper() == "CLASSIC":
smoothingScaleMethod = eval(f"ASPHClassicSmoothingScale{ndim}d({HUpdate}, W)")
else:
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
else:
smoothingScaleMethod = eval(f"SPHSmoothingScale{ndim}d({HUpdate}, W)")
result._smoothingScaleMethod = smoothingScaleMethod
Expand Down Expand Up @@ -159,7 +162,10 @@ def MFM(dataBase,
# Smoothing scale update
if smoothingScaleMethod is None:
if ASPH:
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
if isinstance(ASPH, str) and ASPH.upper() == "CLASSIC":
smoothingScaleMethod = eval(f"ASPHClassicSmoothingScale{ndim}d({HUpdate}, W)")
else:
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
else:
smoothingScaleMethod = eval(f"SPHSmoothingScale{ndim}d({HUpdate}, W)")
result._smoothingScaleMethod = smoothingScaleMethod
Expand Down Expand Up @@ -248,7 +254,10 @@ def MFV(dataBase,
# Smoothing scale update
if smoothingScaleMethod is None:
if ASPH:
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
if isinstance(ASPH, str) and ASPH.upper() == "CLASSIC":
smoothingScaleMethod = eval(f"ASPHClassicSmoothingScale{ndim}d({HUpdate}, W)")
else:
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
else:
smoothingScaleMethod = eval(f"SPHSmoothingScale{ndim}d({HUpdate}, W)")
result._smoothingScaleMethod = smoothingScaleMethod
Expand Down
2 changes: 2 additions & 0 deletions src/Integrator/Integrator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ Integrator(DataBase<Dimension>& dataBase,
mAllowDtCheck(false),
mRequireConnectivity(true),
mRequireGhostConnectivity(false),
mRequireOverlapConnectivity(false),
mRequireIntersectionConnectivity(false),
mDataBasePtr(&dataBase),
mPhysicsPackages(physicsPackages),
mRigorousBoundaries(false),
Expand Down
76 changes: 76 additions & 0 deletions src/PYB11/SmoothingScale/ASPHClassicSmoothingScale.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#-------------------------------------------------------------------------------
# ASPHClassicSmoothingScale
#-------------------------------------------------------------------------------
from PYB11Generator import *
from SmoothingScaleBase import *

@PYB11template("Dimension")
class ASPHClassicSmoothingScale(SmoothingScaleBase):

PYB11typedefs = """
using Scalar = typename %(Dimension)s::Scalar;
using Vector = typename %(Dimension)s::Vector;
using Tensor = typename %(Dimension)s::Tensor;
using SymTensor = typename %(Dimension)s::SymTensor;
using ThirdRankTensor = typename %(Dimension)s::ThirdRankTensor;
using TimeStepType = typename Physics<%(Dimension)s>::TimeStepType;
"""

#...........................................................................
# Constructors
def pyinit(self,
HUpdate = "HEvolutionType",
W = "const TableKernel<%(Dimension)s>&"):
"ASPHClassicSmoothingScale constructor"

#...........................................................................
# Virtual methods
@PYB11virtual
def initializeProblemStartup(self,
dataBase = "DataBase<%(Dimension)s>&"):
"""An optional hook to initialize once when the problem is starting up.
Typically this is used to size arrays once all the materials and NodeLists have
been created. It is assumed after this method has been called it is safe to
call Physics::registerState for instance to create full populated State objects."""
return "void"

@PYB11virtual
def registerDerivatives(self,
dataBase = "DataBase<%(Dimension)s>&",
derivs = "StateDerivatives<%(Dimension)s>&"):
"Register the derivatives/change fields for updating state."
return "void"

@PYB11virtual
@PYB11const
def evaluateDerivatives(self,
time = "const Scalar",
dt = "const Scalar",
dataBase = "const DataBase<%(Dimension)s>&",
state = "const State<%(Dimension)s>&",
derivs = "StateDerivatives<%(Dimension)s>&"):
"Increment the derivatives."
return "void"

@PYB11virtual
@PYB11const
def label(self):
return "std::string"

@PYB11virtual
@PYB11const
def dumpState(self, file="FileIO&", pathName="const std::string&"):
"Serialize under the given path in a FileIO object"
return "void"

@PYB11virtual
def restoreState(self, file="const FileIO&", pathName="const std::string&"):
"Restore state from the given path in a FileIO object"
return "void"

#...........................................................................
# Attributes
WT = PYB11property("const TableKernel<%(Dimension)s>&", "WT", doc="The interpolation kernel")
zerothMoment = PYB11property("const FieldList<%(Dimension)s, Scalar>&", "zerothMoment", doc="The zeroth moment storage FieldList")
firstMoment = PYB11property("const FieldList<%(Dimension)s, Vector>&", "firstMoment", doc="The first moment storage FieldList")
secondMoment = PYB11property("const FieldList<%(Dimension)s, SymTensor>&", "secondMoment", doc="The second moment storage FieldList")
3 changes: 3 additions & 0 deletions src/PYB11/SmoothingScale/SmoothingScale_PYB11.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
'"SmoothingScale/FixedSmoothingScale.hh"',
'"SmoothingScale/SPHSmoothingScale.hh"',
'"SmoothingScale/ASPHSmoothingScale.hh"',
'"SmoothingScale/ASPHClassicSmoothingScale.hh"',
'"SmoothingScale/ASPHSmoothingScaleUserFilter.hh"',
'"SmoothingScale/ASPHRadialFunctor.hh"',
'"SmoothingScale/polySecondMoment.hh"',
Expand All @@ -41,6 +42,7 @@
from FixedSmoothingScale import FixedSmoothingScale
from SPHSmoothingScale import SPHSmoothingScale
from ASPHSmoothingScale import ASPHSmoothingScale
from ASPHClassicSmoothingScale import ASPHClassicSmoothingScale
from ASPHSmoothingScaleUserFilter import ASPHSmoothingScaleUserFilter
from ASPHRadialFunctor import ASPHRadialFunctor

Expand All @@ -52,6 +54,7 @@
FixedSmoothingScale{ndim}d = PYB11TemplateClass(FixedSmoothingScale, template_parameters="{Dimension}")
SPHSmoothingScale{ndim}d = PYB11TemplateClass(SPHSmoothingScale, template_parameters="{Dimension}")
ASPHSmoothingScale{ndim}d = PYB11TemplateClass(ASPHSmoothingScale, template_parameters="{Dimension}")
ASPHClassicSmoothingScale{ndim}d = PYB11TemplateClass(ASPHClassicSmoothingScale, template_parameters="{Dimension}")
ASPHSmoothingScaleUserFilter{ndim}d = PYB11TemplateClass(ASPHSmoothingScaleUserFilter, template_parameters="{Dimension}")
ASPHRadialFunctor{ndim}d = PYB11TemplateClass(ASPHRadialFunctor, template_parameters="{Dimension}")
Expand Down
5 changes: 4 additions & 1 deletion src/SPH/PSPHHydros.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ def PSPH(dataBase,
# Smoothing scale update
if smoothingScaleMethod is None:
if ASPH:
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
if isinstance(ASPH, str) and ASPH.upper() == "CLASSIC":
smoothingScaleMethod = eval(f"ASPHClassicSmoothingScale{ndim}d({HUpdate}, W)")
else:
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, W)")
else:
smoothingScaleMethod = eval(f"SPHSmoothingScale{ndim}d({HUpdate}, W)")
result._smoothingScaleMethod = smoothingScaleMethod
Expand Down
5 changes: 4 additions & 1 deletion src/SPH/SPHHydros.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ def SPH(W,
if smoothingScaleMethod is None:
WH = W.baseKernel1d if GeometryRegistrar.coords() == CoordinateType.Spherical else W
if ASPH:
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, WH)")
if isinstance(ASPH, str) and ASPH.upper() == "CLASSIC":
smoothingScaleMethod = eval(f"ASPHClassicSmoothingScale{ndim}d({HUpdate}, WH)")
else:
smoothingScaleMethod = eval(f"ASPHSmoothingScale{ndim}d({HUpdate}, WH)")
else:
smoothingScaleMethod = eval(f"SPHSmoothingScale{ndim}d({HUpdate}, WH)")
result._smoothingScaleMethod = smoothingScaleMethod
Expand Down
Loading

0 comments on commit 0ad6173

Please sign in to comment.