The Examples function is required to compute a volume exchange coefficient for SYRTHES coupling.
Examples
The following code blocks show two examples of computation of a volume exchange coefficient.
Example 1
The first example corresponds to a constant volume exchange coefficient:
h_vol[i] = hvol_cst;
}
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
Example 2
The second example corresponds to a variable volume exchange coefficient defined as follows :
with S is the surface area where exchanges take place by unit of volume and
First, the values of the different fields that will be needed for the computation of the volume exchange coefficient are retrieved.
const cs_real_t *cpro_cp =
nullptr, *cpro_viscls =
nullptr;
cp_step = 1;
}
else {
}
const int viscl_id = fth->
get_key_int(
"diffusivity_id");
if (viscl_id > -1) {
viscls_step = 1;
}
else {
cpro_viscls = &visls_0;
}
const int is_temperature = fth->
get_key_int(
"is_temperature");
Field descriptor.
Definition: cs_field.h:275
int get_key_int(int key_id) const
Return a integer value for a given key associated with a field.
Definition: cs_field.cpp:4507
double get_key_double(int key_id) const
Return a floating point value for a given key associated with a field.
Definition: cs_field.cpp:4745
cs_real_t * val
Definition: cs_field.h:298
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:349
cs_field_t * cs_field(int id)
Return a pointer to a field based on its id. This function requires that a field of the given id is d...
Definition: cs_field.cpp:4295
@ mu
Definition: cs_field_pointer.h:102
@ vel
Definition: cs_field_pointer.h:66
@ cp
Definition: cs_field_pointer.h:99
@ rho
Definition: cs_field_pointer.h:96
#define CS_F_(e)
Macro used to return a field pointer by its enumerated value.
Definition: cs_field_pointer.h:47
const cs_fluid_properties_t * cs_glob_fluid_properties
Definition: cs_physical_constants.cpp:462
cs_field_t * cs_thermal_model_field(void)
Definition: cs_thermal_model.cpp:180
real(c_double), pointer, save cp0
reference specific heat.
Definition: cstphy.f90:81
double cp0
Definition: cs_physical_constants.h:85
Then the coefficient can be computed and assigned to all cells.
if (is_temperature) {
lambda = cpro_viscls[c_id*viscls_step];
}
else {
lambda_over_cp = cpro_viscls[c_id*viscls_step];
}
cs_real_t nu = 0.023 * pow(re, 0.8) * cbrt(pr);
h_vol[i] = h_corr * sexcvo;
}
@ lambda
Definition: cs_field_pointer.h:105
CS_F_HOST_DEVICE T cs_math_3_norm(const T v[3])
Compute the euclidean norm of a vector of dimension 3.
Definition: cs_math.h:240
Not that in this example, no test is done on the coupling id or Syrthes instance name. The corresponding arguments can be used to apply specific computations in cas of multiple couplings.
Also, although a test is done to check if the scalar behaves as a temperature regarding multiplication by Cp for more generality, the Syrthes volume coupling currently only handles the temperature variable.