![]() |
MODFLOW 6
version 6.7.0.dev3
USGS Modular Hydrologic Model
|
Data Types | |
| type | numericalsolutiontype |
| interface | synchronize_iface |
Functions/Subroutines | |
| subroutine, public | create_numerical_solution (num_sol, filename, id) |
| @ brief Create a new solution More... | |
| subroutine | allocate_scalars (this) |
| @ brief Allocate scalars More... | |
| subroutine | allocate_arrays (this) |
| @ brief Allocate arrays More... | |
| subroutine | sln_df (this) |
| @ brief Define the solution More... | |
| subroutine | sln_ar (this) |
| @ brief Allocate and read data More... | |
| subroutine | sln_dt (this) |
| @ brief Calculate delt More... | |
| subroutine | sln_ad (this) |
| @ brief Advance solution More... | |
| subroutine | sln_ot (this) |
| @ brief Output solution More... | |
| subroutine | sln_fp (this) |
| @ brief Finalize solution More... | |
| subroutine | sln_da (this) |
| @ brief Deallocate solution More... | |
| subroutine | sln_ca (this, isgcnvg, isuppress_output) |
| @ brief Solve solution More... | |
| subroutine | writecsvheader (this) |
| @ brief CSV header More... | |
| subroutine | writeptcinfotofile (this, kper) |
| @ brief PTC header More... | |
| subroutine | preparesolve (this) |
| @ brief prepare to solve More... | |
| subroutine | solve (this, kiter) |
| @ brief Build and solve the simulation More... | |
| subroutine | finalizesolve (this, kiter, isgcnvg, isuppress_output) |
| @ brief finalize a solution More... | |
| subroutine | sln_buildsystem (this, kiter, inewton) |
| subroutine | convergence_summary (this, iu, im, itertot_timestep) |
| @ brief Solution convergence summary More... | |
| subroutine | csv_convergence_summary (this, iu, totim, kper, kstp, kouter, niter, istart, kstart) |
| @ brief Solution convergence CSV summary More... | |
| subroutine | save (this, filename) |
| @ brief Save solution data to a file More... | |
| subroutine | add_model (this, mp) |
| @ brief Add a model More... | |
| type(listtype) function, pointer | get_models (this) |
| Get a list of models. More... | |
| subroutine | add_exchange (this, exchange) |
| Add exchange. More... | |
| type(listtype) function, pointer | get_exchanges (this) |
| Returns a pointer to the list of exchanges in this solution. More... | |
| subroutine | sln_connect (this) |
| @ brief Assign solution connections More... | |
| subroutine | sln_reset (this) |
| @ brief Reset the solution More... | |
| subroutine | sln_ls (this, kiter, kstp, kper, in_iter, iptc, ptcf) |
| @ brief Solve the linear system of equations More... | |
| subroutine | sln_setouter (this, ifdparam) |
| @ brief Set default Picard iteration variables More... | |
| subroutine | sln_backtracking (this, mp, cp, kiter) |
| @ brief Perform backtracking More... | |
| subroutine | sln_backtracking_xupdate (this, bt_flag) |
| @ brief Backtracking update of the dependent variable More... | |
| integer(i4b) function | get_backtracking_flag (this) |
| Check if backtracking should be applied for this solution,. More... | |
| integer(i4b) function | sln_get_idvscale (this) |
| Check if dependent variable scalining should be applied for this solution,. More... | |
| subroutine | apply_backtracking (this) |
| Update x with backtracking. More... | |
| subroutine | sln_l2norm (this, l2norm) |
| @ brief Calculate the solution L-2 norm for all active cells using More... | |
| subroutine | sln_maxval (this, nsize, v, vmax) |
| @ brief Get the maximum value from a vector More... | |
| subroutine | sln_calcdx (this, neq, active, x, xtemp, dx) |
| @ brief Calculate dependent-variable change More... | |
| subroutine | sln_calc_ptc (this, iptc, ptcf) |
| Calculate pseudo-transient continuation factor. More... | |
| subroutine | sln_calc_residual (this, vec_resid) |
| Calculate the current residual vector r = A*x - b,. More... | |
| subroutine | sln_underrelax (this, kiter, bigch, neq, active, x, xtemp) |
| @ brief Under-relaxation More... | |
| subroutine | sln_get_dxmax (this, hncg, lrch) |
| @ brief Determine maximum dependent-variable change More... | |
| logical(lgp) function | sln_has_converged (this, max_dvc) |
| integer(i4b) function | sln_package_convergence (this, dpak, cpakout, iend) |
| Check package convergence. More... | |
| integer(i4b) function | sln_sync_newtonur_flag (this, inewtonur) |
| Synchronize Newton Under-relaxation flag. More... | |
| logical(lgp) function | sln_nur_has_converged (this, dxold_max, hncg) |
| Custom convergence check for when Newton UR has been applied. More... | |
| subroutine | sln_get_loc (this, nodesln, str) |
| @ brief Get cell location string More... | |
| subroutine | sln_get_nodeu (this, nodesln, im, nodeu) |
| @ brief Get user node number More... | |
| class(numericalsolutiontype) function, pointer, public | castasnumericalsolutionclass (obj) |
| @ brief Cast a object as a Numerical Solution More... | |
| class(numericalsolutiontype) function, pointer, public | getnumericalsolutionfromlist (list, idx) |
| @ brief Get a numerical solution More... | |
Variables | |
| integer(i4b), parameter | ims_solver = 1 |
| integer(i4b), parameter | petsc_solver = 2 |
|
private |
Add and exchange to thisexchangelist.
| this | NumericalSolutionType instance | |
| [in] | exchange | model exchange instance |
Definition at line 2341 of file NumericalSolution.f90.

