Since the beginning of the utilisation of nuclear energy to generate electric power, the evaluation of the nuclear plants behaviour under accidental scenarios is an important line of research in the field of nuclear safety. But in most cases, as it is the case of other engineering fields, the experimental assessment of nuclear power plants behaviour is not feasible. This reason makes necessary to use simulation tools capable to reproduce the plant behaviour. In this way, the regulatory bodies allow the use of termalhydraulic simulation codes to guarantee the safe operation of the installations, but only if the uncertainty associated with the simulation is properly quantified. The uncertainties associated with a termohydraulic simulation have different origins as: the limitations of the models used to describe the physical process that take place inside the plant, the errors associated with the numerical models used by the codes in the resolution of such models, and unknown values of different variables necessaries to build the plant model. In order to quantify and limit those uncertainties several methodologies have been developed. But all of them require a certain amount of sensitivity analysis, which are manually performed, and so they strongly depend on the analyst. In this PhD thesis a new methodology to quantify and limit the termalhydraulic simulations has been developed. This new methodology uses an optimisation technique to minimise the user effect introduced in the thermalhydraulic simulations. In this way, an automatic and systematic parameter search and optimisation method is proposed to be used to assure that the error introduced in the simulation is the minimum possible. This new methodology is applied to simple models as the convection equation and the convection-diffusion equation using two different optimisation techniques: a genetic algorithm and a direct search method. In particular, a steady state genetic algorithm and the multidirectional search algorithm have been used to perform the analysis. From the results obtained in the analysis it can be concluded that the direct search method is more efficient to deal with this kind of problems. As an application of the proposed methodology to a best estimated code, two cases included in the RELAP5 assessment matrix have been studied. The purpose of these applications has been to prove the capability of the methodology in the determination of optimal values for parameters of the plant model, such as initial conditions and boundary conditions which are frequently unknown in this kind of simulations. Finally, the methodology has also proved to be useful in the construction of reduced reactor models. These models present different effective parameters which can be optimised to achieve a behaviour of the reduced model as similar as possible to the behaviour of the plant that represents. In particular, a two asymmetric loops PWR reactor model has been constructed, and some of its effective parameters have been determined using as a reference the simulations of operational transients performed with the best estimate code RELAP5. It is shown that for such transients, the reduced model using the parameters obtained from the optimisation allows to forecast the behaviour of the plant with good accuracy.