8.3
general documentation
cs_physical_properties.cpp File Reference
#include "cs_defs.h"
#include <assert.h>
#include <math.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "bft_error.h"
#include "bft_mem.h"
#include "bft_printf.h"
#include "cs_log.h"
#include "cs_timer.h"
#include "cs_property.h"
#include "cs_physical_properties.h"
#include "cs_eos.hxx"
#include "cs_coolprop.hxx"
+ Include dependency graph for cs_physical_properties.cpp:

Functions

void cs_thermal_table_set (const char *material, const char *method, const char *reference, cs_phys_prop_thermo_plane_type_t thermo_plane, cs_temperature_scale_t temp_scale)
 Define thermal table. More...
 
void cs_thermal_table_finalize (void)
 finalize thermal table. More...
 
const char * cs_physical_properties_get_coolprop_backend (void)
 Get backend set for CoolProp. More...
 
void cs_physical_properties_set_coolprop_backend (const char *backend)
 Set backend for CoolProp. More...
 
void cs_phys_prop_compute (cs_phys_prop_type_t property, cs_lnum_t n_vals, cs_lnum_t var1_stride, cs_lnum_t var2_stride, const cs_real_t var1[], const cs_real_t var2[], cs_real_t val[])
 Compute a physical property. More...
 
cs_real_t cs_physical_property_get_ref_value (const char *name)
 Get reference value of a physical property. More...
 
void cs_physical_property_set_ref_value (const char *name, const cs_real_t val)
 Set reference value for a physical property. More...
 
void cs_physical_property_get_zone_values (const char *name, const char *zname, cs_real_t retval[])
 Get property reference values for a given zone. More...
 
void cs_physical_property_create (const char *name, const int dim, const cs_real_t refval)
 Create a physical property. More...
 
void cs_physical_property_define_from_value (const char *name, const char *zname, const int dim, const cs_real_t val)
 Add a property definition on a given zone using a single value. More...
 
void cs_physical_property_define_from_values (const char *name, const char *zname, const int dim, cs_real_t vals[])
 Add a property multi-diemnsional definition on a given zone. More...
 
void cs_physical_property_define_from_field (const char *name, int type_flag, int location_id, int dim, bool has_previous)
 Add a property definition based on a cs_field_t. More...
 
int cs_physical_property_field_id_by_name (const char *name)
 Return id of field associated to property. More...
 
void cs_physical_property_update_zone_values (const char *name, const char *zname, const cs_real_t vals[])
 Update reference values for a property on a given zone. More...
 

Function Documentation

◆ cs_phys_prop_compute()

void cs_phys_prop_compute ( cs_phys_prop_type_t  property,
cs_lnum_t  n_vals,
cs_lnum_t  var1_stride,
cs_lnum_t  var2_stride,
const cs_real_t  var1[],
const cs_real_t  var2[],
cs_real_t  val[] 
)

Compute a physical property.

For values var1 and var2, we can use a stride so that accesses for a given element with id i will be of the form: var[i*stride]; this allows regular access with stride 1, and access to constant variables stored as a single-valued array with a stride of 0.

Parameters
[in]propertyproperty queried
[in]n_valsnumber of values
[in]var1_stridestride between successive values of var1
[in]var2_stridestride between successive values of var2
[in]var1values on first plane axis
[in]var2values on second plane axis
[out]valresulting property values

◆ cs_physical_properties_get_coolprop_backend()

const char * cs_physical_properties_get_coolprop_backend ( void  )

Get backend set for CoolProp.

Returns null if CoolProp is not used or backend not set yet.

Returns
pointer to CoolProp backend.

◆ cs_physical_properties_set_coolprop_backend()

void cs_physical_properties_set_coolprop_backend ( const char *  backend)

Set backend for CoolProp.

Ignored if CoolProp is not used.

When called from user-defined functions, this should be set from cs_user_model rather than cs_user_parameters, as some reference property values may be computed before calling cs_user_parameters.