| subroutine numericalsolutionmodule::add_model | ( | class(numericalsolutiontype) | this, |
| class(basemodeltype), intent(in), pointer | mp | ||
| ) |
Add a model to solution.
| this | NumericalSolutionType instance | |
| [in] | mp | model instance |
Definition at line 2306 of file NumericalSolution.f90.

| subroutine numericalsolutionmodule::allocate_arrays | ( | class(numericalsolutiontype) | this | ) |
Allocate arrays for a new solution.
| this | NumericalSolutionType instance |
Definition at line 387 of file NumericalSolution.f90.

| subroutine numericalsolutionmodule::allocate_scalars | ( | class(numericalsolutiontype) | this | ) |
|
private |
| this | NumericalSolutionType instance |
Definition at line 2892 of file NumericalSolution.f90.
| class(numericalsolutiontype) function, pointer, public numericalsolutionmodule::castasnumericalsolutionclass | ( | class(*), intent(inout), pointer | obj | ) |
Get a numerical solution from a list.
| [in,out] | obj | generic object |
Definition at line 3366 of file NumericalSolution.f90.

|
private |
Save convergence summary to a File.
| this | NumericalSolutionType instance | |
| [in] | iu | file unit number for summary file |
| [in] | im | model number |
| [in] | itertot_timestep | total iteration for the time step |
Definition at line 2037 of file NumericalSolution.f90.

| subroutine, public numericalsolutionmodule::create_numerical_solution | ( | class(numericalsolutiontype), pointer | num_sol, |
| character(len=*), intent(in) | filename, | ||
| integer(i4b), intent(in) | id | ||
| ) |
Create a new solution using the data in filename, assign this new solution an id number and store the solution in the basesolutionlist. Also open the filename for later reading.
| num_sol | the create solution | |
| [in] | filename | solution input file name |
| [in] | id | solution id |
Definition at line 238 of file NumericalSolution.f90.


