Skip to content

Commit 40b69fa

Browse files
Deleted simple model and restructure Yukawa (#315)
* changed M from 50 to 20 to speed up computation * made a simpler version of the Yukawa model * file with collision generation * ran black and replaced addOrModify with add * Delete simple model * Load the Yukawa config file * removed comments at the end of yukawa.py * use default logging and added explicit configuration options * deleted config file and added comments explaining modified config params --------- Co-authored-by: Benoit <benoit.laurent96@gmail.com>
1 parent a6eda74 commit 40b69fa

File tree

3 files changed

+19
-277
lines changed

3 files changed

+19
-277
lines changed

Models/Yukawa/yukawa.py

+9-179
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,15 @@ def main() -> None:
156156

157157
manager = WallGo.WallGoManager()
158158

159+
# Change the amount of grid points in the spatial coordinates
160+
# for faster computations
161+
manager.config.configGrid.spatialGridSize = 20
162+
# Increase the number of iterations in the wall solving to
163+
# ensure convergence
164+
manager.config.configEOM.maxIterations = 25
165+
# Decrease error tolerance for phase tracing to ensure stability
166+
manager.config.configThermodynamics.phaseTracerTol = 1e-8
167+
159168
pathtoCollisions = pathlib.Path(__file__).resolve().parent / pathlib.Path(
160169
f"CollisionOutput_N11"
161170
)
@@ -218,182 +227,3 @@ def main() -> None:
218227
## Don't run the main function if imported to another file
219228
if __name__ == "__main__":
220229
main()
221-
222-
223-
# class YukawaModelExample(WallGoExampleBase):
224-
# """
225-
# Sets up the Yukawa model, computes or loads the collison
226-
# integrals, and computes the wall velocity.
227-
# """
228-
229-
# def __init__(self) -> None:
230-
# """"""
231-
# self.bShouldRecalculateMatrixElements = False
232-
233-
# self.bShouldRecalculateCollisions = False
234-
235-
# self.matrixElementFile = pathlib.Path(
236-
# self.exampleBaseDirectory
237-
# / "MatrixElements/MatrixElements_Yukawa.json"
238-
# )
239-
240-
# def initWallGoModel(self) -> "WallGo.GenericModel":
241-
# """
242-
# Initialize the model. This should run after cmdline argument parsing
243-
# so safe to use them here.
244-
# """
245-
# return YukawaModel()
246-
247-
# def initCollisionModel(
248-
# self, wallGoModel: "YukawaModel"
249-
# ) -> "WallGoCollision.PhysicsModel":
250-
# """Initialize the Collision model and set the seed."""
251-
252-
# import WallGoCollision # pylint: disable = C0415
253-
254-
# # Collision integrations utilize Monte Carlo methods, so RNG is involved.
255-
# # We can set the global seed for collision integrals as follows.
256-
# # This is optional; by default the seed is 0.
257-
# WallGoCollision.setSeed(0)
258-
259-
# collisionModelDefinition = (
260-
# WallGo.collisionHelpers.generateCollisionModelDefinition(wallGoModel)
261-
# )
262-
263-
# # Add in-equilibrium particles that appear in collision processes
264-
# phiParticle = WallGoCollision.ParticleDescription()
265-
# phiParticle.name = "phi"
266-
# phiParticle.index = 0
267-
# phiParticle.bInEquilibrium = True
268-
# phiParticle.bUltrarelativistic = True
269-
# phiParticle.type = WallGoCollision.EParticleType.eBoson
270-
# # mass-sq function not required or used for UR particles,
271-
# # and it cannot be field-dependent for collisions.
272-
# # Backup of what the vacuum mass was intended to be:
273-
# """
274-
# msqVacuum=lambda fields: (
275-
# msq + g * fields.getField(0) + lam / 2 * fields.getField(0) ** 2
276-
# ),
277-
# """
278-
279-
# parameters = WallGoCollision.ModelParameters()
280-
281-
# parameters.addOrModifyParameter("y", wallGoModel.modelParameters["y"])
282-
# parameters.addOrModifyParameter("gamma", wallGoModel.modelParameters["gamma"])
283-
# parameters.addOrModifyParameter("lam", wallGoModel.modelParameters["lam"])
284-
# parameters.addOrModifyParameter("v", 0.0)
285-
286-
# parameters.addOrModifyParameter(
287-
# "mf2", 1 / 16 * wallGoModel.modelParameters["y"] ** 2
288-
# ) # phi thermal mass^2 in units of T
289-
# parameters.addOrModifyParameter(
290-
# "ms2",
291-
# + wallGoModel.modelParameters["lam"] / 24.0
292-
# + wallGoModel.modelParameters["y"] ** 2.0 / 6.0,
293-
# ) # psi thermal mass^2 in units of T
294-
295-
# collisionModelDefinition.defineParticleSpecies(phiParticle)
296-
# collisionModelDefinition.defineParameters(parameters)
297-
298-
# collisionModel = WallGoCollision.PhysicsModel(collisionModelDefinition)
299-
300-
# return collisionModel
301-
302-
# def configureCollisionIntegration(
303-
# self, inOutCollisionTensor: "WallGoCollision.CollisionTensor"
304-
# ) -> None:
305-
# """Non-abstract override"""
306-
307-
# import WallGoCollision # pylint: disable = C0415
308-
309-
# """We can also configure various verbosity settings that are useful when
310-
# you want to see what is going on in long-running integrations. These
311-
# include progress reporting and time estimates, as well as a full result dump
312-
# of each individual integral to stdout. By default these are all disabled.
313-
# Here we enable some for demonstration purposes.
314-
# """
315-
# verbosity = WallGoCollision.CollisionTensorVerbosity()
316-
# verbosity.bPrintElapsedTime = (
317-
# True # report total time when finished with all integrals
318-
# )
319-
320-
# """Progress report when this percentage of total integrals (approximately)
321-
# have been computed. Note that this percentage is per-particle-pair, ie.
322-
# each (particle1, particle2) pair reports when this percentage of their
323-
# own integrals is done. Note also that in multithreaded runs the
324-
# progress tracking is less precise.
325-
# """
326-
# verbosity.progressReportPercentage = 0.25
327-
328-
# # Print every integral result to stdout? This is very slow and
329-
# # verbose, intended only for debugging purposes
330-
# verbosity.bPrintEveryElement = False
331-
332-
# inOutCollisionTensor.setIntegrationVerbosity(verbosity)
333-
334-
# def configureManager(self, inOutManager: "WallGo.WallGoManager") -> None:
335-
# inOutManager.config.loadConfigFromFile(
336-
# pathlib.Path(self.exampleBaseDirectory / "yukawaConfig.ini")
337-
# )
338-
# super().configureManager(inOutManager)
339-
340-
# def updateModelParameters(
341-
# self, model: "YukawaModel", inputParameters: dict[str, float]
342-
# ) -> None:
343-
# """Update internal model parameters. This example is constructed so
344-
# that the effective potential and particle mass functions refer to
345-
# model.modelParameters, so be careful not to replace that reference here.
346-
# """
347-
348-
# # oldParams = model.modelParameters.copy()
349-
# model.updateModel(inputParameters)
350-
351-
# def getBenchmarkPoints(self) -> list[ExampleInputPoint]:
352-
# """
353-
# Input parameters, phase info, and settings for the effective potential and
354-
# wall solver for the Yukawa benchmark point.
355-
# """
356-
357-
# output: list[ExampleInputPoint] = []
358-
# output.append(
359-
# ExampleInputPoint(
360-
# {
361-
# "sigma": 0.0,
362-
# "msq": 1.0,
363-
# "gamma": -1.2,
364-
# "lam": 0.10,
365-
# "y": 0.55,
366-
# "mf": 0.30,
367-
# },
368-
# WallGo.PhaseInfo(
369-
# temperature=8.0, # nucleation temperature
370-
# phaseLocation1=WallGo.Fields([0.4]),
371-
# phaseLocation2=WallGo.Fields([27.0]),
372-
# ),
373-
# WallGo.VeffDerivativeSettings(
374-
# temperatureVariationScale=1.0,
375-
# fieldValueVariationScale=[
376-
# 100.0,
377-
# ],
378-
# ),
379-
# WallGo.WallSolverSettings(
380-
# # we actually do both cases in the common example
381-
# bIncludeOffEquilibrium=True,
382-
# # meanFreePathScale is determined here by the annihilation channels,
383-
# # and scales inversely with y^4 or lam^2. This is why
384-
# # meanFreePathScale has to be so large.
385-
# meanFreePathScale=10000.0, # In units of 1/Tnucl
386-
# wallThicknessGuess=10.0, # In units of 1/Tnucl
387-
# ),
388-
# )
389-
# )
390-
391-
# return output
392-
393-
# # ~ End WallGoExampleBase interface
394-
395-
396-
# if __name__ == "__main__":
397-
398-
# example = YukawaModelExample()
399-
# example.runExample()

Models/Yukawa/yukawaConfig.ini

-95
This file was deleted.

Models/Yukawa/yukawaWithCollisionGeneration.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,18 @@ def configureCollisionIntegration(
140140
inOutCollisionTensor.setIntegrationVerbosity(verbosity)
141141

142142
def configureManager(self, inOutManager: "WallGo.WallGoManager") -> None:
143-
inOutManager.config.loadConfigFromFile(
144-
pathlib.Path(self.exampleBaseDirectory / "yukawaConfig.ini")
145-
)
143+
146144
super().configureManager(inOutManager)
147145

146+
# Change the amount of grid points in the spatial coordinates
147+
# for faster computations
148+
inOutManager.config.configGrid.spatialGridSize = 20
149+
# Increase the number of iterations in the wall solving to
150+
# ensure convergence
151+
inOutManager.config.configEOM.maxIterations = 25
152+
# Decrease error tolerance for phase tracing to ensure stability
153+
inOutManager.config.configThermodynamics.phaseTracerTol = 1e-8
154+
148155
def updateModelParameters(
149156
self, model: "YukawaModel", inputParameters: dict[str, float]
150157
) -> None:

0 commit comments

Comments
 (0)