MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
SolutionFactory.F90
Go to the documentation of this file.
2  use kindmodule, only: i4b
3  use simmodule, only: ustop
9 #if defined(__WITH_MPI__)
11 #endif
12 
13  implicit none
14  private
15 
16  public :: create_ims_solution
17  public :: create_ems_solution
18 
19 contains
20 
21  !> @brief Create an IMS solution of type NumericalSolution
22  !! for serial runs or its sub-type ParallelSolution for
23  !< parallel runs. Returns the base pointer.
24  function create_ims_solution(sim_mode, filename, sol_id) result(base_sol)
25  character(len=*) :: sim_mode
26  character(len=*) :: filename
27  integer(I4B) :: sol_id
28  class(basesolutiontype), pointer :: base_sol
29  class(numericalsolutiontype), pointer :: num_sol => null()
30 #if defined(__WITH_MPI__)
31  class(parallelsolutiontype), pointer :: par_sol => null()
32 #endif
33 
34  if (sim_mode == 'SEQUENTIAL') then
35  allocate (num_sol)
36 #if defined(__WITH_MPI__)
37  else if (sim_mode == 'PARALLEL') then
38  allocate (par_sol)
39  num_sol => par_sol
40 #endif
41  else
42  call ustop('Unsupported simulation mode for creating solution: '&
43  &//trim(sim_mode))
44  end if
45 
46  call create_numerical_solution(num_sol, filename, sol_id)
47  base_sol => num_sol
48 
49  end function create_ims_solution
50 
51  !> @brief Create an EMS solution of type ExplicitSolution
52  !! for serial runs or its sub-type ParallelSolution for
53  !< parallel runs. Returns the base pointer.
54  function create_ems_solution(sim_mode, filename, sol_id) result(base_sol)
55  character(len=*) :: sim_mode
56  character(len=*) :: filename
57  integer(I4B) :: sol_id
58  class(basesolutiontype), pointer :: base_sol
59  class(explicitsolutiontype), pointer :: exp_sol => null()
60 !#if defined(__WITH_MPI__)
61 ! class(ParallelSolutionType), pointer :: par_sol => null()
62 !#endif
63 
64  if (sim_mode == 'SEQUENTIAL') then
65  allocate (exp_sol)
66 !#if defined(__WITH_MPI__)
67 ! else if (sim_mode == 'PARALLEL') then
68 ! allocate (par_sol)
69 ! exp_sol => par_sol
70 !#endif
71  else
72  call ustop('Unsupported simulation mode for creating solution: '&
73  &//trim(sim_mode))
74  end if
75 
76  call create_explicit_solution(exp_sol, filename, sol_id)
77  base_sol => exp_sol
78 
79  end function create_ems_solution
80 
81 end module
Explicit Solution Module.
subroutine, public create_explicit_solution(exp_sol, filename, id)
@ brief Create a new solution
This module defines variable data types.
Definition: kind.f90:8
subroutine, public create_numerical_solution(num_sol, filename, id)
@ brief Create a new solution
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public ustop(stopmess, ioutlocal)
Stop the simulation.
Definition: Sim.f90:315
class(basesolutiontype) function, pointer, public create_ims_solution(sim_mode, filename, sol_id)
Create an IMS solution of type NumericalSolution for serial runs or its sub-type ParallelSolution for...
class(basesolutiontype) function, pointer, public create_ems_solution(sim_mode, filename, sol_id)
Create an EMS solution of type ExplicitSolution for serial runs or its sub-type ParallelSolution for.
Manages and solves explicit models.