MassimoCimmino / pygfunction

An open-source toolbox for the evaluation of thermal response factors (g-functions) of geothermal borehole fields.
BSD 3-Clause "New" or "Revised" License
46 stars 20 forks source link

Pipe methods can return complex valued ouputs #99

Closed MassimoCimmino closed 3 years ago

MassimoCimmino commented 3 years ago

Pipe class methods can return complex-valued outputs. This was observed when running unit tests in pipes_tests for the MultipleUTube configuration.

This could be fixed using np.real() either on the Multipole method (preferably) when computing the thermal resistance matrix or in the class methods themselves.

MassimoCimmino commented 3 years ago

It seems the cause is the calculation of eigenvalues in MultipleUTube._update_model_variables(). The coefficient matrix _A calculated from the resistances is correctly real-valued.

https://github.com/MassimoCimmino/pygfunction/blob/7d37b8b3bf4b349701681e42281c21cccb54ca42/pygfunction/pipes.py#L1551-L1552

The two options are: