Files
CoolProp/wrappers/Fluent/CoolProp_Properties_of_Water.c
Julien Marrec 05c8cf503b Lint: use automated tooling to reformat C++ and CMakeLists files (#2103)
* Add initial clang tidy / clang format config files

* Clang format the entire codebase

```
find ./src -regextype posix-extended -regex '.*\.(cpp|hpp|c|h|cxx|hxx)$' | xargs clang-format-12 -style=file -i -fallback-style=none
find ./include -regextype posix-extended -regex '.*\.(cpp|hpp|c|h|cxx|hxx)$' | xargs clang-format-12 -style=file -i -fallback-style=none
find ./Web -regextype posix-extended -regex '.*\.(cpp|hpp|c|h|cxx|hxx)$' | xargs clang-format-12 -style=file -i -fallback-style=none
find ./dev -regextype posix-extended -regex '.*\.(cpp|hpp|c|h|cxx|hxx)$' | xargs clang-format-12 -style=file -i -fallback-style=none
find ./wrappers -regextype posix-extended -regex '.*\.(cpp|hpp|c|h|cxx|hxx)$' | xargs clang-format-12 -style=file -i -fallback-style=none
```

* Add a .cmake-format file and reformat CmakeLists.txt with it

https://github.com/cheshirekow/cmake_format

* Add a clang-format workflow


only runs on PRs, only on touched files
2022-03-31 10:51:48 -04:00

77 lines
2.9 KiB
C

#include "udf.h"
#include <string.h>
struct string;
const char FLUID[] = "Water";
const real gauge = 101325; /*operating pressure in pascal (as defined in fluent) */
double PropsSI(char*, char*, double, char*, double, char*);
/*Density of the FLUID[]*/
DEFINE_PROPERTY(water_density, c, t) {
real temperature = C_T(c, t);
real pressure = C_P(c, t) + gauge;
real density;
density = PropsSI((char*)"D", (char*)"T", temperature, (char*)"P", pressure, (char*)FLUID);
return density;
}
/*Thermal Conductivity of the FLUID[]*/
DEFINE_PROPERTY(water_thermalConductivity, c, t) {
real thermalConductivity;
real temperature = C_T(c, t);
real pressure = C_P(c, t) + gauge;
thermalConductivity = PropsSI((char*)"L", (char*)"T", temperature, (char*)"P", pressure, (char*)FLUID);
return thermalConductivity;
}
/*Viscosity of the FLUID[]*/
DEFINE_PROPERTY(water_viscosity, c, t) {
real viscosity;
real temperature = C_T(c, t);
real pressure = C_P(c, t) + gauge;
viscosity = PropsSI((char*)"V", (char*)"T", temperature, (char*)"P", pressure, (char*)FLUID);
return viscosity;
}
/*Specific heat of the FLUID[]*/
DEFINE_SPECIFIC_HEAT(water_specificHeat, temperature, Tref, enthalpy, yi) {
real pressure;
/*
density = 1.7730;
*/
/* The following commented code is supposed to get the pressure
from the cell to use with Coolprop. Left commented because
specific heat depends very little on pressure. Will increase
computational time significantly. */
Domain* domain = Get_Domain(1);
Thread* t;
cell_t c;
thread_loop_c(t, domain) {
begin_c_loop(c, t) {
real pressure = C_P(c, t) + gauge;
temperature = C_T(c, t);
real specificHeat;
specificHeat = PropsSI((char*)"C", (char*)"T", temperature, (char*)"P", pressure, (char*)FLUID);
*enthalpy = specificHeat * (temperature - Tref);
return specificHeat;
}
end_c_loop(c, t)
}
}
/* test coolprop integration */
DEFINE_ON_DEMAND(call_coolprop_water) {
real p, t, density, specificHeat, thermalConductivity, enthalpy, viscosity;
p = 101325.0;
t = 298.15;
density = PropsSI((char*)"D", (char*)"T", t, (char*)"P", p, (char*)FLUID);
specificHeat = PropsSI((char*)"C", (char*)"T", t, (char*)"P", p, (char*)FLUID);
viscosity = PropsSI((char*)"V", (char*)"T", t, (char*)"P", p, (char*)FLUID);
thermalConductivity = PropsSI((char*)"L", (char*)"T", t, (char*)"P", p, (char*)FLUID);
enthalpy = PropsSI((char*)"H", (char*)"T", t, (char*)"P", p, (char*)FLUID);
Message("p = %lf, T = %lf => density = %lf\n", p, t, density);
Message("p = %lf, T = %lf => specific heat = %lf\n", p, t, specificHeat);
Message("p = %lf, T = %lf => viscosity = %lf\n", p, t, viscosity);
Message("p = %lf, T = %lf => thermal conductivity = %lf\n", p, t, thermalConductivity);
Message("p = %lf, T = %lf => enthalpy = %lf\n", p, t, enthalpy);
}