Scrambler  1
explicit_control.f90
Go to the documentation of this file.
00001 !#########################################################################
00002 !               
00003 !    Copyright (C) 2003-2012 Department of Physics and Astronomy,
00004 !                            University of Rochester,
00005 !                            Rochester, NY
00006 !
00007 !    explicit_control.f90 is part of AstroBEAR.
00008 !
00009 !    AstroBEAR is free software: you can redistribute it and/or modify    
00010 !    it under the terms of the GNU General Public License as published by 
00011 !    the Free Software Foundation, either version 3 of the License, or    
00012 !    (at your option) any later version.
00013 !
00014 !    AstroBEAR is distributed in the hope that it will be useful, 
00015 !    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 !    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 !    GNU General Public License for more details.
00018 !
00019 !    You should have received a copy of the GNU General Public License
00020 !    along with AstroBEAR.  If not, see <http://www.gnu.org/licenses/>.
00021 !
00022 !#########################################################################
00023 MODULE ExplicitControl
00024 
00025   USE GlobalDeclarations
00026   USE ResistiveSrc
00027   USE ConductiveSrc
00028   USE BViscositySrc
00029   USE PhysicsDeclarations
00030   USE ExplicitDeclarations
00031   IMPLICIT NONE
00032 
00033 CONTAINS
00034   
00036   SUBROUTINE ExplicitInit
00037     ALLOCATE(explicit_maxspeed(0:maxlevel))
00038     explicit_maxspeed=0d0
00039   END SUBROUTINE ExplicitInit
00040 
00042   SUBROUTINE InitialExplicit(n)
00043     INTEGER :: n
00044 
00045     CALL ExplicitGetMaxSpeed(n)
00046 
00047   END SUBROUTINE InitialExplicit
00048   
00050   SUBROUTINE Explicit(n)
00051     INTEGER :: i,n,nmax,nsteps,stepping   
00052 
00053     stepping = 1; nmax=MaxLevel; nsteps=0
00054 
00055     DO i=0,n
00056        nsteps=nsteps+(levels(i)%step-1)*2**(nmax-i)
00057     END DO
00058 
00059     nsteps=mod(nsteps,6)
00060 
00061     SELECT CASE(nsteps)
00062 
00063     CASE(0)
00064        !PRINT*, "explicit case 0 called"
00065        IF(lResistive) THEN 
00066           CALL ResistiveGridAdvance(n,stepping)
00067           stepping=stepping+1
00068        END IF
00069        IF(lConductive) THEN
00070           CALL ConductiveGridAdvance(n,stepping)
00071           stepping=stepping+1
00072        END IF
00073        IF(lViscous)THEN
00074           CALL BViscosityGridAdvance(n,stepping)
00075        END IF
00076 
00077     CASE(1)
00078        !PRINT*, "explicit case 1 called"
00079        IF(lConductive) THEN
00080           CALL ConductiveGridAdvance(n,stepping)
00081           stepping=stepping+1
00082        END IF
00083        IF(lResistive) THEN 
00084           CALL ResistiveGridAdvance(n,stepping)
00085           stepping=stepping+1
00086        END IF
00087        IF(lViscous)THEN
00088           CALL BViscosityGridAdvance(n,stepping)
00089        END IF
00090 
00091     CASE(2)
00092        !PRINT*, "explicit case 2 called"
00093        IF(lConductive) THEN
00094           CALL ConductiveGridAdvance(n,stepping)
00095           stepping=stepping+1
00096        END IF
00097        IF(lViscous)THEN
00098           CALL BViscosityGridAdvance(n,stepping)
00099           stepping=stepping+1
00100        END IF
00101        IF(lResistive) THEN 
00102           CALL ResistiveGridAdvance(n,stepping)
00103        END IF
00104 
00105     CASE(3)
00106        !PRINT*, "explicit case 3 called"
00107        IF(lResistive) THEN 
00108           CALL ResistiveGridAdvance(n,stepping)
00109           stepping=stepping+1
00110        END IF
00111        IF(lViscous)THEN
00112           CALL BViscosityGridAdvance(n,stepping)
00113           stepping=stepping+1
00114        END IF
00115        IF(lConductive) THEN
00116           CALL ConductiveGridAdvance(n,stepping)
00117        END IF
00118 
00119     CASE(4)
00120        !PRINT*, "explicit case 4 called"
00121        IF(lViscous)THEN
00122           CALL BViscosityGridAdvance(n,stepping)
00123           stepping=stepping+1
00124        END IF
00125        IF(lResistive) THEN 
00126           CALL ResistiveGridAdvance(n,stepping)
00127           stepping=stepping+1
00128        END IF
00129        IF(lConductive) THEN
00130           CALL ConductiveGridAdvance(n,stepping)
00131        END IF
00132 
00133     CASE(5)
00134        !PRINT*, "explicit case 5 called"
00135        IF(lViscous)THEN
00136           CALL BViscosityGridAdvance(n,stepping)
00137           stepping=stepping+1
00138        END IF
00139        IF(lConductive) THEN
00140           CALL ConductiveGridAdvance(n,stepping)
00141           stepping=stepping+1
00142        END IF
00143        IF(lResistive) THEN 
00144           CALL ResistiveGridAdvance(n,stepping)
00145        END IF
00146 
00147    END SELECT
00148 
00149   END SUBROUTINE Explicit
00150 
00152   SUBROUTINE ExplicitGetMaxSpeed(n)
00153     INTEGER :: n
00154     IF(lResistive)  CALL ResistiveGridGetMaxSpeed(n)
00155     IF(lConductive) CALL ConductiveGridGetMaxSpeed(n)
00156     IF(lViscous)    CALL BViscosityGridGetMaxSpeed(n)
00157 
00158   END SUBROUTINE ExplicitGetMaxSpeed
00159   
00160   
00161 END MODULE ExplicitControl
 All Classes Files Functions Variables