mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
Changed variable from max to max_cells.
Added variable all_cells to be able to initialize new cell_data. moved old_cells, max_cells, all_cells to phreeqc class. initialized old_cells, max_cells, all_cells in init of phreeqc class. Added to copy constructor. changed logic for switching to numerical derivatives by adding && numerical_fixed_volume == false if (iterations > 99 && numerical_fixed_volume == false) Added gammas_pz(); jacobian_sums(); For restart in pitzer.cpp Added gammas_sit(); jacobian_sums(); for restart in sit.cpp. git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@8835 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
96f839e181
commit
660042da0e
@ -448,7 +448,10 @@ void Phreeqc::init(void)
|
||||
dump_in = FALSE;
|
||||
dump_modulus = 0;
|
||||
transport_warnings = TRUE;
|
||||
cell_data = FALSE;
|
||||
cell_data = NULL;
|
||||
old_cells = 0;
|
||||
max_cells = 0;
|
||||
all_cells = 0;
|
||||
multi_Dflag = FALSE;
|
||||
interlayer_Dflag = FALSE;
|
||||
default_Dw = 0;
|
||||
@ -1350,6 +1353,9 @@ Phreeqc::InternalCopy(const Phreeqc *pSrc)
|
||||
if (cell_data == NULL) malloc_error();
|
||||
memcpy(cell_data, pSrc->cell_data, ((size_t) (count_cells * sizeof(struct cell_data))));
|
||||
}
|
||||
old_cells = pSrc->old_cells;
|
||||
max_cells = pSrc->max_cells;
|
||||
all_cells = pSrc->all_cells;
|
||||
multi_Dflag = pSrc->multi_Dflag;
|
||||
interlayer_Dflag = pSrc->interlayer_Dflag;
|
||||
default_Dw = pSrc->default_Dw;
|
||||
|
||||
@ -1365,6 +1365,7 @@ protected:
|
||||
int dump_modulus;
|
||||
int transport_warnings;
|
||||
struct cell_data *cell_data;
|
||||
int old_cells, max_cells, all_cells;
|
||||
int multi_Dflag; /* signals calc'n of multicomponent diffusion */
|
||||
int interlayer_Dflag; /* multicomponent diffusion and diffusion through interlayer porosity */
|
||||
LDBLE default_Dw; /* default species diffusion coefficient in water at 25oC, m2/s */
|
||||
|
||||
@ -2727,7 +2727,7 @@ calc_gas_pressures(void)
|
||||
V_m = (2. * gas_phase_ptr->Get_v_m() + V_m) / 3;
|
||||
else
|
||||
V_m = (1. * gas_phase_ptr->Get_v_m() + V_m) / 2;
|
||||
if (iterations > 99)
|
||||
if (iterations > 99 && numerical_fixed_volume == false)
|
||||
{
|
||||
//V_m *= 1; /* debug */
|
||||
numerical_fixed_volume = true;
|
||||
|
||||
@ -1751,8 +1751,10 @@ Restart:
|
||||
molalities(TRUE);
|
||||
if (max_unknowns > pz_max_unknowns)
|
||||
{
|
||||
base = (LDBLE *) free_check_null(base);
|
||||
goto Restart;
|
||||
base = (LDBLE *) free_check_null(base);
|
||||
gammas_pz();
|
||||
jacobian_sums();
|
||||
goto Restart;
|
||||
}
|
||||
if (full_pitzer == TRUE)
|
||||
pitzer();
|
||||
|
||||
65
readtr.cpp
65
readtr.cpp
@ -36,7 +36,6 @@ read_transport(void)
|
||||
*/
|
||||
char *ptr;
|
||||
int i, j, l;
|
||||
int old_cells, max, all_cells;
|
||||
int count_length, count_disp, count_punch, count_print;
|
||||
int count_length_alloc, count_disp_alloc;
|
||||
char token[MAX_LENGTH];
|
||||
@ -103,7 +102,7 @@ read_transport(void)
|
||||
{
|
||||
correct_disp = FALSE;
|
||||
old_cells = 0;
|
||||
max = 0;
|
||||
max_cells = 0;
|
||||
all_cells = 0;
|
||||
}
|
||||
else
|
||||
@ -637,14 +636,14 @@ read_transport(void)
|
||||
/*
|
||||
* Determine number of cells
|
||||
*/
|
||||
max = count_cells;
|
||||
if (count_length > max)
|
||||
max = count_length;
|
||||
if (count_disp > max)
|
||||
max = count_disp;
|
||||
if (max > count_cells)
|
||||
max_cells = count_cells;
|
||||
if (count_length > max_cells)
|
||||
max_cells = count_length;
|
||||
if (count_disp > max_cells)
|
||||
max_cells = count_disp;
|
||||
if (max_cells > count_cells)
|
||||
{
|
||||
if (max == count_length)
|
||||
if (max_cells == count_length)
|
||||
{
|
||||
sprintf(token,
|
||||
"Number of cells is increased to number of 'lengths' %d.",
|
||||
@ -663,12 +662,12 @@ read_transport(void)
|
||||
* Allocate space for cell_data
|
||||
*/
|
||||
cell_data = (struct cell_data *) PHRQ_realloc(cell_data,
|
||||
(size_t) (max * (1 + stag_data->count_stag) + 1) * sizeof(struct cell_data));
|
||||
(size_t) (max_cells * (1 + stag_data->count_stag) + 1) * sizeof(struct cell_data));
|
||||
if (cell_data == NULL)
|
||||
malloc_error();
|
||||
|
||||
// initialize new cells
|
||||
int all_cells_now = max * (1 + stag_data->count_stag) + 1;
|
||||
int all_cells_now = max_cells * (1 + stag_data->count_stag) + 1;
|
||||
if (all_cells_now > all_cells)
|
||||
{
|
||||
for (int i = all_cells; i < all_cells_now; i++)
|
||||
@ -690,12 +689,12 @@ read_transport(void)
|
||||
*/
|
||||
if (count_length == 0)
|
||||
{
|
||||
if (old_cells < max)
|
||||
if (old_cells < max_cells)
|
||||
{
|
||||
error_string = sformatf(
|
||||
"No cell-lengths were read; length = 1 m assumed.");
|
||||
warning_msg(error_string);
|
||||
for (i = 0; i < max; i++)
|
||||
for (i = 0; i < max_cells; i++)
|
||||
cell_data[i].length = 1.0;
|
||||
}
|
||||
}
|
||||
@ -705,35 +704,35 @@ read_transport(void)
|
||||
{
|
||||
cell_data[i].length = length[i];
|
||||
}
|
||||
if (max > count_length)
|
||||
if (max_cells > count_length)
|
||||
{
|
||||
error_string = sformatf(
|
||||
"Cell-lengths were read for %d cells. Last value is used till cell %d.",
|
||||
count_length, max);
|
||||
count_length, max_cells);
|
||||
warning_msg(error_string);
|
||||
for (i = count_length - 1; i < max; i++)
|
||||
for (i = count_length - 1; i < max_cells; i++)
|
||||
cell_data[i].length = length[count_length - 1];
|
||||
}
|
||||
}
|
||||
cell_data[0].mid_cell_x = cell_data[0].length / 2;
|
||||
for (i = 1; i < max; i++)
|
||||
for (i = 1; i < max_cells; i++)
|
||||
{
|
||||
cell_data[i].mid_cell_x = cell_data[i - 1].mid_cell_x +
|
||||
(cell_data[i - 1].length + cell_data[i].length) / 2;
|
||||
}
|
||||
cell_data[max].mid_cell_x =
|
||||
cell_data[max - 1].mid_cell_x + cell_data[max - 1].length;
|
||||
cell_data[max_cells].mid_cell_x =
|
||||
cell_data[max_cells - 1].mid_cell_x + cell_data[max_cells - 1].length;
|
||||
/*
|
||||
* Fill in data for dispersivities
|
||||
*/
|
||||
if (count_disp == 0)
|
||||
{
|
||||
if (old_cells < max)
|
||||
if (old_cells < max_cells)
|
||||
{
|
||||
error_string = sformatf(
|
||||
"No dispersivities were read; disp = 0 assumed.");
|
||||
warning_msg(error_string);
|
||||
for (i = 0; i < max; i++)
|
||||
for (i = 0; i < max_cells; i++)
|
||||
cell_data[i].disp = 0.0;
|
||||
}
|
||||
}
|
||||
@ -741,23 +740,23 @@ read_transport(void)
|
||||
{
|
||||
for (i = 0; i < count_disp; i++)
|
||||
cell_data[i].disp = disp[i];
|
||||
if (max > count_disp)
|
||||
if (max_cells > count_disp)
|
||||
{
|
||||
error_string = sformatf(
|
||||
"Dispersivities were read for %d cells. Last value is used till cell %d.",
|
||||
count_disp, max);
|
||||
count_disp, max_cells);
|
||||
warning_msg(error_string);
|
||||
for (i = count_disp - 1; i < max; i++)
|
||||
for (i = count_disp - 1; i < max_cells; i++)
|
||||
cell_data[i].disp = disp[count_disp - 1];
|
||||
}
|
||||
}
|
||||
count_cells = max;
|
||||
count_cells = max_cells;
|
||||
/*
|
||||
* Account for stagnant cells
|
||||
*/
|
||||
if (stag_data->count_stag > 0)
|
||||
{
|
||||
max = count_cells * (1 + stag_data->count_stag) + 1;
|
||||
max_cells = count_cells * (1 + stag_data->count_stag) + 1;
|
||||
for (i = 0; i < count_cells; i++)
|
||||
{
|
||||
for (l = 1; l <= stag_data->count_stag; l++)
|
||||
@ -770,11 +769,11 @@ read_transport(void)
|
||||
*/
|
||||
if (count_punch != 0)
|
||||
{
|
||||
for (i = 0; i < max; i++)
|
||||
for (i = 0; i < max_cells; i++)
|
||||
cell_data[i].punch = FALSE;
|
||||
for (i = 0; i < count_punch; i++)
|
||||
{
|
||||
if (punch_temp[i] > max || punch_temp[i] < 1)
|
||||
if (punch_temp[i] > max_cells || punch_temp[i] < 1)
|
||||
{
|
||||
error_string = sformatf(
|
||||
"Cell number for punch is out of range, %d. Request ignored.",
|
||||
@ -786,18 +785,18 @@ read_transport(void)
|
||||
}
|
||||
}
|
||||
else if (simul_tr == 1)
|
||||
for (i = 0; i < max; i++)
|
||||
for (i = 0; i < max_cells; i++)
|
||||
cell_data[i].punch = TRUE;
|
||||
/*
|
||||
* Fill in data for print
|
||||
*/
|
||||
if (count_print != 0)
|
||||
{
|
||||
for (i = 0; i < max; i++)
|
||||
for (i = 0; i < max_cells; i++)
|
||||
cell_data[i].print = FALSE;
|
||||
for (i = 0; i < count_print; i++)
|
||||
{
|
||||
if (print_temp[i] > max || print_temp[i] < 1)
|
||||
if (print_temp[i] > max_cells || print_temp[i] < 1)
|
||||
{
|
||||
error_string = sformatf(
|
||||
"Cell number for print is out of range, %d. Request ignored.",
|
||||
@ -809,7 +808,7 @@ read_transport(void)
|
||||
}
|
||||
}
|
||||
else if (simul_tr == 1)
|
||||
for (i = 0; i < max; i++)
|
||||
for (i = 0; i < max_cells; i++)
|
||||
cell_data[i].print = TRUE;
|
||||
/*
|
||||
* Fill in porosities
|
||||
@ -822,7 +821,7 @@ read_transport(void)
|
||||
error_msg(error_string, CONTINUE);
|
||||
|
||||
}
|
||||
for (i = 0; i < max; i++)
|
||||
for (i = 0; i < max_cells; i++)
|
||||
{
|
||||
multi_Dpor = (multi_Dpor < 1e-10 ? 1e-10 : multi_Dpor);
|
||||
interlayer_Dpor = (interlayer_Dpor < 1e-10 ? 1e-10 : interlayer_Dpor);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user