I've heard somewhere that during summer the temperature of ground water is lower than that on the Earth while during winter the temperature of ground water is higher.
How is this possible ?
Thermodynamics – Why Ground Water Remains Cold in Summer and Hot in Winter
heat conductionthermodynamics
Related Solutions
It will depend on a lot of factors.
Summer
Typically, otherwise-identical flats near the top, will be hotter than those near the bottom, for two reasons:
1) heat rises - so heat will rise from lower flats to upper flats. More accurately, the density of air decreases as temperature rises, so hotter air will tend to rise up through buildings, where convection is possible.
2) overshading is likely to be less, higher up: in summer, most of the heat in a typical flat will come from solar gain (rather than, say, from internal gains from cooking, people, appliances). The more that windows are overshaded, the lower this solar gain is. Flats low down will have their windows overshaded by neighbouring buildings, trees, and so on. Flats higher up will see more sky from their windows; so will have higher solar gain.
Winter
Much of the stuff above, particularly about heat rising, but also about solar gain, still applies in winter: although heating systems may now be the single largest source of heat, solar gains can still be relevant, if there are large south-facing windows.
Basements
Obviously, there's little or no solar gain - there may be some small windows at the footway ground level, but not much. However, as @anna-v says, there is the moderating effect of the ground itself, which acts as a large thermal store. This large thermal mass will act as a seasonal buffer, heating very slowly through spring and summer, and cooling slowly through autumn and winter, thus typically moderating both the hottest summer temperatures and the coldest winter temperatures.
There are software packages, such as Energyplus, and PHPP that can model solar gain and the effects of thermal mass, at any time of year, for any location; but note that will need a lot of input parameters to do a decent job of it.
It seems we have reached the point where simple models are no longer satisfying. Rather than posing ad hoc DEs maybe it's time to try an actual physical model. Short of doing a full hydrodynamic simulation (definitely overkill here) we can try what is called a lumped capacitance model where we divide the system up into a number of "lumps" and energy flows between the lumps:
The fundamental law governing this system is the conservation of energy. Every lump has an equation of the form
$$ \frac{\mathrm{d}}{\mathrm{d}t}(\text{energy in lump}) = \text{rate of energy entering} - \text{rate of energy leaving}. $$
We treat the heat input as a fixed flow and the air (environment) as a heat bath at a fixed temperature. If we let the heat capacity of the $i$-th lump be $C_i(T)$, which can be a function of temperature then
$$ \begin{array}{rcl} \frac{\mathrm{d}}{\mathrm{d}t} \left( C_p(T_p) T_p \right) &=& P - r_1 (T_p - T_w) - r_2 (T_p - T_a)\\ \frac{\mathrm{d}}{\mathrm{d}t} \left( C_w(T_w) T_w \right) &=& r_1 (T_p - T_w) - r_3 (T_w - T_a) \end{array} $$
You can look up how the heat capacity $C_w(T)$ varies with temperature for water (though probably not for the pot material?), but we will simplify dramatically and assume, incorrectly, that the heat capacities are constant.
$$ \begin{array}{rccl} \frac{\mathrm{d}}{\mathrm{d}t} T_p &=& - \frac{r_1 + r_2}{C_p} T_p + \frac{r_1}{C_p} T_w + \frac{P + r_2 T_a}{C_p} &\equiv& a T_p + b T_w + s_p\\ \frac{\mathrm{d}}{\mathrm{d}t} T_w &=& \frac{r_1}{C_w} T_p - \frac{r_1 + r_3}{C_w} T_w + \frac{r_3 T_a}{C_w} &\equiv& c T_p + d T_w + s_w \end{array} $$
where the $a,b,c,d,s_p,s_w$ are shorthands. Note that only six combinations of the seven parameters ($r_1,r_2,r_3,P,T_a,C_p,C_w$) actually enter the problem, so there is some degeneracy of the parameters. You can see, Taro, that this is almost the model you came up with in your answer. The difference is that I'm including the heat input explicitly, so that conservation of energy is guaranteed.
With the obvious matrix shorthand these equations can be written
$$ \dot{T}-MT = s, $$
which, for a constant source, has the solution
$$ T\left(t\right) = \mathrm{e}^{Mt}T_{0}+\mathrm{e}^{Mt}\left(\int_{0}^{t}\mathrm{e}^{-M\tau}\mathrm{d}\tau\right) s. $$
When $M$ is invertible (which it definitely should be for this problem - if it's not then there is a mistake somewhere) the integral can be simplified:
$$ T\left(t\right) = \mathrm{e}^{Mt}\left(T_{0}+M^{-1}s\right)-M^{-1}s. $$
You can check this satisfies the original equation with the proper boundary conditions. There are eight parameters to fit: the four matrix elements, two sources, and two initial temperatures. It is a non-linear regression problem since the matrix exponential depends non-linearly on the fit parameters. So I'm afraid I don't know of a robust and efficient way to fit this model to your data, unless you use some assumptions to simplify the parameter dependence, but this is the physically motivated model for your situation.
Best Answer
Soil is a bad conductor of heat. So, the layers of the top surface of earth act as insulators.
During summer, they insulate the underground water and soil from the heat radiation from the sun, and from the general hotter atmosphere, hence underground water is colder.
In winter, they again act as insulating layer and prevent the heat from underground to escape into the cold outside air. Thus, underground water can be warmer than outside.
One noteworthy point is that the underground water temperature remains fairly constant throughout the year, (for a given geographical region), because the water table is quite below the ground, and hence it is insulated from the outside atmosphere.
It feels colder during summer, because outside water is hotter and it feels warmer during winter because outside water is colder .