Wall-Go / WallGo

Tools for computing bubble wall speed in cosmological phase transitions
https://wallgo.readthedocs.io/
GNU General Public License v3.0
5 stars 0 forks source link

AttributeError: 'Hydrodynamics' object has no attribute 'thermodynamicsExtrapolate' #324

Closed jonasmatu closed 2 weeks ago

jonasmatu commented 1 month ago

In the implementation of a new model I get an AttributeError:

/home/jonas/Research/PhD/BubbleWalls/WallGo/src/WallGo/hydrodynamicsTemplateModel.py:275: RuntimeWarning: invalid value encountered in scalar power
  psi = self.psiN * self.wFromAlpha(al) ** (self.nu / self.mu - 1)
/home/jonas/Research/PhD/BubbleWalls/WallGo/src/WallGo/hydrodynamicsTemplateModel.py:545: RuntimeWarning: invalid value encountered in scalar power
  Tp = self.Tnucl * wp ** (1 / self.mu)
/home/jonas/Research/PhD/BubbleWalls/WallGo/src/WallGo/hydrodynamics.py:468: RuntimeWarning: invalid value encountered in sqrt
  vp = np.sqrt((Tm**2 - Tp**2 * (1 - vm**2))) / Tm
Traceback (most recent call last):
  File "/home/jonas/Research/PhD/BubbleWalls/WallGo/Models/DarkFermion/darkFermion.py", line 736, in <module>
    example.runExample()
  File "/home/jonas/Research/PhD/BubbleWalls/WallGo/Models/wallGoExampleBase.py", line 293, in runExample
    vwLTE = manager.wallSpeedLTE()
            ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jonas/Research/PhD/BubbleWalls/WallGo/src/WallGo/wallGoManager.py", line 400, in wallSpeedLTE
    return self.hydrodynamics.findvwLTE()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jonas/Research/PhD/BubbleWalls/WallGo/src/WallGo/hydrodynamics.py", line 894, in findvwLTE
    shockTnuclDiffMin = shockTnuclDiff(vmin)
                        ^^^^^^^^^^^^^^^^^^^^
  File "/home/jonas/Research/PhD/BubbleWalls/WallGo/src/WallGo/hydrodynamics.py", line 854, in shockTnuclDiff
    vp, _, Tp, _ = self.matchDeflagOrHyb(vw)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jonas/Research/PhD/BubbleWalls/WallGo/src/WallGo/hydrodynamics.py", line 481, in matchDeflagOrHyb
    "csq": self.thermodynamicsExtrapolate.csqLowT(Tm),
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Hydrodynamics' object has no attribute 'thermodynamicsExtrapolate'
benoitlaurent96 commented 1 month ago

Hi, thank you for sharing this problem with us. This error actually happened while raising a different error, which is supposed to say "Hydrodynamics error: Not able to find vp in matchDeflagOrHyb. Can sometimes be caused by a negative sound speed squared. If that is the case, try decreasing phaseTracerTol or the temperature scale, which will improve the potential's interpolation." Can you try to decrease phaseTracerTol, either by changing the value in the config file (if you do use a config file) or by changing it manually with manager.config.configThermodynamics.phaseTracerTol = X just after initializing the manager. In the meantime I'll fix the bug that prevented that error message from being shown.

jonasmatu commented 3 weeks ago

Hi, now the intended error message WallGo.exceptions.WallGoError: Invalid sound speed at nucleation temperature appears, thanks! I decreased the phaseTracerTol value, without success . So I put a few print statements in HydrodynamicsTemplateModel.__init__(), to see if the correct minimum is found. It appears that the sound speed is calculated twice for the same values of thermodynamics.phaseLowT, thermodynamics.phaseHighT and thermodynamics.Tnucl, and for the second time (I assume after the phase tracing) it becomes negative.

Found phase 1: phi = [[0.]], Veff(phi) = [-2.13551065e+09], T = 218.65003776798793
Found phase 2: phi = [[669.660973]], Veff(phi) = [-2.14234181e+09], T = 218.65003776798793
Calculated sound speed at thermodynamics.Tnucl:  218.65003776798793
thermodynamics.phaseLowT =  [[669.660973]]
thermodynamics.phaseHighT =  [[0.]]
cb2 =  0.28794985267040807
cs2 =  0.3334743711124421
vwLTE in the template model: 0.49323997645549306
Temperature ranges:
High-T phase: TMin = 206.36505919701867, TMax = 284.69438598573237
Low-T phase: TMin = 174.92320181873708, TMax = 227.40790617634428
Calculated sound speed at thermodynamics.Tnucl:  218.65003776798793
thermodynamics.phaseLowT =  [[669.660973]]
thermodynamics.phaseHighT =  [[0.]]
cb2 =  0.27313490684868424
cs2 =  -0.12086005903796496

I checked the calculation of the sound speed around the nucleation temperature and get a bit of a wired behavior. To me it seems that around the nucleation temperature the sound speed becomes unstable. I attached a plot of the sound speed in the symmetric phase around the nucleation temperature (dashed vertical line) below. cs2

jorindevandevis commented 3 weeks ago

That indeed looks like an issue with the phase tracing. Could you try increasing the temperatureVariationScale (temperatureScale in older version of the code)? If you don't mind, maybe you can send us your code via email? Might be easier to see what's going on.

jorindevandevis commented 3 weeks ago

Thanks for helping us find this funny feature! It turned out that the step size in the phase tracing was too small, and this was fixed in https://github.com/Wall-Go/WallGo/pull/335 Could you let us know if it solves your problem?

jonasmatu commented 3 weeks ago

Yes this now fixes the problem. Thanks!