code-saturne / code_saturne

code_saturne public mirror
https://www.code-saturne.org
GNU General Public License v2.0
223 stars 82 forks source link

Lagrangian: Erroneous particle flow rate per class reporting in listing file #4

Closed nicolastonello closed 6 years ago

nicolastonello commented 6 years ago

CS version: Trunk version as of April 2018

Problem: In Lagrangian calculations with multiple classes , the flow rate output reported per class per boundary in the listing file is the same value as the total at the boundary.

The problem comes from bug (likely copy/paste) in 'cs_lagr_log_iteration' in 'cs_lagr_log.c', where the print statement for each class (flow_rate) on line 556 is reporting the total instead of the class value:

  for (int j = 1; j < n_stats; j++) {
    if (CS_ABS(flow_rate[z_id*n_stats + j]) > 0)
      cs_log_printf(CS_LOG_DEFAULT,
                    "    class %3d  %12.5e         %s\n",
                    j,
                    flow_rate[z_id*n_stats]/cs_glob_lagr_time_step->dtp,
                    chcond);
  }

Solution: change the print statement to:

  for (int j = 1; j < n_stats; j++) {
    if (CS_ABS(flow_rate[z_id*n_stats + j]) > 0)
      cs_log_printf(CS_LOG_DEFAULT,
                    "    class %3d  %12.5e         %s\n",
                    j,
                    flow_rate[z_id*n_stats + j]/cs_glob_lagr_time_step->dtp,
                    chcond);
  }
YvanFournier commented 6 years ago

Fixed in master, v5.2.1, v5.1.5.