1 Introduction

As is well known, the asymptotically flat Schwarzschild black holes usually have a negative specific heat and thus cannot be in equilibrium with the thermal radiation environment. In order to overcome this problem, York and other authors provided a simple way of enclosing the black hole in a box [1, 2]. It has been found that black holes could have positive specific heat in this quasi-local ensemble and are thermodynamically stable for a certain range of parameters. On the other side, since the AdS boundary could play a role of the box boundary condition in a sense, the AdS black hole is usually stable [3]. After discovery of the AdS/CFT correspondence [4,5,6,7], holographic superconductors constructed in the AdS spacetime have attracted a lot of attention [8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]. Partly with a view on holography, there is literature paying attention to the similarity between the asymptotically flat gravity with box boundary and AdS gravity.

For the anti-de Sitter space, the phase structure of charged black holes has served as a valuable test of the AdS/CFT correspondence. Compared with AdS gravity, similar phase structures and the same critical transition exponents have been found in the asymptotically flat gravity with a box boundary and it was argued that holography first discovered in the AdS spacetimes may not be only limited to this case [36,37,38]. The similarity of phase transitions observed in quasi-local gravity may cast light on proposals for finite-volume holographic theories. It is interesting to further disclose similarities in AdS gravity and the asymptotically flat gravity with a box boundary.

The Einstein–Maxwell systems with box boundary conditions were studied in [39,40,41] and it was shown that the overall phase structures of these gravity systems are similar to those of AdS gravity. As a further step, it is interesting to generalize the system to a more complete transition model by including an additional scalar field. On the other side, it is also meaningful to study the similarity between transitions of this Einstein–Maxwell-scalar system in a box and those of the s-wave holographic superconductors constructed with scalar fields coupled to Maxwell fields in an AdS background [39,40,41]. Recently, Basu et al. initiated a thermodynamical study of such Einstein–Maxwell-scalar systems on asymptotically flat background with reflecting mirror-like boundary conditions for the scalar field [42]. For a certain range of parameters, this model admits stable hairy black hole solutions, which provides a way to evade the flat space no-hair theorems. Another important conclusion is that the overall phase structure of this gravity system in a box is strikingly similar to that of holographic superconductor systems in AdS gravity [43, 44]. By choosing different values of the scalar charge, the scalar mass and the Stückelberg mechanism parameters, we found that the effects of the model parameters in this flat space/boson star system are qualitatively the same as those in the holographic insulator/superconductor model [44, 45]. Moreover, we also showed that operators on the box boundary can be used to detect the properties of the bulk transitions and for the second order transitions; there exists a characteristic exponent in accordance with the cases in AdS gravity systems. So it is interesting to extend the discussion in the horizonless spacetime in [45] to the background of black holes, which have been studied a lot in holographic theories. On the other hand, it is also meaningful to generalize the quasi-local black hole/hairy black hole transition model in [42] by considering a nonzero mass of the scalar field since the mass usually plays a crucial role in determining the properties of transitions.

It was shown in holographic superconductor theories that a more negative mass corresponds to a larger holographic conductor/supercconductor phase transition temperature or a smaller mass makes the transition easier [46,47,48]. Therefore, it is interesting to compare the effects of the scalar mass on the transition in a box and those of holographic superconductor transitions constructed in AdS gravity. On the other side, it was shown in [49] that hairy black holes in a box can be formed dynamically through the superradiant procedure and the effects of the scalar mass on the dynamical stability of phases have been investigated in [50, 51]. So it is also interesting to further study the thermodynamical properties of such a quasi-local black hole/hairy black hole system with nonzero scalar mass and disclose how the scalar mass could affect the thermodynamical phase transitions.

This paper is organized as follows. In Sect. 2, we introduce the black hole/hairy black hole model in a box with nonzero mass of the scalar field away from the probe limit. In Sect. 3, we use condensation behaviors of a parameter to disclose the properties of phase transitions with various scalar masses in a grand canonical ensemble. The last section is devoted to the conclusions.

2 Equations of motion and boundary conditions

We study the formation of scalar hair on the background of four-dimensional asymptotically flat spacetime in a box. In this paper, we choose a fixed radial coordinate \(r=r_{b}\) as the time-like box boundary. The corresponding Einstein–Maxwell-scalar Lagrange density reads [42]