A few primary backends in CoolProp are:

  • "HEOS": The Helmholtz Equation of State backend for use with pure and pseudo-pure fluids, and mixtures, all of which are based on multi-parameter Helmholtz Energy equations of state.
  • "REFPROP": only if REFPROP library is available (set ALTERNATIVE_REFPROP_PATH environment variable if needed)
  • "INCOMP": Incompressible backend (for pure fluids)
  • "TTSE&XXXX": TTSE backend, with tables generated using the XXXX backend where XXXX is one of the base backends("HEOS", "REFPROP", etc.)
  • "BICUBIC&XXXX": Bicubic backend, with tables generated using the XXXX backend where XXXX is one of the base backends("HEOS", "REFPROP", etc.)
Parameters
[in]backendbackend name; "HEOS" used if nullptr.

◆ cs_physical_property_create()

void cs_physical_property_create ( const char *  name,
const int  dim,
const cs_real_t  refval 
)

Create a physical property.

Parameters
[in]nameproperty name
[in]dimproperty dimension
[in]refvalreference value

◆ cs_physical_property_define_from_field()

void cs_physical_property_define_from_field ( const char *  name,
int  type_flag,
int  location_id,
int  dim,
bool  has_previous 
)

Add a property definition based on a cs_field_t.

The field is created if needed

Parameters
[in]nameproperty name
[in]type_flagfield type flag
[in]location_idlocation id flag
[in]dimfield dimension
[in]has_previousdoes the field has val_pre

◆ cs_physical_property_define_from_value()

void cs_physical_property_define_from_value ( const char *  name,
const char *  zname,
const int  dim,
const cs_real_t  val 
)

Add a property definition on a given zone using a single value.

Parameters
[in]nameproperty name
[in]znamezone name
[in]dimproperty dimension
[in]valreference value for the zone

◆ cs_physical_property_define_from_values()

void cs_physical_property_define_from_values ( const char *  name,
const char *  zname,
const int  dim,
cs_real_t  vals[] 
)

Add a property multi-diemnsional definition on a given zone.

Parameters
[in]nameproperty name
[in]znamezone name
[in]dimproperty dimension (>1)
[in]valsarray of values to set

◆ cs_physical_property_field_id_by_name()

int cs_physical_property_field_id_by_name ( const char *  name)

Return id of field associated to property.

Parameters
[in]nameproperty name
Returns
field id (int)

◆ cs_physical_property_get_ref_value()

cs_real_t cs_physical_property_get_ref_value ( const char *  name)

Get reference value of a physical property.

Parameters
[in]nameproperty name
Returns
reference value (cs_real_t)

◆ cs_physical_property_get_zone_values()

void cs_physical_property_get_zone_values ( const char *  name,
const char *  zname,
cs_real_t  retval[] 
)

Get property reference values for a given zone.

Parameters
[in]nameproperty name
[in]znamezone name
[in]retvalarray of values to return

◆ cs_physical_property_set_ref_value()

void cs_physical_property_set_ref_value ( const char *  name,
const cs_real_t  val 
)

Set reference value for a physical property.

Parameters
[in]nameproperty name
[in]valnew value to set

◆ cs_physical_property_update_zone_values()

void cs_physical_property_update_zone_values ( const char *  name,
const char *  zname,
const cs_real_t  vals[] 
)

Update reference values for a property on a given zone.

Parameters
[in]nameproperty name
[in]znamezone name
[in]valsarray of values to set

◆ cs_thermal_table_finalize()

void cs_thermal_table_finalize ( void  )

finalize thermal table.

◆ cs_thermal_table_set()

void cs_thermal_table_set ( const char *  material,
const char *  method,
const char *  reference,
cs_phys_prop_thermo_plane_type_t  thermo_plane,
cs_temperature_scale_t  temp_scale 
)

Define thermal table.