| subroutine numericalsolutionmodule::csv_convergence_summary | ( | class(numericalsolutiontype) | this, |
| integer(i4b), intent(in) | iu, | ||
| real(dp), intent(in) | totim, | ||
| integer(i4b), intent(in) | kper, | ||
| integer(i4b), intent(in) | kstp, | ||
| integer(i4b), intent(in) | kouter, | ||
| integer(i4b), intent(in) | niter, | ||
| integer(i4b), intent(in) | istart, | ||
| integer(i4b), intent(in) | kstart | ||
| ) |
Save convergence summary to a comma-separated value file.
| this | NumericalSolutionType instance | |
| [in] | iu | file unit number |
| [in] | totim | total simulation time |
| [in] | kper | stress period number |
| [in] | kstp | time step number |
| [in] | kouter | number of outer (Picard) iterations |
| [in] | niter | number of inner iteration in this time step |
| [in] | istart | starting iteration number for this time step |
| [in] | kstart | starting position in the conv* arrays |
Definition at line 2150 of file NumericalSolution.f90.

| subroutine numericalsolutionmodule::finalizesolve | ( | class(numericalsolutiontype) | this, |
| integer(i4b), intent(in) | kiter, | ||
| integer(i4b), intent(inout) | isgcnvg, | ||
| integer(i4b), intent(in) | isuppress_output | ||
| ) |
Finalize the solution. Called after the outer iteration loop.
| this | NumericalSolutionType instance | |
| [in] | kiter | Picard iteration number after convergence or failure |
| [in,out] | isgcnvg | solution group convergence flag |
| [in] | isuppress_output | flag for suppressing output |
Definition at line 1883 of file NumericalSolution.f90.

|
private |
| this | NumericalSolutionType instance |
Definition at line 2839 of file NumericalSolution.f90.
|
private |
| this | instance of the numerical solution |
Definition at line 2358 of file NumericalSolution.f90.
|
private |
Returns a pointer to the list of models in this solution.
| this | NumericalSolutionType instance |
Definition at line 2326 of file NumericalSolution.f90.
| class(numericalsolutiontype) function, pointer, public numericalsolutionmodule::getnumericalsolutionfromlist | ( | type(listtype), intent(inout) | list, |
| integer(i4b), intent(in) | idx | ||
| ) |
Get a numerical solution from a list.
| [in,out] | list | list of numerical solutions |
| [in] | idx | value to retrieve from the list |
Definition at line 3390 of file NumericalSolution.f90.

|
private |
Prepare for the system solve by advancing the simulation.
| this | NumericalSolutionType instance |
Definition at line 1468 of file NumericalSolution.f90.

| subroutine numericalsolutionmodule::save | ( | class(numericalsolutiontype) | this, |
| character(len=*), intent(in) | filename | ||
| ) |
Save solution ia vector, ja vector , coefficient matrix, right-hand side vector, and the dependent-variable vector to a file.
| this | NumericalSolutionType instance | |
| [in] | filename | filename to save solution data |
Definition at line 2273 of file NumericalSolution.f90.

| subroutine numericalsolutionmodule::sln_ad | ( | class(numericalsolutiontype) | this | ) |
Advance solution.
| this | NumericalSolutionType instance |
Definition at line 1141 of file NumericalSolution.f90.
| subroutine numericalsolutionmodule::sln_ar | ( | class(numericalsolutiontype) | this | ) |
Allocate and read data for a solution.
| this | NumericalSolutionType instance |
Definition at line 535 of file NumericalSolution.f90.

