diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index b253d6275d20..1e04dc2d946a 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -26,7 +26,7 @@ jobs: config_set: [BaseMPI, ReverseMPI, ForwardMPI, BaseNoMPI, ReverseNoMPI, ForwardNoMPI, BaseOMP, ReverseOMP, ForwardOMP] include: - config_set: BaseMPI - flags: '-Denable-pywrapper=true -Denable-tests=true --warnlevel=3 --werror' + flags: '-Denable-pywrapper=true -Denable-coolprop=true -Denable-tests=true --warnlevel=2 --werror' - config_set: ReverseMPI flags: '-Denable-autodiff=true -Denable-normal=false -Denable-pywrapper=true -Denable-tests=true --warnlevel=3 --werror' - config_set: ForwardMPI @@ -52,12 +52,12 @@ jobs: key: ${{ matrix.config_set }}-${{ github.sha }} restore-keys: ${{ matrix.config_set }} - name: Pre Cleanup - uses: docker://ghcr.io/su2code/su2/build-su2:220614-1237 + uses: docker://ghcr.io/su2code/su2/build-su2:221027-0442 with: entrypoint: /bin/rm args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }} - name: Build - uses: docker://ghcr.io/su2code/su2/build-su2:220614-1237 + uses: docker://ghcr.io/su2code/su2/build-su2:221027-0442 with: args: -b ${{github.ref}} -f "${{matrix.flags}}" - name: Compress binaries @@ -68,7 +68,7 @@ jobs: name: ${{ matrix.config_set }} path: install_bin.tgz - name: Post Cleanup - uses: docker://ghcr.io/su2code/su2/build-su2:220614-1237 + uses: docker://ghcr.io/su2code/su2/build-su2:221027-0442 with: entrypoint: /bin/rm args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }} diff --git a/.gitmodules b/.gitmodules index 066d68e15e67..c7e70424d907 100644 --- a/.gitmodules +++ b/.gitmodules @@ -14,7 +14,10 @@ url = https://github.com/mesonbuild/meson [submodule "subprojects/Mutationpp"] path = subprojects/Mutationpp - url = https://github.com/mutationpp/Mutationpp.git + url = https://github.com/mutationpp/Mutationpp.git +[submodule "subprojects/CoolProp"] + path = subprojects/CoolProp + url = https://github.com/CoolProp/CoolProp.git [submodule "externals/opdi"] path = externals/opdi url = https://github.com/SciCompKL/OpDiLib diff --git a/AUTHORS.md b/AUTHORS.md index dc4a605a7bf6..53a02f26eb33 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -109,6 +109,7 @@ Patrick Mischke Paul Urbanczyk Paul Zhang Pedro Gomes +Peng Yan Pete Bachant RaulFeijo55 Ruben Sanchez diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index e98de01e354d..4fcfea1531d6 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -80,6 +80,7 @@ class CConfig { su2double EA_ScaleFactor; /*!< \brief Equivalent Area scaling factor */ su2double AdjointLimit; /*!< \brief Adjoint variable limit */ string* ConvField; /*!< \brief Field used for convergence check.*/ + string FluidName; /*!< \brief name of the applied fluid. */ string* WndConvField; /*!< \brief Function where to apply the windowed convergence criteria for the time average of the unsteady (single zone) flow problem. */ unsigned short nConvField; /*!< \brief Number of fields used to monitor convergence.*/ @@ -3752,6 +3753,11 @@ class CConfig { */ unsigned short GetKind_FluidModel(void) const { return Kind_FluidModel; } + /*! + * \brief Returns the name of the fluid we are using in CoolProp. + */ + string GetFluid_Name(void) const { return FluidName; } + /*! * \brief Option to define the density model for incompressible flows. * \return Density model option diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 65c145004276..89aaf0308a72 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -569,6 +569,7 @@ enum ENUM_FLUIDMODEL { MUTATIONPP = 7, /*!< \brief Mutation++ gas model for nonequilibrium flow. */ SU2_NONEQ = 8, /*!< \brief User defined gas model for nonequilibrium flow. */ FLUID_MIXTURE = 9, /*!< \brief Species mixture model. */ + COOLPROP = 10, /*!< \brief Thermodynamics library. */ }; static const MapType FluidModel_Map = { MakePair("STANDARD_AIR", STANDARD_AIR) @@ -581,6 +582,7 @@ static const MapType FluidModel_Map = { MakePair("MUTATIONPP", MUTATIONPP) MakePair("SU2_NONEQ", SU2_NONEQ) MakePair("FLUID_MIXTURE", FLUID_MIXTURE) + MakePair("COOLPROP", COOLPROP) }; /*! diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index faa3c39f533f..1538fe221734 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -1150,6 +1150,8 @@ void CConfig::SetConfig_Options() { /*!\par CONFIG_CATEGORY: FluidModel \ingroup Config*/ /*!\brief FLUID_MODEL \n DESCRIPTION: Fluid model \n OPTIONS: See \link FluidModel_Map \endlink \n DEFAULT: STANDARD_AIR \ingroup Config*/ addEnumOption("FLUID_MODEL", Kind_FluidModel, FluidModel_Map, STANDARD_AIR); + /*!\brief FLUID_NAME \n DESCRIPTION: Fluid name \n OPTIONS: see coolprop homepage \n DEFAULT: nitrogen \ingroup Config*/ + addStringOption("FLUID_NAME", FluidName, string("nitrogen")); /*!\par CONFIG_CATEGORY: Freestream Conditions \ingroup Config*/ @@ -3383,6 +3385,11 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i } #endif + /*--- Check if CoolProp is used with non-dimensionalization. ---*/ + if (Kind_FluidModel == COOLPROP && Ref_NonDim != DIMENSIONAL) { + SU2_MPI::Error("CoolProp can not be used with non-dimensionalization.", CURRENT_FUNCTION); + } + /*--- STL_BINARY output not implemented yet, but already a value in option_structure.hpp---*/ for (unsigned short iVolumeFile = 0; iVolumeFile < nVolumeOutputFiles; iVolumeFile++) { if (VolumeOutputFiles[iVolumeFile] == OUTPUT_TYPE::STL_BINARY){ diff --git a/SU2_CFD/include/fluid/CCoolProp.hpp b/SU2_CFD/include/fluid/CCoolProp.hpp new file mode 100644 index 000000000000..97056d220ffb --- /dev/null +++ b/SU2_CFD/include/fluid/CCoolProp.hpp @@ -0,0 +1,148 @@ +/*! + * \file CCoolProp.hpp + * \brief Defines the state-of-the-art fluid model from CoolProp library. + * \author P. Yan, G. Gori, A. Guardone + * \version 7.4.0 "Blackbird" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2022, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#pragma once +#include "CFluidModel.hpp" +#if defined(HAVE_COOLPROP) && !defined(CODI_FORWARD_TYPE) && !defined(CODI_REVERSE_TYPE) +#define USE_COOLPROP +namespace CoolProp { + class AbstractState; +} +#endif +#include + + +/*! + * \class CCoolProp + * \brief Child class for defining fluid model from CoolProp library. + * \author: P.Yan + */ +class CCoolProp final : public CFluidModel { + private: + su2double Gamma{1.4}; /*!< \brief Ratio of Specific Heats. */ + su2double Gas_Constant{297}; /*!< \brief specific Gas Constant. */ + su2double Pressure_Critical{0.0}; /*!< \brief critical pressure */ + su2double Temperature_Critical{0.0}; /*!< \brief critical temperature */ + su2double acentric_factor{0.0}; /*!< \brief acentric factor */ +#ifdef USE_COOLPROP + std::unique_ptr fluid_entity; /*!< \brief fluid entity */ +#endif + + public: + /*! + * \brief Constructor of the class. + */ + CCoolProp(string fluidname); + +#ifdef USE_COOLPROP + /*! + * \brief Destructor of the class. + * \note Needs to be defined in the .cpp to allow using only a forward declaration of CoolProp::AbstractState. + */ + ~CCoolProp(); + + /*! + * \brief Set the Dimensionless State using Density and Internal Energy + * \param[in] rho - first thermodynamic variable. + * \param[in] e - second thermodynamic variable. + */ + void SetTDState_rhoe(su2double rho, su2double e) override; + + /*! + * \brief Set the Dimensionless State using Pressure and Temperature + * \param[in] P - first thermodynamic variable. + * \param[in] T - second thermodynamic variable. + */ + void SetTDState_PT(su2double P, su2double T) override; + + /*! + * \brief Set the Dimensionless State using Pressure and Density + * \param[in] P - first thermodynamic variable. + * \param[in] rho - second thermodynamic variable. + */ + void SetTDState_Prho(su2double P, su2double rho) override; + + /*! + * \brief Set the Dimensionless Internal Energy using Pressure and Density + * \param[in] P - first thermodynamic variable. + * \param[in] rho - second thermodynamic variable. + */ + void SetEnergy_Prho(su2double P, su2double rho) override; + + /*! + * \brief Set the Dimensionless State using Enthalpy and Entropy + * \param[in] th1 - first thermodynamic variable (h). + * \param[in] th2 - second thermodynamic variable (s). + */ + void SetTDState_hs(su2double h, su2double s) override; + + /*! + * \brief Set the Dimensionless State using Density and Temperature + * \param[in] th1 - first thermodynamic variable (rho). + * \param[in] th2 - second thermodynamic variable (T). + */ + void SetTDState_rhoT(su2double rho, su2double T) override; + + /*! + * \brief Set the Dimensionless State using Pressure and Entropy + * \param[in] th1 - first thermodynamic variable (P). + * \param[in] th2 - second thermodynamic variable (s). + */ + void SetTDState_Ps(su2double P, su2double s) override; + + /*! + * \brief compute some derivatives of enthalpy and entropy needed for subsonic inflow BC + * \param[in] th1 - first thermodynamic variable (P). + * \param[in] th2 - second thermodynamic variable (rho). + */ + void ComputeDerivativeNRBC_Prho(su2double P, su2double rho) override; +#endif + + /*! + * \brief Get the value of the critical pressure. + * \return Critical pressure. + */ + su2double GetPressure_Critical(void) const { return Pressure_Critical; } + + /*! + * \brief Get the value of the critical temperature. + * \return Critical temperature. + */ + su2double GetTemperature_Critical(void) const { return Temperature_Critical; } + + /*! + * \brief Get the value of specific gas constant. + * \return Value of the constant: Gamma + */ + su2double GetGas_Constant(void) const { return Gas_Constant; } + + /*! + * \brief Get the value of specific gas constant. + * \return Value of the constant: Gamma + */ + su2double GetGamma(void) const { return Gamma; } +}; diff --git a/SU2_CFD/obj/Makefile.am b/SU2_CFD/obj/Makefile.am index 8d1e64e48cd7..ac68053fce6f 100644 --- a/SU2_CFD/obj/Makefile.am +++ b/SU2_CFD/obj/Makefile.am @@ -54,6 +54,7 @@ libSU2Core_sources = ../src/definition_structure.cpp \ ../src/fluid/CFluidScalar.cpp \ ../src/fluid/CPengRobinson.cpp \ ../src/fluid/CVanDerWaalsGas.cpp \ + ../src/fluid/CCoolProp.cpp \ ../src/fluid/CNEMOGas.cpp \ ../src/fluid/CSU2TCLib.cpp \ ../src/fluid/CMutationTCLib.cpp \ @@ -246,6 +247,11 @@ su2_cfd_cxx_flags += @MUTATIONPP_CXX@ su2_cfd_ldadd += @MUTATIONPP_LD@ # endif + +su2_cfd_cxx_flags += @CoolProp_CXX@ +su2_cfd_ldadd += @CoolProp_LD@ + + if BUILD_NORMAL libSU2Core_a_SOURCES = $(libSU2Core_sources) libSU2Core_a_CXXFLAGS = $(libSU2Core_cxx_flags) diff --git a/SU2_CFD/src/fluid/CCoolProp.cpp b/SU2_CFD/src/fluid/CCoolProp.cpp new file mode 100644 index 000000000000..61dfb5840cb4 --- /dev/null +++ b/SU2_CFD/src/fluid/CCoolProp.cpp @@ -0,0 +1,119 @@ +/*! + * \file CCoolProp.cpp + * \brief Source of the fluid model from CoolProp. + * \author P. Yan, G. Gori, A. Guardone + * \version 7.4.0 "Blackbird" + * + * SU2 Project Website: https://su2code.github.io + * + * The SU2 Project is maintained by the SU2 Foundation + * (http://su2foundation.org) + * + * Copyright 2012-2022, SU2 Contributors (cf. AUTHORS.md) + * + * SU2 is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * SU2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with SU2. If not, see . + */ + +#include "../../include/fluid/CCoolProp.hpp" + +#ifdef USE_COOLPROP +#include "CoolProp.h" +#include "AbstractState.h" + +CCoolProp::CCoolProp(string fluidname) : CFluidModel() { + fluid_entity = std::unique_ptr(CoolProp::AbstractState::factory("HEOS",fluidname)); + Gas_Constant = fluid_entity->gas_constant()/fluid_entity->molar_mass(); + Pressure_Critical = fluid_entity->p_critical(); + Temperature_Critical = fluid_entity->T_critical(); + acentric_factor = fluid_entity->acentric_factor(); +} + +CCoolProp::~CCoolProp() {} + +void CCoolProp::SetTDState_rhoe(su2double rho, su2double e) { + //cout<<"p "<update(CoolProp::DmassUmass_INPUTS, Density, StaticEnergy); + Cp = fluid_entity->cpmass(); + Cv = fluid_entity->cvmass(); + Gamma = Cp / Cv; + Pressure = fluid_entity->p(); + Temperature = fluid_entity->T(); + Entropy = fluid_entity->smass(); + dPdrho_e = fluid_entity->first_partial_deriv(CoolProp::iP, CoolProp::iDmass, CoolProp::iUmass); + dPde_rho = fluid_entity->first_partial_deriv(CoolProp::iP, CoolProp::iUmass, CoolProp::iDmass); + dTdrho_e = fluid_entity->first_partial_deriv(CoolProp::iT, CoolProp::iDmass, CoolProp::iUmass); + dTde_rho = fluid_entity->first_partial_deriv(CoolProp::iT, CoolProp::iUmass, CoolProp::iDmass); + if (fluid_entity->phase() == 6) { + fluid_entity->specify_phase(CoolProp::iphase_gas); + SetTDState_PT(Pressure,Temperature); + } + else{ + SoundSpeed2 = pow(fluid_entity->speed_sound(), 2); + } +} + +void CCoolProp::SetTDState_PT(su2double P, su2double T) { + fluid_entity->update(CoolProp::PT_INPUTS, P, T); + su2double rho = fluid_entity->rhomass(); + su2double e = fluid_entity->umass(); + SetTDState_rhoe(rho, e); +} + +void CCoolProp::SetTDState_Prho(su2double P, su2double rho) { + fluid_entity->update(CoolProp::DmassP_INPUTS, rho, P); + su2double e = fluid_entity->umass(); + SetTDState_rhoe(rho, e); +} + +void CCoolProp::SetEnergy_Prho(su2double P, su2double rho) { + fluid_entity->update(CoolProp::DmassP_INPUTS, rho, P); + StaticEnergy = fluid_entity->umass(); +} + +void CCoolProp::SetTDState_hs(su2double h, su2double s) { + fluid_entity->update(CoolProp::HmassSmass_INPUTS, h, s); + su2double rho = fluid_entity->rhomass(); + su2double e = fluid_entity->umass(); + SetTDState_rhoe(rho, e); +} + +void CCoolProp::SetTDState_Ps(su2double P, su2double s) { + fluid_entity->update(CoolProp::PSmass_INPUTS, P, s); + su2double Rho = fluid_entity->rhomass(); + su2double e = fluid_entity->umass(); + SetTDState_rhoe(Rho, e); +} + +void CCoolProp::SetTDState_rhoT(su2double rho, su2double T) { + fluid_entity->update(CoolProp::DmassT_INPUTS, rho, T); + su2double Rho = fluid_entity->rhomass(); + su2double e = fluid_entity->umass(); + SetTDState_rhoe(Rho, e); +} + +void CCoolProp::ComputeDerivativeNRBC_Prho(su2double P, su2double rho) { + SetTDState_Prho(P, rho); + dhdrho_P = fluid_entity->first_partial_deriv(CoolProp::iHmass,CoolProp::iDmass,CoolProp::iP); + dhdP_rho = fluid_entity->first_partial_deriv(CoolProp::iHmass,CoolProp::iP,CoolProp::iDmass); + dsdP_rho = fluid_entity->first_partial_deriv(CoolProp::iSmass,CoolProp::iP,CoolProp::iDmass); + dsdrho_P = fluid_entity->first_partial_deriv(CoolProp::iSmass,CoolProp::iDmass,CoolProp::iP); +} + +#else +CCoolProp::CCoolProp(string fluidname) { + SU2_MPI::Error("SU2 was not compiled with CoolProp (-Denable-coolprop=true). Note that CoolProp cannot be used with directdiff or autodiff", CURRENT_FUNCTION); +} +#endif \ No newline at end of file diff --git a/SU2_CFD/src/meson.build b/SU2_CFD/src/meson.build index 4391b769305c..d7c7d156c411 100644 --- a/SU2_CFD/src/meson.build +++ b/SU2_CFD/src/meson.build @@ -8,6 +8,7 @@ su2_cfd_src += files(['fluid/CFluidModel.cpp', 'fluid/CFluidScalar.cpp', 'fluid/CPengRobinson.cpp', 'fluid/CVanDerWaalsGas.cpp', + 'fluid/CCoolProp.cpp', 'fluid/CNEMOGas.cpp', 'fluid/CMutationTCLib.cpp', 'fluid/CSU2TCLib.cpp']) diff --git a/SU2_CFD/src/output/CFlowOutput.cpp b/SU2_CFD/src/output/CFlowOutput.cpp index c59e54db7a6a..6a081f929a2a 100644 --- a/SU2_CFD/src/output/CFlowOutput.cpp +++ b/SU2_CFD/src/output/CFlowOutput.cpp @@ -35,6 +35,7 @@ #include "../../include/variables/CEulerVariable.hpp" #include "../../include/variables/CIncEulerVariable.hpp" #include "../../include/variables/CNEMOEulerVariable.hpp" +#include "../../include/fluid/CCoolProp.hpp" CFlowOutput::CFlowOutput(const CConfig *config, unsigned short nDim, bool fem_output) : CFVMOutput(config, nDim, fem_output), @@ -2375,6 +2376,20 @@ void CFlowOutput::WriteForcesBreakdown(const CConfig* config, const CSolver* flo file << "Critical Temperature (non-dim) : " << config->GetTemperature_Critical() / config->GetTemperature_Ref() << "\n"; break; + + case COOLPROP: { + CCoolProp auxFluidModel(config->GetFluid_Name()); + file << "Fluid Model: CoolProp library \n"; + file << "Specific gas constant: " << auxFluidModel.GetGas_Constant()<< " N.m/kg.K.\n"; + file << "Specific gas constant(non-dim): " << config->GetGas_ConstantND() << "\n"; + file << "Specific Heat Ratio: "<< auxFluidModel.GetGamma() << "\n"; + file << "Critical Pressure: " << auxFluidModel.GetPressure_Critical() << " Pa.\n"; + file << "Critical Temperature: " << auxFluidModel.GetTemperature_Critical()<< " K.\n"; + file << "Critical Pressure (non-dim): " << auxFluidModel.GetPressure_Critical()/ config->GetPressure_Ref() + << "\n"; + file << "Critical Temperature (non-dim) : " + << auxFluidModel.GetTemperature_Critical() / config->GetTemperature_Ref() << "\n"; + } break; } if (viscous) { diff --git a/SU2_CFD/src/output/output_structure_legacy.cpp b/SU2_CFD/src/output/output_structure_legacy.cpp index 1cdf5301a00b..c87c90020d58 100644 --- a/SU2_CFD/src/output/output_structure_legacy.cpp +++ b/SU2_CFD/src/output/output_structure_legacy.cpp @@ -30,6 +30,7 @@ #include "../../../Common/include/geometry/CGeometry.hpp" #include "../../include/solvers/CBaselineSolver.hpp" +#include "../../include/fluid/CCoolProp.hpp" COutputLegacy::COutputLegacy(CConfig *config) { @@ -2935,6 +2936,17 @@ void COutputLegacy::SpecialOutput_ForcesBreakdown(CSolver *****solver, CGeometry Breakdown_file << "Critical Pressure (non-dim): " << config[val_iZone]->GetPressure_Critical() /config[val_iZone]->GetPressure_Ref() << "\n"; Breakdown_file << "Critical Temperature (non-dim) : " << config[val_iZone]->GetTemperature_Critical() /config[val_iZone]->GetTemperature_Ref() << "\n"; break; + case COOLPROP: { + CCoolProp auxFluidModel(config[val_iZone]->GetFluid_Name()); + Breakdown_file << "Fluid Model: CoolProp library \n"; + Breakdown_file << "Specific gas constant: " << auxFluidModel.GetGas_Constant()<< " N.m/kg.K.\n"; + Breakdown_file << "Specific gas constant(non-dim): " << config[val_iZone]->GetGas_ConstantND() << "\n"; + Breakdown_file << "Specific Heat Ratio: " << auxFluidModel.GetGamma() << "\n"; + Breakdown_file << "Critical Pressure: " << auxFluidModel.GetPressure_Critical() << " Pa.\n"; + Breakdown_file << "Critical Temperature: " << auxFluidModel.GetTemperature_Critical()<< " K.\n"; + Breakdown_file << "Critical Pressure (non-dim): " << auxFluidModel.GetPressure_Critical()/ config[val_iZone]->GetPressure_Ref()<< "\n"; + Breakdown_file << "Critical Temperature (non-dim) : " << auxFluidModel.GetTemperature_Critical() / config[val_iZone]->GetTemperature_Ref() << "\n"; + } break; } if (viscous) { diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index 9b6129551842..5d760231b08f 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -32,6 +32,7 @@ #include "../../include/fluid/CIdealGas.hpp" #include "../../include/fluid/CVanDerWaalsGas.hpp" #include "../../include/fluid/CPengRobinson.hpp" +#include "../../include/fluid/CCoolProp.hpp" #include "../../include/numerics_simd/CNumericsSIMD.hpp" #include "../../include/limiters/CLimiterDetails.hpp" @@ -857,6 +858,10 @@ void CEulerSolver::SetNondimensionalization(CConfig *config, unsigned short iMes auxFluidModel = new CPengRobinson(Gamma, config->GetGas_Constant(), config->GetPressure_Critical(), config->GetTemperature_Critical(), config->GetAcentric_Factor()); break; + case COOLPROP: + + auxFluidModel = new CCoolProp(config->GetFluid_Name()); + break; default: SU2_MPI::Error("Unknown fluid model.", CURRENT_FUNCTION); @@ -1084,6 +1089,10 @@ void CEulerSolver::SetNondimensionalization(CConfig *config, unsigned short iMes config->GetTemperature_Critical() / config->GetTemperature_Ref(), config->GetAcentric_Factor()); break; + + case COOLPROP: + FluidModel[thread] = new CCoolProp(config->GetFluid_Name()); + break; } GetFluidModel()->SetEnergy_Prho(Pressure_FreeStreamND, Density_FreeStreamND); @@ -1210,11 +1219,22 @@ void CEulerSolver::SetNondimensionalization(CConfig *config, unsigned short iMes if (config->GetSystemMeasurements() == SI) Unit << "N.m/kg.K"; else if (config->GetSystemMeasurements() == US) Unit << "lbf.ft/slug.R"; - NonDimTable << "Gas Constant" << config->GetGas_Constant() << config->GetGas_Constant_Ref() << Unit.str() << config->GetGas_ConstantND(); + if (config->GetKind_FluidModel() == COOLPROP) { + CCoolProp auxFluidModel(config->GetFluid_Name()); + NonDimTable << "Gas Constant" << auxFluidModel.GetGas_Constant() << config->GetGas_Constant_Ref() << Unit.str() << auxFluidModel.GetGas_Constant()/config->GetGas_Constant_Ref(); + } + else { + NonDimTable << "Gas Constant" << config->GetGas_Constant() << config->GetGas_Constant_Ref() << Unit.str() << config->GetGas_ConstantND(); + } Unit.str(""); if (config->GetSystemMeasurements() == SI) Unit << "N.m/kg.K"; else if (config->GetSystemMeasurements() == US) Unit << "lbf.ft/slug.R"; - NonDimTable << "Spec. Heat Ratio" << "-" << "-" << "-" << Gamma; + if (config->GetKind_FluidModel() == COOLPROP) { + NonDimTable << "Spec. Heat Ratio" << "-" << "-" << "-" << "-"; + } + else { + NonDimTable << "Spec. Heat Ratio" << "-" << "-" << "-" << Gamma; + } Unit.str(""); switch(config->GetKind_FluidModel()){ @@ -1230,6 +1250,9 @@ void CEulerSolver::SetNondimensionalization(CConfig *config, unsigned short iMes case PR_GAS: ModelTable << "PR_GAS"; break; + case COOLPROP: + ModelTable << "CoolProp library"; + break; } if (config->GetKind_FluidModel() == VW_GAS || config->GetKind_FluidModel() == PR_GAS){ @@ -1239,6 +1262,14 @@ void CEulerSolver::SetNondimensionalization(CConfig *config, unsigned short iMes NonDimTable << "Critical Temperature" << config->GetTemperature_Critical() << config->GetTemperature_Ref() << Unit.str() << config->GetTemperature_Critical() /config->GetTemperature_Ref(); Unit.str(""); } + if (config->GetKind_FluidModel() == COOLPROP) { + CCoolProp auxFluidModel(config->GetFluid_Name()); + NonDimTable << "Critical Pressure" << auxFluidModel.GetPressure_Critical() << config->GetPressure_Ref() << Unit.str() << auxFluidModel.GetPressure_Critical() /config->GetPressure_Ref(); + Unit.str(""); + Unit << "K"; + NonDimTable << "Critical Temperature" << auxFluidModel.GetTemperature_Critical() << config->GetTemperature_Ref() << Unit.str() << auxFluidModel.GetTemperature_Critical() /config->GetTemperature_Ref(); + Unit.str(""); + } NonDimTable.PrintFooter(); NonDimTableOut <<"-- Initial and free-stream conditions:"<< endl; diff --git a/SU2_CFD/src/solvers/CFEM_DG_EulerSolver.cpp b/SU2_CFD/src/solvers/CFEM_DG_EulerSolver.cpp index 8ab4d1dccfb0..167a7f449394 100644 --- a/SU2_CFD/src/solvers/CFEM_DG_EulerSolver.cpp +++ b/SU2_CFD/src/solvers/CFEM_DG_EulerSolver.cpp @@ -31,6 +31,7 @@ #include "../../include/fluid/CIdealGas.hpp" #include "../../include/fluid/CVanDerWaalsGas.hpp" #include "../../include/fluid/CPengRobinson.hpp" +#include "../../include/fluid/CCoolProp.hpp" #define SIZE_ARR_NORM 8 @@ -879,6 +880,21 @@ void CFEM_DG_EulerSolver::SetNondimensionalization(CConfig *config, } break; + case COOLPROP: + + FluidModel = new CCoolProp(config->GetFluid_Name()); + if (free_stream_temp) { + FluidModel->SetTDState_PT(Pressure_FreeStream, Temperature_FreeStream); + Density_FreeStream = FluidModel->GetDensity(); + config->SetDensity_FreeStream(Density_FreeStream); + } + else { + FluidModel->SetTDState_Prho(Pressure_FreeStream, Density_FreeStream ); + Temperature_FreeStream = FluidModel->GetTemperature(); + config->SetTemperature_FreeStream(Temperature_FreeStream); + } + break; + } Mach2Vel_FreeStream = FluidModel->GetSoundSpeed(); @@ -1063,6 +1079,10 @@ void CFEM_DG_EulerSolver::SetNondimensionalization(CConfig *config, FluidModel->SetEnergy_Prho(Pressure_FreeStreamND, Density_FreeStreamND); break; + case COOLPROP: + FluidModel = new CCoolProp(config->GetFluid_Name()); + FluidModel->SetEnergy_Prho(Pressure_FreeStreamND, Density_FreeStreamND); + break; } Energy_FreeStreamND = FluidModel->GetStaticEnergy() + 0.5*ModVel_FreeStreamND*ModVel_FreeStreamND; @@ -1183,11 +1203,23 @@ void CFEM_DG_EulerSolver::SetNondimensionalization(CConfig *config, if (config->GetSystemMeasurements() == SI) Unit << "N.m/kg.K"; else if (config->GetSystemMeasurements() == US) Unit << "lbf.ft/slug.R"; - NonDimTable << "Gas Constant" << config->GetGas_Constant() << config->GetGas_Constant_Ref() << Unit.str() << config->GetGas_ConstantND(); + if (config->GetKind_FluidModel() == COOLPROP) { + CCoolProp auxFluidModel(config->GetFluid_Name()); + NonDimTable << "Gas Constant" << auxFluidModel.GetGas_Constant() << config->GetGas_Constant_Ref() + << Unit.str() << auxFluidModel.GetGas_Constant()/config->GetGas_Constant_Ref(); + } + else { + NonDimTable << "Gas Constant" << config->GetGas_Constant() << config->GetGas_Constant_Ref() << Unit.str() << config->GetGas_ConstantND(); + } Unit.str(""); if (config->GetSystemMeasurements() == SI) Unit << "N.m/kg.K"; else if (config->GetSystemMeasurements() == US) Unit << "lbf.ft/slug.R"; - NonDimTable << "Spec. Heat Ratio" << "-" << "-" << "-" << Gamma; + if (config->GetKind_FluidModel() == COOLPROP) { + NonDimTable << "Spec. Heat Ratio" << "-" << "-" << "-" << "-"; + } + else { + NonDimTable << "Spec. Heat Ratio" << "-" << "-" << "-" << Gamma; + } Unit.str(""); switch(config->GetKind_FluidModel()){ @@ -1203,6 +1235,9 @@ void CFEM_DG_EulerSolver::SetNondimensionalization(CConfig *config, case PR_GAS: ModelTable << "PR_GAS"; break; + case COOLPROP: + ModelTable << "CoolProp library"; + break; } if (config->GetKind_FluidModel() == VW_GAS || config->GetKind_FluidModel() == PR_GAS){ @@ -1212,6 +1247,14 @@ void CFEM_DG_EulerSolver::SetNondimensionalization(CConfig *config, NonDimTable << "Critical Temperature" << config->GetTemperature_Critical() << config->GetTemperature_Ref() << Unit.str() << config->GetTemperature_Critical() /config->GetTemperature_Ref(); Unit.str(""); } + if (config->GetKind_FluidModel() == COOLPROP) { + CCoolProp auxFluidModel(config->GetFluid_Name()); + NonDimTable << "Critical Pressure" << auxFluidModel.GetPressure_Critical() << config->GetPressure_Ref() << Unit.str() << auxFluidModel.GetPressure_Critical() /config->GetPressure_Ref(); + Unit.str(""); + Unit << "K"; + NonDimTable << "Critical Temperature" << auxFluidModel.GetTemperature_Critical() << config->GetTemperature_Ref() << Unit.str() << auxFluidModel.GetTemperature_Critical() /config->GetTemperature_Ref(); + Unit.str(""); + } NonDimTable.PrintFooter(); NonDimTableOut <<"-- Initial and free-stream conditions:"<< endl; diff --git a/TestCases/nicf/coolprop/coolprop_nozzle.cfg b/TestCases/nicf/coolprop/coolprop_nozzle.cfg new file mode 100644 index 000000000000..7a3f6a1ac24a --- /dev/null +++ b/TestCases/nicf/coolprop/coolprop_nozzle.cfg @@ -0,0 +1,123 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Non-ideal compressible fluid flow in a converging- % +% diverging supersonic nozzle with CoolProp library % +% Author: Peng Yan, Alberto Guardone % +% Institution: Politecnico di Milano % +% Date: 2022.10.8 % +% File Version 7.4.0 Blackbird % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +SOLVER= RANS +KIND_TURB_MODEL= SST +MATH_PROBLEM= DIRECT +RESTART_SOL= YES +SYSTEM_MEASUREMENTS= SI +% +% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% +% +% Mach number (non-dimensional, based on the free-stream values) +MACH_NUMBER= 1E-9 +AOA= 0.0 +SIDESLIP_ANGLE= 0.0 +INIT_OPTION= TD_CONDITIONS +FREESTREAM_OPTION= TEMPERATURE_FS +FREESTREAM_PRESSURE= 904388 +% +% Free-stream temperature (288.15 K, 518.67 R by default) +FREESTREAM_TEMPERATURE= 542.13 +REF_DIMENSIONALIZATION= DIMENSIONAL + +% ---- IDEAL GAS, POLYTROPIC, VAN DER WAALS AND PENG ROBINSON CONSTANTS -------% +% +FLUID_MODEL = COOLPROP +FLUID_NAME = nitrogen +% --------------------------- VISCOSITY MODEL ---------------------------------% +VISCOSITY_MODEL= CONSTANT_VISCOSITY +MU_CONSTANT= 1.21409E-05 + +% --------------------------- THERMAL CONDUCTIVITY MODEL ----------------------% +CONDUCTIVITY_MODEL= CONSTANT_CONDUCTIVITY +THERMAL_CONDUCTIVITY_CONSTANT= 0.030542828 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +MARKER_HEATFLUX= ( WALL, 0.0 ) +MARKER_SYM= ( SYMMETRY ) +MARKER_RIEMANN= ( INFLOW, TOTAL_CONDITIONS_PT, 904388, 542.13, 1.0, 0.0, 0.0, OUTFLOW, STATIC_PRESSURE, 200000.0, 0.0, 0.0, 0.0, 0.0 ) + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 10.0 +CFL_ADAPT= YES +CFL_ADAPT_PARAM= ( 0.1, 2.0, 10.0, 1000.0 ) +MAX_DELTA_TIME= 1E6 + +% ----------- SLOPE LIMITER AND DISSIPATION SENSOR DEFINITION -----------------% +MUSCL_FLOW= YES +SLOPE_LIMITER_FLOW= NONE +MUSCL_TURB= NO + +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ILU_FILL_IN= 0 +LINEAR_SOLVER_ERROR= 1E-6 +LINEAR_SOLVER_ITER= 10 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% +% +% Multi-grid levels (0 = no multi-grid) +MGLEVEL= 0 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +CONV_NUM_METHOD_FLOW= ROE +ENTROPY_FIX_COEFF= 0.1 +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +TIME_DISCRE_TURB= EULER_IMPLICIT +CFL_REDUCTION_TURB= 1.0 + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +% Number of total iterations +ITER= 101 +CONV_RESIDUAL_MINVAL= -24 +CONV_STARTITER= 10 + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +% Mesh input file +MESH_FILENAME= coolprop_nozzle.su2 +% +% Mesh input file format (SU2, CGNS) +MESH_FORMAT= SU2 +% +% Mesh output file +MESH_OUT_FILENAME= mesh_out.su2 +% +% Restart flow input file +SOLUTION_FILENAME= solution_flow.dat +TABULAR_FORMAT= CSV +% +% Output file convergence history (w/o extension) +CONV_FILENAME= history +% +% Output file restart flow +RESTART_FILENAME= restart_flow.dat +% +% Output file flow (w/o extension) variables +VOLUME_FILENAME= flow +% +% Output file surface flow coefficient (w/o extension) +SURFACE_FILENAME= surface_flow +% +% Writing solution file frequency +OUTPUT_WRT_FREQ= 50 +% +% Screen output +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_TKE, RMS_DISSIPATION, LIFT, DRAG) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 87b77b8e87db..233dd4fbb5a7 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -914,6 +914,14 @@ def main(): edge_PPR.test_vals = [-5.400790, 0.739723, -0.000035, 0.000000] test_list.append(edge_PPR) + # Rarefaction Q1D nozzle coolprop_nozzle + coolprop_nozzle = TestCase('coolprop_nozzle') + coolprop_nozzle.cfg_dir = "nicf/coolprop" + coolprop_nozzle.cfg_file = "coolprop_nozzle.cfg" + coolprop_nozzle.test_iter = 10 + coolprop_nozzle.test_vals = [-4.692515, -3.779318, 3.419183, 0.000000, 0.000000] + test_list.append(coolprop_nozzle) + ###################################### ### Turbomachinery ### ###################################### diff --git a/config_template.cfg b/config_template.cfg index 9ade86860f8b..57835eccf687 100644 --- a/config_template.cfg +++ b/config_template.cfg @@ -312,12 +312,14 @@ REF_AREA= 1.0 % Aircraft semi-span (0 implies automatic calculation) (m or in) SEMI_SPAN= 0.0 -% ---- NONEQUILIBRIUM GAS, IDEAL GAS, POLYTROPIC, VAN DER WAALS AND PENG ROBINSON CONSTANTS -------% +% ---- NONEQUILIBRIUM GAS, IDEAL GAS, POLYTROPIC, VAN DER WAALS AND PENG ROBINSON CONSTANTS, CoolProp library -------% % % Fluid model (STANDARD_AIR, IDEAL_GAS, VW_GAS, PR_GAS, -% CONSTANT_DENSITY, INC_IDEAL_GAS, INC_IDEAL_GAS_POLY, MUTATIONPP, SU2_NONEQ, FLUID_MIXTURE) +% CONSTANT_DENSITY, INC_IDEAL_GAS, INC_IDEAL_GAS_POLY, MUTATIONPP, SU2_NONEQ, FLUID_MIXTURE, COOLPROP) FLUID_MODEL= STANDARD_AIR -% +% To find all available fluid name for CoolProp library, clikc the following link: +% http://www.coolprop.org/fluid_properties/PurePseudoPure.html#list-of-fluids +FLUID_NAME = nitrogen % Ratio of specific heats (1.4 default and the value is hardcoded % for the model STANDARD_AIR, compressible only) GAMMA_VALUE= 1.4 diff --git a/meson.build b/meson.build index 199cbecc407b..01655e23bb75 100644 --- a/meson.build +++ b/meson.build @@ -21,7 +21,8 @@ if build_machine.system() != 'windows' if meson.get_compiler('cpp').get_id() != 'intel' default_warning_flags += ['-Wno-empty-body'] endif - desired_warnings = ['-Wno-unused-parameter', + desired_warnings = ['-Wno-ignored-qualifiers', + '-Wno-unused-parameter', '-Wno-deprecated-declarations', '-Wno-error=cast-function-type', '-Wno-cast-function-type', @@ -235,6 +236,22 @@ if get_option('enable-mpp') su2_cpp_args += '-DHAVE_MPP' endif +if get_option('enable-coolprop') + cmake = import('cmake') + cmake_opts = cmake.subproject_options() + cmake_opts.set_override_option('warning_level', '0') + cmake_opts.add_cmake_defines({ + 'COOLPROP_STATIC_LIBRARY': true, + 'CMAKE_MAKE_PROGRAM': meson.source_root() + '/ninja', + 'CMAKE_POSITION_INDEPENDENT_CODE': 'ON' + }) + coolprop_subproj = cmake.subproject('CoolProp', options: cmake_opts) + coolprop_dep = coolprop_subproj.dependency('CoolProp') + su2_deps += coolprop_dep + su2_cpp_args += '-DHAVE_COOLPROP' +endif + + if omp and get_option('enable-autodiff') py = find_program('python3','python') p = run_command(py, 'externals/opdi/syntax/check.py', 'su2omp.syntax.json', 'Common', 'SU2_CFD', '-p', '*.hpp', '*.cpp', '*.inl', '-r', '-q') @@ -284,6 +301,7 @@ message('''--------------------------------------------------------------------- PaStiX: @9@ Mixed Float: @10@ libROM: @11@ + CoolProp: @12@ Please be sure to add the $SU2_HOME and $SU2_RUN environment variables, and update your $PATH (and $PYTHONPATH if applicable) with $SU2_RUN @@ -295,10 +313,10 @@ message('''--------------------------------------------------------------------- export PATH=$PATH:$SU2_RUN export PYTHONPATH=$PYTHONPATH:$SU2_RUN - Use './ninja -C @12@ install' to compile and install SU2 + Use './ninja -C @13@ install' to compile and install SU2 '''.format(get_option('prefix')+'/bin', meson.source_root(), get_option('enable-tecio'), get_option('enable-cgns'), get_option('enable-autodiff'), get_option('enable-directdiff'), get_option('enable-pywrapper'), get_option('enable-mkl'), - get_option('enable-openblas'), get_option('enable-pastix'), get_option('enable-mixedprec'), get_option('enable-librom'), + get_option('enable-openblas'), get_option('enable-pastix'), get_option('enable-mixedprec'), get_option('enable-librom'), get_option('enable-coolprop'), meson.build_root().startswith(meson.source_root()) ? meson.build_root().split('/')[-1] : meson.build_root())) if get_option('enable-mpp') diff --git a/meson_options.txt b/meson_options.txt index 5a4d5d03915b..acb2f627d268 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -18,6 +18,7 @@ option('enable-tests', type : 'boolean', value : false, description: 'compile U option('enable-mixedprec', type : 'boolean', value : false, description: 'use single precision floating point arithmetic for sparse algebra') option('extra-deps', type : 'string', value : '', description: 'comma-separated list of extra (custom) dependencies to add for compilation') option('enable-mpp', type : 'boolean', value : false, description: 'enable Mutation++ support') +option('enable-coolprop', type : 'boolean', value : false, description: 'enable CoolProp support') option('opdi-backend', type : 'combo', choices : ['auto', 'macro', 'ompt'], value : 'auto', description: 'OpDiLib backend choice') option('codi-tape', type : 'combo', choices : ['JacobianLinear', 'JacobianIndex'], value : 'JacobianLinear', description: 'CoDiPack tape choice') option('opdi-shared-read-opt', type : 'boolean', value : true, description : 'OpDiLib shared reading optimization') diff --git a/meson_scripts/init.py b/meson_scripts/init.py index 3326cf113f77..f9d6731b72a7 100755 --- a/meson_scripts/init.py +++ b/meson_scripts/init.py @@ -56,6 +56,8 @@ def init_submodules(method = 'auto'): github_repo_ninja = 'https://github.com/ninja-build/ninja' sha_version_mpp = '5ff579f43781cae07411e5ab46291c9971536be6' github_repo_mpp = 'https://github.com/mutationpp/Mutationpp' + sha_version_coolprop = '0ce42fcf3bb2c373512bc825a4f0c1973a78f307' + github_repo_coolprop = 'https://github.com/CoolProp/CoolProp.git' sha_version_mel = '2484cd3258ef800a10e361016cb341834ee7930b' github_repo_mel = 'https://github.com/pcarruscag/MEL' @@ -65,6 +67,7 @@ def init_submodules(method = 'auto'): meson_name = 'meson' ninja_name= 'ninja' mpp_name= 'Mutationpp' + coolprop_name= 'CoolProp' mel_name = 'MEL' base_path = cur_dir + os.path.sep + 'externals' + os.path.sep alt_name_medi = base_path + 'medi' @@ -74,6 +77,7 @@ def init_submodules(method = 'auto'): alt_name_ninja = base_path + 'ninja' alt_name_mel = base_path + 'mel' alt_name_mpp = cur_dir + os.path.sep + 'subprojects' + os.path.sep + 'Mutationpp' + alt_name_coolprop = cur_dir + os.path.sep + 'subprojects' + os.path.sep + 'CoolProp' if method == 'auto': is_git = is_git_directory(cur_dir) @@ -94,6 +98,7 @@ def init_submodules(method = 'auto'): submodule_status(alt_name_meson, sha_version_meson) submodule_status(alt_name_ninja, sha_version_ninja) submodule_status(alt_name_mpp, sha_version_mpp) + submodule_status(alt_name_coolprop, sha_version_coolprop) submodule_status(alt_name_mel, sha_version_mel) # Otherwise download the zip file from git else: @@ -103,6 +108,7 @@ def init_submodules(method = 'auto'): download_module(meson_name, alt_name_meson, github_repo_meson, sha_version_meson) download_module(ninja_name, alt_name_ninja, github_repo_ninja, sha_version_ninja) download_module(mpp_name, alt_name_mpp, github_repo_mpp, sha_version_mpp) + download_module(coolprop_name, alt_name_coolprop, github_repo_coolprop, sha_version_coolprop) download_module(mel_name, alt_name_mel, github_repo_mel, sha_version_mel) @@ -117,20 +123,16 @@ def is_git_directory(path = '.'): return False return p == 0 - def submodule_status(path, sha_commit): - if not os.path.exists(path + os.path.sep + sha_commit): # Check the status of the submodule status = subprocess.run(['git', 'submodule','status', path], stdout=subprocess.PIPE, check = True, cwd = sys.path[0]).stdout.decode('utf-8') - # The first character of the output indicates the status of the submodule # '+' : The submodule does not match the SHA-1 currently in the index of the repository # '-' : The submodule is not initialized # ' ' : Correct version of submodule is initialized status_indicator = status[0][0] - if status_indicator == '+': # Write a warning that the sha tags do not match sys.stderr.write('WARNING: the currently checked out submodule commit in ' @@ -140,8 +142,22 @@ def submodule_status(path, sha_commit): # Initialize the submodule if necessary print('Initialize submodule ' + path + ' using git ... ') subprocess.run(['git', 'submodule', 'update', '--init', path], check = True, cwd = sys.path[0]) - - # Check that the SHA tag stored in this file matches the one stored in the git index + # to update CoolProp external libraries + if sha_commit == '0ce42fcf3bb2c373512bc825a4f0c1973a78f307': + # update coolprop + original_path = os.getcwd() + print('update CoolProp') + absolute_path = sys.path[0] + relative_path = "subprojects/CoolProp" + full_path = os.path.join(absolute_path, relative_path) + os.chdir(full_path) + print(full_path) + subprocess.run(['git', 'submodule', 'init']) + subprocess.run(['git', 'submodule', 'update']) + print(original_path) + os.chdir(original_path) + print('CoolProp updated') + # Check that the SHA tag stored in this file matches the one stored in the git index cur_sha_commit = status[1:].split(' ')[0] if (cur_sha_commit != sha_commit): print('SHA-1 tag stored in index does not match SHA tag stored in this script.') diff --git a/subprojects/CoolProp b/subprojects/CoolProp new file mode 160000 index 000000000000..0ce42fcf3bb2 --- /dev/null +++ b/subprojects/CoolProp @@ -0,0 +1 @@ +Subproject commit 0ce42fcf3bb2c373512bc825a4f0c1973a78f307