I have entered my formulation for spatially varying density inside:
Code: Select all
void
cs_user_physical_properties(const cs_mesh_t *mesh,
const cs_mesh_quantities_t *mesh_quantities)
{
}
Thanks.
Code: Select all
void
cs_user_physical_properties(const cs_mesh_t *mesh,
const cs_mesh_quantities_t *mesh_quantities)
{
}
(adding "cs_field_pointer.h" to the includes section if missing)cs_real_t cvar_rho = CS_F_(rho)->val;
Should provide access to the cell values array for density. The other examples (postprocessing/extra operations) may help you see how to access other variables you may need to determine density values.cs_real_t cvar_rho = cs_field_b_name("density")->val;
Code: Select all
void
cs_user_physical_properties(const cs_mesh_t *mesh,
const cs_mesh_quantities_t *mesh_quantities)
{
cs_real_t *cvar_rho = CS_F_(rho)->val;
for(cs_int_t cell_id=0; cell_id < mesh->n_cells; cell_id++)
{
x = mesh_quantities->cell_cen[3*cell_id];
y = mesh_quantities->cell_cen[3*cell_id+1];
...
cvar_rho[cell_id] = f(x, y ...);
}
return;
}