void RichardsBCInternal( Problem *problem, ProblemData *problem_data, Vector *f, Matrix *A, double time, Vector *pressure, int fcn) { PFModule *this_module = ThisPFModule; PublicXtra *public_xtra = (PublicXtra *)PFModulePublicXtra(this_module); WellData *well_data = ProblemDataWellData(problem_data); WellDataPhysical *well_data_physical; WellDataValue *well_data_value; TimeCycleData *time_cycle_data; int num_conditions = (public_xtra -> num_conditions); int num_wells, total_num; Type0 *dummy0; Grid *grid = VectorGrid(pressure); SubgridArray *internal_bc_subgrids = NULL; Subgrid *subgrid, *subgrid_ind, *new_subgrid; Subvector *p_sub; double *pp; double *internal_bc_conditions = NULL; double dx, dy, dz; double value; int ix, iy, iz; int nx, ny, nz; int rx, ry, rz; int process; int i, j, k; int grid_index, well, index; int cycle_number, interval_number; int ip, im; /*-------------------------------------------------------------------- * gridify the internal boundary locations (should be done elsewhere?) *--------------------------------------------------------------------*/ if ( num_conditions > 0 ) { internal_bc_subgrids = NewSubgridArray(); internal_bc_conditions = ctalloc(double, num_conditions); for (i = 0; i < num_conditions;i++) { switch((public_xtra -> type[i])) { case 0: { dummy0 = (Type0 *)(public_xtra -> data[i]); ix = IndexSpaceX((dummy0 -> xlocation), 0); iy = IndexSpaceY((dummy0 -> ylocation), 0); iz = IndexSpaceZ((dummy0 -> zlocation), 0); nx = 1; ny = 1; nz = 1; rx = 0; ry = 0; rz = 0; process = amps_Rank(amps_CommWorld); new_subgrid = NewSubgrid(ix, iy, iz, nx, ny, nz, rx, ry, rz, process); AppendSubgrid(new_subgrid, internal_bc_subgrids); internal_bc_conditions[i] = (dummy0 -> value); break; } } } }
void BCInternal( Problem * problem, ProblemData *problem_data, Matrix * A, Vector * f, double time) { PFModule *this_module = ThisPFModule; PublicXtra *public_xtra = (PublicXtra*)PFModulePublicXtra(this_module); PFModule *phase_density = ProblemPhaseDensity(problem); WellData *well_data = ProblemDataWellData(problem_data); WellDataPhysical *well_data_physical; WellDataValue *well_data_value; TimeCycleData *time_cycle_data; int num_conditions = (public_xtra->num_conditions); Type0 *dummy0; Grid *grid = VectorGrid(f); SubgridArray *internal_bc_subgrids; Subgrid *subgrid, *ibc_subgrid, *well_subgrid, *new_subgrid; Submatrix *A_sub; Subvector *f_sub; double *internal_bc_conditions, *mp; double Z; double dx, dy, dz; int ix, iy, iz; int nx, ny, nz; int rx, ry, rz; int process; int i, j, k, i_sft, j_sft, k_sft; int grid_index, ibc_sg, well, index; int cycle_number, interval_number; double dtmp, ptmp, head, phead; int stencil[7][3] = { { 0, 0, 0 }, { -1, 0, 0 }, { 1, 0, 0 }, { 0, -1, 0 }, { 0, 1, 0 }, { 0, 0, -1 }, { 0, 0, 1 } }; /***** Some constants for the routine *****/ /* Hard-coded assumption for constant density. */ PFModuleInvokeType(PhaseDensityInvoke, phase_density, (0, NULL, NULL, &ptmp, &dtmp, CALCFCN)); dtmp = ProblemGravity(problem) * dtmp; /*-------------------------------------------------------------------- * gridify the internal boundary locations (should be done elsewhere?) *--------------------------------------------------------------------*/ if (num_conditions > 0) { internal_bc_subgrids = NewSubgridArray(); internal_bc_conditions = ctalloc(double, num_conditions); for (i = 0; i < num_conditions; i++) { switch ((public_xtra->type[i])) { case 0: { dummy0 = (Type0*)(public_xtra->data[i]); ix = IndexSpaceX((dummy0->xlocation), 0); iy = IndexSpaceY((dummy0->ylocation), 0); iz = IndexSpaceZ((dummy0->zlocation), 0); nx = 1; ny = 1; nz = 1; rx = 0; ry = 0; rz = 0; process = amps_Rank(amps_CommWorld); new_subgrid = NewSubgrid(ix, iy, iz, nx, ny, nz, rx, ry, rz, process); AppendSubgrid(new_subgrid, internal_bc_subgrids); internal_bc_conditions[i] = (dummy0->value); break; } } } }
void SelectTimeStep( double *dt, /* Time step size */ char *dt_info, /* Character flag indicating what requirement chose the time step */ double time, Problem *problem, ProblemData *problem_data) { PFModule *this_module = ThisPFModule; PublicXtra *public_xtra = (PublicXtra *)PFModulePublicXtra(this_module); Type0 *dummy0; Type1 *dummy1; double well_dt, bc_dt; switch((public_xtra -> type)) { case 0: { double constant; dummy0 = (Type0 *)(public_xtra -> data); constant = (dummy0 -> step); (*dt) = constant; break; } /* End case 0 */ case 1: { double initial_step; double factor; double max_step; double min_step; dummy1 = (Type1 *)(public_xtra -> data); initial_step = (dummy1 -> initial_step); factor = (dummy1 -> factor); max_step = (dummy1 -> max_step); min_step = (dummy1 -> min_step); if ((*dt) == 0.0) { (*dt) = initial_step; } else { (*dt) = (*dt)*factor; if ((*dt) < min_step) (*dt) = min_step; if ((*dt) > max_step) (*dt) = max_step; } break; } /* End case 1 */ } /* End switch */ /*----------------------------------------------------------------- * Get delta t's for all wells and boundary conditions. *-----------------------------------------------------------------*/ well_dt = TimeCycleDataComputeNextTransition(problem, time, WellDataTimeCycleData(ProblemDataWellData(problem_data))); bc_dt = TimeCycleDataComputeNextTransition(problem, time, BCPressureDataTimeCycleData(ProblemDataBCPressureData(problem_data))); /*----------------------------------------------------------------- * Compute the new dt value based on time stepping criterion imposed * by the user or on system parameter changes. Indicate what * determined the value of `dt'. *-----------------------------------------------------------------*/ if ( well_dt <= 0.0 ) well_dt = (*dt); if ( bc_dt <= 0.0 ) bc_dt = (*dt); if ((*dt) > well_dt) { (*dt) = well_dt; (*dt_info) = 'w'; } else if ((*dt) > bc_dt) { (*dt) = bc_dt; (*dt_info) = 'b'; } else { (*dt_info) = 'p'; } }