Merge commit '51fbb3d5b08d20592bbc358d2f7ca25b75c74691'

This commit is contained in:
Scott R Charlton 2019-02-04 21:19:44 -07:00
commit 5b1de2f720

View File

@ -975,7 +975,7 @@ print_punch(int i, boolean active)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
if ((!(cell_data[i].punch && (transport_step % punch_modulus == 0)) && if ((!(cell_data[i].punch && (transport_step % punch_modulus == 0)) &&
!(cell_data[i].print && (transport_step % print_modulus == 0))) || !(cell_data[i].print && (transport_step % print_modulus == 0))) ||
(bcon_first == 2 && i == 0) || (bcon_first == 2 && i == 0) ||
(bcon_last == 2 && i == count_cells + 1)) (bcon_last == 2 && i == count_cells + 1))
return; return;
@ -1110,6 +1110,8 @@ init_mix(void)
{ {
if (2.25 * maxmix + 1.0 > (double)INT_MAX) if (2.25 * maxmix + 1.0 > (double)INT_MAX)
{ {
m = (LDBLE *)free_check_null(m);
m1 = (LDBLE *)free_check_null(m1);
char token[MAX_LENGTH]; char token[MAX_LENGTH];
sprintf(token, "Calculated number of mixes %g, is beyond program limit,\nERROR: please decrease time_step, or increase cell-lengths.", 2.25 * maxmix); sprintf(token, "Calculated number of mixes %g, is beyond program limit,\nERROR: please decrease time_step, or increase cell-lengths.", 2.25 * maxmix);
error_msg(token, STOP); error_msg(token, STOP);
@ -1229,6 +1231,8 @@ init_mix(void)
{ {
if (1.5 * maxmix > (double)INT_MAX) if (1.5 * maxmix > (double)INT_MAX)
{ {
m = (LDBLE *)free_check_null(m);
m1 = (LDBLE *)free_check_null(m1);
char token[MAX_LENGTH]; char token[MAX_LENGTH];
sprintf(token, "Calculated number of mixes %g, is beyond program limit,\nERROR: please decrease time_step, or increase cell-lengths.", 1.5 * maxmix); sprintf(token, "Calculated number of mixes %g, is beyond program limit,\nERROR: please decrease time_step, or increase cell-lengths.", 1.5 * maxmix);
error_msg(token, STOP); error_msg(token, STOP);
@ -3090,8 +3094,8 @@ find_J(int icell, int jcell, LDBLE mixf, LDBLE DDt, int stagnant)
if (dV_dcell) if (dV_dcell)
{ {
//if (transport_step >= 100) //if (transport_step >= 100) // debug...
// /* icell = icell */; // icell = icell;
current_cells[icell].ele = current_cells[icell].dif = 0; current_cells[icell].ele = current_cells[icell].dif = 0;
dum = dV_dcell * F_Re3 / tk_x2; dum = dV_dcell * F_Re3 / tk_x2;
for (i = 0; i < ct[icell].J_ij_count_spec; i++) for (i = 0; i < ct[icell].J_ij_count_spec; i++)
@ -3139,21 +3143,23 @@ dV_dcell2:
if (dV_dcell) if (dV_dcell)
{ {
// perhaps adapt dV for getting equal current...
current_cells[icell].ele = current_cells[icell].dif = 0;
dV = cell_data[jcell].potV - cell_data[icell].potV; dV = cell_data[jcell].potV - cell_data[icell].potV;
dum = dV * F_Re3 / tk_x2; dum = dV * F_Re3 / tk_x2;
for (i = 0; i < ct[icell].J_ij_count_spec; i++) // perhaps adapt dV for getting equal current...
{ //current_cells[icell].ele = current_cells[icell].dif = 0;
if (!ct[icell].v_m[i].z) //for (i = 0; i < ct[icell].J_ij_count_spec; i++)
continue; //{
current_cells[icell].ele -= ct[icell].v_m[i].b_ij * ct[icell].v_m[i].z * // if (!ct[icell].v_m[i].z)
ct[icell].v_m[i].zc * dum; // continue;
current_cells[icell].dif -= ct[icell].v_m[i].b_ij * ct[icell].v_m[i].z * // current_cells[icell].ele -= ct[icell].v_m[i].b_ij * ct[icell].v_m[i].z *
ct[icell].v_m[i].grad; // ct[icell].v_m[i].zc * dum;
} // current_cells[icell].dif -= ct[icell].v_m[i].b_ij * ct[icell].v_m[i].z *
dV *= (current_x - current_cells[icell].dif) / current_cells[icell].ele; // ct[icell].v_m[i].grad;
dum = dV * F_Re3 / tk_x2; //}
//dum1 = (current_x - current_cells[icell].dif) / current_cells[icell].ele;
//if (isnan(dum1))
// dum1 = 1;
//dum *= dum1;
for (i = 0; i < ct[icell].J_ij_count_spec; i++) for (i = 0; i < ct[icell].J_ij_count_spec; i++)
{ {
if (!ct[icell].v_m[i].z) if (!ct[icell].v_m[i].z)