Yes, your code works very well, at least for velocity field.
Probably you just mistyped "ve" instead of "vel" in
Code: Select all
cs_lnum_t n_vals = cs_glob_mesh->n_cells * ve->dim
Code: Select all
cs_glob_mesh->n_cells * ve->dim
Does it mean just "multiplication"?
So the code means "the number of cells *(time) 3", doesn't it?
___________________________________________________________________________
In next step, I will do it for "mass flux".
SInce the dimention of mass flux is 1 dimension,
I guess the previsou code should work, but there is an error message when compilng.
Should I also change something for mass flux?
Code: Select all
void
cs_user_initialization(cs_domain_t *domain)
{
cs_field_t *vel = cs_field_by_name("velocity");
cs_field_t *vel_m = cs_field_by_name("meanVel");
cs_field_t *inner_mass_flux = cs_field_by_name("inner_mass_flux");
cs_field_t *inner_mass_flux_m = cs_field_by_name("inner_mass_flux_mean");
cs_field_t *boundary_mass_flux = cs_field_by_name("boundary_mass_flux");
cs_field_t *boundary_mass_flux_m = cs_field_by_name("boundary_mass_flux_mean");
cs_lnum_t n_vals = cs_glob_mesh->n_cells * vel->dim; // n_cells * 3 for vector field
for (cs_lnum_t i = 0; i < n_vals; i++) {
vel->val[i] = vel_m->val[i];
}
for (cs_lnum_t i = 0; i < cs_glob_mesh->n_cells; i++) {
inner_mass_flux->val[i] = inner_mass_flux_m->val[i];
boundary_mass_flux->val[i] = boundary_mass_flux_m->val[i];
}
}
Code: Select all
boundary_mass_flux->val[i] = boundary_mass_flux_m->val[i];
I think, the number of cell for boundary mass flux is not same to inner mass flux and velocities.
For boundary mass flux, we should code "cs_glob_mesh->n_b_cells" instead "cs_glob_mesh->n_cells", right?
At least now, this code works.
___________________________________________________________________________
Also I want to check one thing.
For inner mass flux, is the number of cells "cs_glob_mesh->n_cells"?
I am worrying that there is a symbol for "the numbre of inner cell"? (e.g. n_b_cells for boundary mass flux)
Best regares,
Tsubasa