mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-04-23 03:00:17 -04:00
* Add Windows Instructions and example I added how to use the wrapper for Windows through the shared library. There might be a better way using the static library, but I believe this method works for 99% of use cases. * Update Windows setup instructions in Fluent README Clarified and expanded the step-by-step instructions for setting up CoolProp with Fluent on Windows. Added details about launching Fluent, using absolute paths, and using '//' in paths. Improved clarity and fixed minor typos. * Update Windows instructions in Fluent wrapper README Added clarification about limitations of using the shared library method and recommended using a static library for more robust results. Minor formatting and wording improvements were also made to the step-by-step instructions.
51 lines
1.4 KiB
C++
51 lines
1.4 KiB
C++
#include "udf.h"
|
|
#include "CoolPropLib.h"
|
|
#include <string>
|
|
|
|
#pragma comment(lib, "C:\\XX\\XX\\CoolProp.lib")
|
|
|
|
// User settings
|
|
static const std::string FLUID_NAME = "R134a";
|
|
|
|
DEFINE_ON_DEMAND(test)
|
|
{
|
|
double PropResult = PropsSI("T", "P", 101325, "Q", 0, "Water");
|
|
Message0("Saturation temperature of Water at 1 atm = %g K\n", PropResult);
|
|
}
|
|
|
|
// Density via CoolProp
|
|
DEFINE_PROPERTY(rho_coolprop, cell, thread)
|
|
{
|
|
real P = C_P(cell, thread);
|
|
real H = C_H(cell, thread);
|
|
double rho = PropsSI("VISCOSITY",
|
|
"P", static_cast<double>(P),
|
|
"Hmass",static_cast<double>(H),
|
|
FLUID_NAME.c_str());
|
|
return static_cast<real>(rho);
|
|
}
|
|
|
|
// Viscosity via CoolProp
|
|
DEFINE_PROPERTY(mu_coolprop, cell, thread)
|
|
{
|
|
real P = C_P(cell, thread);
|
|
real H = C_H(cell, thread);
|
|
double mu = PropsSI("VISCOSITY",
|
|
"P", static_cast<double>(P),
|
|
"Hmass",static_cast<double>(H),
|
|
FLUID_NAME.c_str());
|
|
return static_cast<real>(mu);
|
|
}
|
|
|
|
// Thermal conductivity via CoolProp
|
|
DEFINE_PROPERTY(k_coolprop, cell, thread)
|
|
{
|
|
real P = C_P(cell, thread);
|
|
real H = C_H(cell, thread);
|
|
double k = PropsSI("CONDUCTIVITY",
|
|
"P", static_cast<double>(P),
|
|
"Hmass",static_cast<double>(H),
|
|
FLUID_NAME.c_str());
|
|
return static_cast<real>(k);
|
|
}
|