$$\begin{aligned} {\mathcal {L}}=R-F^{MN}F_{MN}-|\nabla \psi -iq A \psi |^{2}-m^{2}\psi ^{2}, \end{aligned}$$
(1)

where \(\psi (r)\) is the scalar field with mass \(m^2\) and \(A_{M}\) stands for the ordinary Maxwell field. q is the charge of the scalar field serving as a coupling parameter between the scalar field and the Maxwell field. Here, R is the Ricci scalar tensor and \(F=\mathrm{d}A\).

For simplicity, we would like to consider the scalar field and the Maxwell field only depending on the radial coordinates:

$$\begin{aligned} \psi =\psi (r),\quad A=\phi (r)\mathrm{d}t. \end{aligned}$$
(2)

Since we are interested in including the matter fields’ backreaction on the background, we assume the ansatz of the geometry of the four-dimensional hairy black hole solution in the form [42]

$$\begin{aligned} \mathrm{d}s^{2}= & {} -g(r)h(r)\mathrm{d}t^{2}+\frac{\mathrm{d}r^{2}}{g(r)}+r^{2}(\mathrm{d}\theta ^{2}+sin^{2}\theta \mathrm{d}\varphi ^{2}) \end{aligned}$$
(3)

where the Hawking temperature of the black hole reads \(T=\frac{g'(r_{h})\sqrt{h(r_{h})}}{4\pi }\) and \(r_{h}\) is the horizon of the black hole satisfying \(g(r_{h})=0\).

Fig. 1
figure 1

We plot solutions as a function of the radial coordinate r with \(q=100\), \(m^{2}=0\), \(\mu =0.15\) and \(\psi (r_{h})=0.1\). The left panel shows the behaviors of the scalar field \(\psi (r)\) and the right panel is for values of the metric solution h(r)

We obtain the equations of motion for matter fields and metric solutions:

$$\begin{aligned}&\frac{1}{2}\psi '(r)^{2}+\frac{g'(r)}{rg(r)}+\frac{q^2\psi (r)^{2} \phi (r)^2}{2g(r)^2h(r)}+\frac{\phi '(r)^2}{g(r)h(r)}\nonumber \\&\quad -\,\frac{1}{r^2g(r)}+\frac{1}{r^2}+\frac{m^2}{2g}\psi ^2=0, \end{aligned}$$
(4)
$$\begin{aligned}&h'(r)-rh(r)\psi '(r)^2-\frac{q^2r\psi (r)^{2}\phi (r)^2}{g(r)^2}=0, \end{aligned}$$
(5)
$$\begin{aligned}&\phi ''+\frac{2\phi '(r)}{r}-\frac{h'(r)\phi '(r)}{2h(r)}-\frac{q^2\psi (r)^{2}\phi (r)}{2g(r)}=0, \end{aligned}$$
(6)
$$\begin{aligned}&\psi ''(r)+\frac{g'(r)\psi '(r)}{g(r)}+\frac{h'(r)\psi '(r)}{2h(r)}+\frac{2\psi '(r)}{r}\nonumber \\&\quad +\,\frac{q^2\psi (r)\phi (r)^2}{g(r)^2h(r)}-\frac{m^2}{g}\psi =0. \end{aligned}$$
(7)

In order to describe the transitions in detail, we apply the shooting method to integrate these coupled nonlinear differential equations from \(r=r_{h}\) to the box boundary \(r=r_{b}\) to search for the numerical solutions with box boundary conditions. At the horizon of the black hole, \(r=r_{h}\), we write Taylor expansions of solutions, thus: [42]

$$\begin{aligned}&\psi (r)=aa+bb (r-r_{h})+cc (r-r_{h})^2+\cdots ,\nonumber \\&\phi (r)=aaa (r-r_{h})+bbb (r-r_{h})^2+\cdots ,\nonumber \\&g(r)=AA (r-r_{h})+BB (r-r_{h})^2+\cdots ,\nonumber \\&h(r)=1+AAA (r-r_{h})+\cdots , \end{aligned}$$
(8)

where \(aa, bb, \ldots , AAA \) are parameters and the dots denote higher order terms. Putting these expansions into the equations of motion, we could use the three independent parameters \(r_{h}\), aa and aaa to describe the solutions. The scaling symmetry \(r\rightarrow \alpha r\) can be used to set \(r_{b}=1\). Around the box boundary \((r_{b}=1)\), we assume asymptotic behaviors of the scalar field and the Maxwell field,

$$\begin{aligned} \psi\rightarrow & {} \psi _{1}+\psi _{2}(1-r)+\cdots , \end{aligned}$$
(9)
$$\begin{aligned} \phi\rightarrow & {} \phi _{1}+\phi _{2}(1-r)+\cdots , \end{aligned}$$
(10)

where \(\mu =\phi (1)=\phi _{1}\) is interpreted as the chemical potential. In this paper, we will fix the chemical potential and work in a grand canonical ensemble. With the symmetry \(h\rightarrow \beta ^2 h,~\phi \rightarrow \phi ,~t\rightarrow \frac{t}{\beta }\) [42], we make a transformation to set \(g_{tt}(1)=-1\). Since there are reflecting mirror-like boundary conditions for the scalar field as \(\psi (r_{b})=0\), we fix \(\psi _{1}=0\) instead and try to use another parameter \(\psi _{2}\) to describe the phase transition, which is similar to approaches in holographic superconductor theories. Here, we point out that this box boundary condition \(\psi _{1}=0\) is independent of the scalar mass, which is different from the cases in holographic superconductor theories where the asymptotic behaviors of the scalar fields at the infinite boundary usually depend on the scalar mass. We will show in the following section that \(\psi _{2}\) is a good probe of the critical temperature and also of the order of transitions in a box.

3 Properties of phase transitions in a box

In this part, we firstly plot the numerical solutions as a function of the radial coordinate with \(q=100\), \(m^{2}=0\), \(\mu =0.15\) and \(\psi (r_{h})=0.1\) in Fig. 1. In this paper, we take \(q=100\) as an example for the reason that hairy black holes in a box are usually only globally stable for a large charge of the scalar field [42]. When choosing \(m^2=0\), our results are related to the right panel of Fig. 11 in [42]. It can easily be seen from the left panel of Fig. 1 that this gravity system admits scalar hairy black hole solutions and at the boundary there is reflecting condition for the scalar field or \(\psi (r_{b})=0\). We also represent the behaviors of the metric solutions h(r) in the right panel. Since we have \(h(r)=1\) for the cases in the probe limit, the behaviors of curves in the right panel show that the metric is deformed when considering the matter fields’ backreaction on the background.

According to the no-hair theorem, the scalar field cannot attach to the black hole in the usual situation [52,53,54,55,56,57,58,59,60]. The hairy black holes constructed in AdS spacetimes provide a challenge to the black hole no-hair theorem. In AdS gravity, there is an infinite potential wall at the AdS boundary to confine the scalar field [61]. The dynamical formation of scalar hairy black hole due to the AdS boundary was discussed in [62]. In the previous discussion, we have obtained scalar hairy black holes in asymptotically flat gravity with a box boundary. Comparing with AdS gravity, the reflecting box boundary plays a similar role to confine the scalar field; thus it is natural for the scalar field to condense around a black hole mimicking the condensation we observed in the AdS black hole.

Fig. 2
figure 2

We plot V(r) as a function of the radial coordinate r with \(q=100\), \(m^{2}=0\), \(Q=0.001\) and \(M=2\). The vertical dashed blue line \(r_{b}=1\) corresponds to the box boundary and the horizon is around \(r_{h}\thickapprox 0.06667\). Here, we have used the scaling symmetry \(r\rightarrow \alpha r\) to set \(r_{b}=1\) with \(\alpha =\frac{1}{60}\)

Fig. 3
figure 3

We plot the free energy as a function of the temperature in the left panel with \(q=100\), \(m^{2}=0\), \(\mu =0.15\) and the right panel is for the behaviors of \(\psi _{2}\). The solid blue line represents the hairy black hole phases and the solid red line in the left panel shows the free energy of the normal black hole. We also plot the critical transition phase with a solid black point in the left panel

We can further see the similarity from the behavior of the effective potential. Considering a scalar perturbation \(\psi \) on the normal charged black hole, \(g(r)=1-\frac{2M}{r}+\frac{Q^2}{r^2}\), with charge Q and mass M, the scalar field perturbation can be described in the Schrödinger-like equation [63, 64], where \(\mathrm{d}r^{*}=\frac{\mathrm{d}r}{g(r)}\) and \(R(r)=r\psi (r)\),

$$\begin{aligned} \frac{\mathrm{d}^{2}R(r)}{\mathrm{d}r^{*2}}=V(r)R(r). \end{aligned}$$
(11)

The effective potential \(V(r)=(1-\frac{2M}{r}+\frac{Q^2}{r^2})(m^2+\frac{2M}{r^3}-\frac{2Q^2}{r^4})-\frac{q^2Q^2}{r^2}\) is a function of the radius coordinate r. It can be seen from Fig. 2 that there is no potential well outside the black hole for the scalar field to accumulate. However, if we impose a box reflecting boundary (or infinite repulsive potential) at \(r_{b}=1\), we see that a potential well emerges, so that the scalar field can be confined and condensed in the well to lead to the formation of the scalar hair. The formation of hairy black holes with low frequency scalar perturbation if an additional box was placed far enough from the black hole horizon was observed in [49, 50]. The appearance of the potential well in the asymptotically flat gravity with a box boundary is similar to that observed in the AdS case and plays a similar role for the scalar field to condense.

It is well known that the free energy is suitable for disclosing the properties of phase transitions. The authors in [42] have proposed a way to calculate the free energy of the system by doing a subtraction of the flat space background. In this way, the free energy of the Minkowski box is set to zero. We show the free energy of the gravity system as a function of the temperature in the cases of \(q=100\), \(m^{2}=0\) and \(\mu =0.15\) in the left panel of Fig. 3. Since the physical procedure is with the lowest free energy, we can choose only one phase for every fixed value of the temperature. It can easily be seen from the left panel that the solid blue line is physical and there is a critical temperature \(T_{c}=0.4910\), below which the normal black hole phase changes into the hairy black hole phases. As the free energy is smooth with respect to the temperature around the phase transition points, this black hole/hairy black hole transition is of the second order.

Inspired by approaches in the holographic superconductor theory, we also want to disclose the properties of transitions from a condensation diagram directly related to asymptotic behaviors of the scalar field on the boundary. In this work, we use \(\psi _{2}\) as a parameter to describe the properties of phase transitions. In the right panel of Fig. 3, we plot \(\psi _{2}\) with respect to T in the cases of \(q=100\), \(m^{2}=0\) and \(\mu =0.15\). It can be seen from the right panel that \(\psi _{2}\) becomes larger as we choose a smaller temperature, which is qualitatively the same as the properties in holographic conductor/superconductor transitions [13, 44]. We also obtain a critical transition temperature \(T=0.4910\) in the right panel, below which the parameter \(\psi _{2}\) becomes nonzero. We mention that this critical transition temperature \(T=0.4910\) is equal to \(T_{c}=0.4910\) as is apparent from the behaviors of the free energy in the left panel. As a summary, we conclude that the parameter \(\psi _{2}\) can be used to determine the critical temperature of the black hole/hairy black hole transition in a box.

Fig. 4
figure 4

We plot the hairy black hole phases by solid blue points. The solid red line corresponds to the function of \(\psi _{2}= 148(T-T_{c})^{1/2}\) with \(T_{c}=0.4910\)

Fig. 5
figure 5

We show behaviors of h(1) as a function of the temperature T with \(q=100\), \(m^2=0\) and \(\mu =0.15\)

Fig. 6
figure 6

In the left panel, we plot the parameter \(\psi _{2}\) with respect to the temperature with \(q=100\), \(\mu =0.15\) and various scalar masses \(m^2\) from left to right: \(m^2=-1\) (red), \(m^2=0\) (blue) and \(m^2=1\) (green). In the right panel, we show the critical temperature \(T_{c}\) as a function of the scalar mass \(m^{2}\) with \(q=100\) and \(\mu =0.15\)

By fitting the numerical data around the phase transition points, we arrive at the analytical relation \(\psi _{2}\varpropto (T_{c}-T)^{\beta }\) with \(\beta =\frac{1}{2}\), which also holds for the condensed scalar operator in the holographic conductor/superconductor system in accordance with mean field theories, signaling a second order phase transition [8, 65,66,67]. We have plotted the fitting formula \(\psi _{2}\thickapprox 148 (T_{c}-T)^{1/2}\) with \(T_{c}=0.4910\) in Fig. 4 by a red solid line. It can be seen from the picture that the solid blue points representing hairy black hole phases almost lie on the solid red line around the critical phase transition temperature. Comparing with the results in Fig. 3, we draw the conclusion that this relation between condensation and temperature is a general property of second order phase transitions for both AdS gravity and asymptotically flat gravity in a box. Here, the parameter \(\psi _{2}\) plays a role strikingly similar to the condensed scalar operator in holographic conductor/superconductor theories.

We have used operators on the box boundary to study the bulk gravity and it works well in revealing the critical phase transition temperature and also the order of the transitions. We also found the critical exponent \(\beta =\frac{1}{2}\) as a characteristic of second order transitions, which usually holds in holographic transitions in asymptotically AdS gravities. These properties imply that the operator on the hard cut-off box boundary covers some information of the bulk transition. Our discussion here provides additional signatures that a boundary/bulk correspondence may exist in asymptotically flat spacetimes.

Besides the condensed scalar operator, it has been found that metric solutions also can be used to disclose the properties of holographic conductor/superconductor transitions and the jump of metric solutions with respect to the temperature corresponds to a second order phase transition [67]. As a further step, we plan to examine whether the metric solutions can be used to study transitions in this quasi-local black hole/hairy black hole transition model. We show the behaviors of h(1) as a function of the temperature in Fig. 5 with \(q=100\), \(m^2=0\) and \(\mu =0.15\). It can be seen from the picture that h(1) has a jump of the slope with respect to the temperature at the critical phase transition points \(T_{c}=0.4910\), implying second order phase transitions in accordance with the results in Fig. 3. We conclude that metric solutions can be used to disclose the threshold phase transition temperature and the order of transitions in asymptotically flat black hole/hairy black hole systems in a box, which is similar to the properties of holographic conductor/superconductor transitions in AdS gravity [67].

For every set of parameters, we obtain a critical temperature \(T_{c}\), below which normal black hole phases transform into hairy black hole phases. By choosing \(q=100\), \(\mu =0.15\) and various scalar masses \(m^2\), we disclose how the scalar mass could affect the critical temperature \(T_{c}\) in the left panel of Fig. 6. We can easily see from the curves in the left panel that \(T_{c}\) decreases as we choose a larger \(m^2\). With more detailed calculations, we to plot \(T_{c}\) as a function of the scalar mass in the right panel of Fig. 6. We again arrive at the conclusion that \(T_{c}\) becomes smaller as we choose a less negative scalar mass or a larger mass makes the phase transitions more difficult, which is qualitatively similar to the cases in holographic transitions in AdS gravity.

4 Conclusions

We studied a general four-dimensional black hole/hairy black hole transition model in a box with nonzero mass of the scalar field in a grand canonical ensemble. Similar to approaches in holographic superconductor theories, we disclosed the properties of transitions through condensation behaviors of a parameter \(\psi _{2}\). With various scalar masses, we examined how the scalar mass can affect the critical temperature mainly from the behaviors of \(\psi _{2}\). We found that the more negative scalar mass corresponds to a larger critical temperature and makes the black hole/hairy black hole transition easier. In particular, we obtained the analytical relation \(\psi _{2}\varpropto (T_{c}-T)^{1/2}\), implying a second order phase transition. Besides the parameter \(\psi _{2}\), we also showed that the metric solutions can be used to detect the critical phase transition temperature and the order of the transitions. We mention that the condensation behavior of the parameter \(\psi _{2}\) is strikingly similar to the scalar operator in a holographic transition system. The properties of transitions in this general quasi-local asymptotically flat gravity are qualitatively the same as those of holographic conductor/superconductor theories in AdS gravity. In summary, we obtained the properties of bulk transitions also observed in holography in AdS gravity. Our results provide an additional signature that holographic theories may also exist in quasi-local asymptotically flat gravity.