|
private |
Perform backtracking on the solution in the maximum number of backtrack iterations (nbtrack) is greater than 0 and the backtracking criteria are exceeded.
| [in,out] | this | NumericalSolutionType instance |
| mp | model pointer (currently null()) | |
| cp | exchange pointer (currently null()) | |
| [in] | kiter | Picard iteration number |
Definition at line 2719 of file NumericalSolution.f90.
|
private |
Backtracking update of the dependent variable if the calculated backtracking update exceeds the dependent variable closure criteria.
| [in,out] | this | NumericalSolutionType instance |
| [in,out] | bt_flag | backtracking flag (1) backtracking performed (0) backtracking not performed |
Definition at line 2823 of file NumericalSolution.f90.
| subroutine numericalsolutionmodule::sln_buildsystem | ( | class(numericalsolutiontype) | this, |
| integer(i4b), intent(in) | kiter, | ||
| integer(i4b), intent(in) | inewton | ||
| ) |
| subroutine numericalsolutionmodule::sln_ca | ( | class(numericalsolutiontype) | this, |
| integer(i4b), intent(inout) | isgcnvg, | ||
| integer(i4b), intent(in) | isuppress_output | ||
| ) |
Solve the models in this solution for kper and kstp.
| this | NumericalSolutionType instance | |
| [in,out] | isgcnvg | solution group convergence flag |
| [in] | isuppress_output | flag for suppressing output |
Definition at line 1318 of file NumericalSolution.f90.

|
private |
| this | NumericalSolutionType instance |
| iptc | PTC (1) or not (0) |
| ptcf | the PTC factor calculated |
Definition at line 2998 of file NumericalSolution.f90.

|
private |
| this | NumericalSolutionType instance |
| vec_resid | the residual vector |
Definition at line 3028 of file NumericalSolution.f90.
|
private |
Calculate the dependent-variable change for every cell.
| [in,out] | this | NumericalSolutionType instance |
| [in] | neq | number of equations |
| [in] | active | active cell flag (1) |
| [in] | x | current dependent-variable |
| [in] | xtemp | previous dependent-variable |
| [in,out] | dx | dependent-variable change |
Definition at line 2974 of file NumericalSolution.f90.
|
private |
Assign solution connections. This is the main workhorse method for a solution. The method goes through all the models and all the connections and builds up the sparse matrix. Steps are (1) add internal model connections, (2) add cross terms, (3) allocate solution arrays, (4) create mapping arrays, and (5) fill cross term values if necessary.
| this | NumericalSolutionType instance |
Definition at line 2375 of file NumericalSolution.f90.

| subroutine numericalsolutionmodule::sln_da | ( | class(numericalsolutiontype) | this | ) |
Deallocate a solution.
| this | NumericalSolutionType instance |
Definition at line 1200 of file NumericalSolution.f90.
| subroutine numericalsolutionmodule::sln_df | ( | class(numericalsolutiontype) | this | ) |
Define a new solution. Must be called after the models and exchanges have been added to solution. The order of the steps is (1) Allocate neq and nja, (2) Assign model offsets and solution ids, (3) Allocate and initialize the solution arrays, (4) Point each model's x and rhs arrays, and (5) Initialize the sparsematrix instance
| this | NumericalSolutionType instance |
Definition at line 438 of file NumericalSolution.f90.

| subroutine numericalsolutionmodule::sln_dt | ( | class(numericalsolutiontype) | this | ) |
Calculate time step length.
| this | NumericalSolutionType instance |
Definition at line 1099 of file NumericalSolution.f90.

|
private |
Finalize a solution.
| this | NumericalSolutionType instance |
Definition at line 1178 of file NumericalSolution.f90.
|
private |
Determine the maximum dependent-variable change at the end of a Picard iteration.
| [in,out] | this | NumericalSolutionType instance |
| [in,out] | hncg | maximum dependent-variable change |
| [in,out] | lrch | location of the maximum dependent-variable change |
Definition at line 3184 of file NumericalSolution.f90.
|
private |
| this | NumericalSolutionType instance |
Definition at line 2869 of file NumericalSolution.f90.

|
private |
Get the cell location string for the provided solution node number.
| [in,out] | this | NumericalSolutionType instance |
| [in] | nodesln | solution node number |
| [in,out] | str | string with user node number |
Definition at line 3286 of file NumericalSolution.f90.

|
private |
Get the user node number from a model for the provided solution node number.
| [in,out] | this | NumericalSolutionType instance |
| [in] | nodesln | solution node number |
| [in,out] | im | solution model index (index in model list for this solution) |
| [in,out] | nodeu | user node number |
Definition at line 3327 of file NumericalSolution.f90.

