Scrambler  1
processing_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 !    processing_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 !#########################################################################
00025 
00028 
00031 
00035 
00038 
00039 MODULE ProcessingControl
00040   USE DataDeclarations
00041   USE TreeDeclarations
00042   USE ProcessingDeclarations
00043   USE DataLevelOps
00044 # if defined HYPRE
00045   USE EllipticControl
00046 # endif
00047   USE Totals
00048   USE Histograms
00049   USE PDFs
00050   USE Projections
00051   USE Spectras
00052   USE Timing
00053   IMPLICIT NONE
00054   PRIVATE
00055   PUBLIC ProcessInit, ProcessData
00056   SAVE
00057 
00058 CONTAINS
00061 
00063   SUBROUTINE ProcessInit()
00064      INTEGER :: iErr
00065      NrDiagnosticVars=0
00066      CALL TotalInit()
00067      CALL HistogramInit()
00068      CALL PDFInit()
00069      CALL ProjectionInit()
00070      CALL SpectraInit()
00071   END SUBROUTINE ProcessInit
00072 
00073   SUBROUTINE ProcessData
00074      INTEGER :: n
00075      TYPE(NodeDef), POINTER :: node
00076      TYPE(NodeDefList), POINTER :: nodelist
00077      TYPE(InfoDef), POINTER :: Info
00078      CALL StartTimer(iProcessData, -2)
00079      IF (Processing_mbc > 0) THEN !Need to ghost cells...
00080         DO n=0, MaxLevel
00081            CALL GenericTransfer(n, GCopyFields, Processing_mbc, lHydroPeriodic)
00082            IF (EGVars > 0) CALL GenericTransfer(n, EGCopyFields, Processing_mbc, lEllipticPeriodic)
00083            CALL ApplyPhysicalBCs(n)
00084 # if defined HYPRE           
00085            CALL ApplyEllipticBC(n)
00086 # endif
00087         END DO
00088      END IF
00089 
00090      IF (NrDiagnosticVars > 0) THEN        
00091         DO n=0, MaxLevel
00092            nodelist=>Nodes(n)%p
00093            DO WHILE (associated(nodelist))
00094               node=>nodelist%self
00095               info=>node%info
00096               ALLOCATE(Info%diagnostics(1:Info%mX(1),1:Info%mX(2),1:Info%mX(3),1:NrDiagnosticVars))
00097               CALL ProcessDiagnostics(Info)
00098               nodelist=>nodelist%next
00099            END DO
00100         END DO
00101      END IF
00102 
00103      CALL ProcessTotals
00104      CALL ProcessHistograms
00105      CALL ProcessPDFs
00106      CALL ProcessProjections
00107      CALL ProcessSpectras
00108      CALL StopTimer(iProcessData, -2)
00109   END SUBROUTINE ProcessData
00110 
00111 
00112 
00113   SUBROUTINE ProcessDiagnostics(Info)
00114      TYPE(InfoDef) :: Info
00115      TYPE(DiagnosticListDef), POINTER :: Diagnostic
00116      INTEGER :: i,j,k,m
00117      REAL(KIND=qPREC) :: x,y,z,dx
00118      Diagnostic=>FirstDiagnostic
00119      m=1
00120      dx=levels(Info%level)%dx
00121      DO WHILE (ASSOCIATED(Diagnostic))
00122         DO i=1,Info%mX(1)
00123            x=Info%xBounds(1,1)+(REAL(i)-half)*dx
00124            DO j=1,Info%mX(2)
00125               y=Info%xBounds(2,1)+(REAL(j)-half)*merge(dx,0d0,nDim >= 2)
00126               DO k=1,Info%mX(3)
00127                  z=Info%xBounds(2,1)+(REAL(k)-half)*merge(dx,0d0,nDim >= 3)
00128                  Info%diagnostics(i,j,k,m) = GetField(Info,i,j,k,Diagnostic%Field%id, (/x,y,z/))
00129               END DO
00130            END DO
00131         END DO
00132         m=m+1
00133         Diagnostic=>Diagnostic%next
00134      END DO
00135   END SUBROUTINE ProcessDiagnostics
00136 END MODULE ProcessingControl
00137 
00138            
00139 !        IF (lStoreOI) CALL ProcessEmissions(iOI)
00140 !        IF (lStoreNII) CALL ProcessEmissions(iNII)
00141 !        IF (lStoreSII_6716) CALL ProcessEmissions(iSII_6716)
00142 !        IF (lStoreSII_6731) CALL ProcessEmissions(iSII_6731)
00143 !        IF (lStoreHalpha) CALL ProcessEmissions(iHalpha)
 All Classes Files Functions Variables