File: N:\mfix\model\mfix.f

1     ! -*- f90 -*-
2     !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
3     !                                                                      !
4     !  Subroutine: MFIX                                                    !
5     !  Author: M. Syamlal                                 Date: 29-JAN-92  !
6     !                                                                      !
7     !  Purpose: The main module in the MFIX program                        !
8     !                                                                      !
9     !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
10     !
11     !> \mainpage Multiphase Flow with Interphase eXchanges
12     !!
13     !! MFIX is a general-purpose computer code developed at the National
14     !! Energy Technology Laboratory, NETL, for describing the hydrodynamics,
15     !! heat transfer, and chemical reactions in fluid-solid systems.
16     !!
17     !! It has been used for describing bubbling and circulating fluidized
18     !! beds and spouted beds. MFiX calculations give transient data on the
19     !! three-dimensional distribution of pressure, velocity, temperature,
20     !! and species mass fractions. MFiX code is based on a generally
21     !! accepted set of multiphase flow equations. The code is used as a
22     !! "test-stand" for testing and developing multiphase flow constitutive
23     !!  equations.
24     !!
25     !! \section Notice
26     !! Neither the United States Government nor any agency thereof, nor any
27     !! of their employees, makes any warranty, expressed or implied, or
28     !! assumes any legal liability or responsibility for the accuracy,
29     !! completeness, or usefulness of any information, apparatus, product,
30     !! or process disclosed or represents that its use would not infringe
31     !! privately owned rights.
32     !!
33     !! * MFIX is provided without any user support for applications in the
34     !!   user's immediate organization. It should not be redistributed in
35     !!   whole or in part.
36     !!
37     !! * The use of MFIX is to be acknowledged in any published paper based
38     !!   on computations using this software by citing the MFIX theory
39     !!   manual. Some of the submodels are being developed by researchers
40     !!   outside of NETL. The use of such submodels is to be acknowledged
41     !!   by citing the appropriate papers of the developers of the submodels.
42     !!
43     !! * The authors would appreciate receiving any reports of bugs or other
44     !!   difficulties with the software, enhancements to the software, and
45     !!   accounts of practical applications of this software.
46     !!
47     !! \section Disclaimer
48     !! This report was prepared as an account of work sponsored by an agency
49     !! of the United States Government. Neither the United States Government
50     !! nor any agency thereof, nor any of their employees, makes any
51     !! warranty, express or implied, or assumes any legal liability or
52     !! responsibility for the accuracy, completeness, or usefulness of any
53     !! information, apparatus, product, or process disclosed, or represents
54     !! that its use would not infringe privately owned rights. Reference
55     !! herein to any specific commercial product, process, or service by
56     !! trade name, trademark, manufacturer, or otherwise does not
57     !! necessarily constitute or imply its endorsement, recommendation, or
58     !! favoring by the United States Government or any agency thereof. The
59     !! views and opinions of authors expressed herein do not necessarily
60     !! state or reflect those of the United States Government or any
61     !! agency thereof.
62     
63           PROGRAM MFIX
64     
65     !-----------------------------------------------
66     ! Modules
67     !-----------------------------------------------
68           USE DISCRETELEMENT, ONLY: DES_CONTINUUM_COUPLED, DISCRETE_ELEMENT
69           USE ITERATE, ONLY: CONVERGED, DIVERGED, ADJUSTDT
70           USE ITERATE, ONLY: ITERATE_INIT, DO_ITERATION, POST_ITERATE
71           USE ITERATE, ONLY: LOG_CONVERGED, LOG_DIVERGED, NIT, MAX_NIT
72           USE MAIN, ONLY: ADD_COMMAND_LINE_ARGUMENT, INITIALIZE, FINALIZE, EXIT_SIGNAL
73           USE RUN, ONLY:  DT, IER, DEM_SOLIDS, PIC_SOLIDS, STEADY_STATE, TIME, TSTOP
74           USE STEP, ONLY: TIME_STEP_INIT, TIME_STEP_END
75     
76           IMPLICIT NONE
77     
78     !-----------------------------------------------
79     ! Local variables
80     !-----------------------------------------------
81     
82           INTEGER :: II
83           CHARACTER(LEN=80) :: tmp
84     
85           DO II=1, COMMAND_ARGUMENT_COUNT()
86              CALL GET_COMMAND_ARGUMENT(II,tmp)
87              CALL ADD_COMMAND_LINE_ARGUMENT(tmp)
88           ENDDO
89     
90     ! Initialize the simulation
91           CALL INITIALIZE
92     
93     ! Time march loop.
94     
95           IF(DISCRETE_ELEMENT .AND. .NOT.DES_CONTINUUM_COUPLED) THEN
96     
97     ! Uncoupled discrete element simulations
98              IF (DEM_SOLIDS) CALL DES_TIME_MARCH
99              IF (PIC_SOLIDS) CALL PIC_TIME_MARCH
100     
101           ELSE
102     
103     ! Transient or steady state simulation
104              DO WHILE (TIME + 0.1d0*DT < TSTOP .AND. .NOT. EXIT_SIGNAL)
105                 CALL TIME_STEP_INIT
106                 DO
107                    CALL ITERATE_INIT
108                    DO WHILE (NIT<MAX_NIT .AND. .NOT.(CONVERGED.OR.DIVERGED))
109                       NIT = NIT + 1
110                       CALL DO_ITERATION
111                    ENDDO
112     
113                    CALL POST_ITERATE
114     
115                    IF(STEADY_STATE) EXIT
116                    IF(.NOT.ADJUSTDT()) EXIT
117                 ENDDO
118                 CALL TIME_STEP_END
119                 IF (STEADY_STATE) EXIT
120              ENDDO
121     
122           ENDIF
123           CALL FINALIZE
124     
125           STOP
126           END PROGRAM MFIX
127