|
private |
| this | NumericalSolutionType instance |
| max_dvc | the maximum dependent variable change |
Definition at line 3217 of file NumericalSolution.f90.
|
private |
A = the linear system matrix x = the dependent variable vector b = the right-hand side vector
r = A * x - b
r_i = 0 if cell i is inactive L2norm = || r ||_2
| this | NumericalSolutionType instance |
| l2norm | calculated L-2 norm |
Definition at line 2917 of file NumericalSolution.f90.
|
private |
Solve the linear system of equations. Steps include (1) matrix cleanup, (2) add pseudo-transient continuation terms, and (3) residual reduction.
| [in,out] | this | NumericalSolutionType instance |
Definition at line 2443 of file NumericalSolution.f90.

|
private |
Return the maximum value in a vector using a normalized form.
| this | NumericalSolutionType instance | |
| [in] | nsize | length of vector |
| [in] | v | input vector |
| [in,out] | vmax | maximum value |
Definition at line 2940 of file NumericalSolution.f90.
|
private |
| this | NumericalSolutionType instance | |
| [in] | dxold_max | the maximum dependent variable change for unrelaxed cells |
| [in] | hncg | largest dep. var. change at end of Picard iteration |
Definition at line 3267 of file NumericalSolution.f90.
| subroutine numericalsolutionmodule::sln_ot | ( | class(numericalsolutiontype) | this | ) |
Output solution data. Currently does nothing.
| this | NumericalSolutionType instance |
Definition at line 1166 of file NumericalSolution.f90.
|
private |
| this | NumericalSolutionType instance | |
| [in] | dpak | Newton Under-relaxation flag |
| [in] | cpakout | string with package that caused failure |
| [in] | iend | flag indicating if last inner iteration (iend=1) |
Definition at line 3231 of file NumericalSolution.f90.

| subroutine numericalsolutionmodule::sln_reset | ( | class(numericalsolutiontype) | this | ) |
Reset the solution by setting the coefficient matrix and right-hand side vectors to zero.
| this | NumericalSolutionType instance |
Definition at line 2428 of file NumericalSolution.f90.
|
private |
Set default Picard iteration variables based on passed complexity option.
| [in,out] | this | NumericalSolutionType instance |
| [in] | ifdparam | complexity option (1) simple (2) moderate (3) complex |
Definition at line 2662 of file NumericalSolution.f90.
|
private |
| this | NumericalSolutionType instance | |
| [in] | inewtonur | Newton Under-relaxation flag |
Definition at line 3254 of file NumericalSolution.f90.
|
private |
Under relax using the simple, cooley, or delta-bar-delta methods.
| this | NumericalSolutionType instance | |
| [in] | kiter | Picard iteration number |
| [in] | bigch | maximum dependent-variable change |
| [in] | neq | number of equations |
| [in] | active | active cell flag (1) |
| [in,out] | x | current dependent-variable |
| [in] | xtemp | previous dependent-variable |
Definition at line 3051 of file NumericalSolution.f90.
|
private |
Builds and solve the system for this numerical solution. It roughly consists of the following steps (1) backtracking, (2) reset amat and rhs (3) calculate matrix terms (*_cf), (4) add coefficients to matrix (*_fc), (6) newton-raphson, (6) PTC, (7) linear solve, (8) convergence checks, (9) write output, and (10) underrelaxation
| this | NumericalSolutionType instance | |
| [in] | kiter | Picard iteration number |
Definition at line 1513 of file NumericalSolution.f90.

|
private |
Write header for solver output to comma-separated value files.
| this | NumericalSolutionType instance |
Definition at line 1365 of file NumericalSolution.f90.

|
private |
Write header for pseudo-transient continuation information to a file.
| this | NumericalSolutionType instance | |
| [in] | kper | current stress period number |
Definition at line 1418 of file NumericalSolution.f90.

|
private |
Definition at line 55 of file NumericalSolution.f90.
|
private |
Definition at line 56 of file NumericalSolution.f90.