The paper presents the initial approach to mathematical and numerical modelling and optimization of heat and mass transfer in elements of the masonry wall. The considered single moist brick is placed in the channel through which the dry air is flowing. Only one wall of the brick is in contact with the flowing air and through this boundary heat and moisture are exchanged. The non-equilibrium mathematical model is formulated for general case with three phases of moisture present in the porous building material, i.e., water vapour in the moist air filling the pores, liquid water (bound water) adsorbed at the surface of the solid component of the material and free liquid water either in a discontinuous form (funicular) or continuous one (pendular). However, at this stage of development of the numerical model the moisture in the form of motionless liquid water and water vapour which reside in the ceramic material are considered. Moreover, the moisture and heat diffusion in the porous hydroscopic material of the brick as well as moisture and heat convection in the flowing air are assumed. The numerical model is developed with the aid of the commercial software ANSYS Fluent and its advanced customisation functionalities like the User-Defined Function, User-Defined Scalar and User-Defined Memory. Subsequently, investigation of the influence of the mass transfer coefficient between the free liquid water and moist air in the porous building material are carried out.