cmain.htm

C.... File name ............... MAIN.HTM ........................ 031103
C   THIS IS THE MAIN PROGRAM OF EARTH
C
C   (C) COPYRIGHT 1984, 1985, etc to 2002
C   CONCENTRATION HEAT AND MOMENTUM LTD. ALL RIGHTS RESERVED.
C   This subroutine and the remainder of the PHOENICS code are
C   proprietary software owned by Concentration Heat and Momentum
C   Limited, 40 High Street, Wimbledon, London SW19 5AU, England.
C
      SUBROUTINE MAIN0(NFDIM1)
C.... Commons for monitoring
      INCLUDE '/phoenics/d_includ/gxmarr'
C
C 2   NPNAM - Sets the dimension of the patch-name array. WARNING: this
C     is dynamically allocated at run-time.
C
C 3   NPVDM - If more than 30 PATCH-wise variables are required NPVDM
C     should be increased and the common block /LBPV/ in the INCLUDE
C     file /phoenics/d_includ/grdloc should be lengthened.
C
C 4   NLG, NIG, NRG and NCG - Dimensions of data-for-GROUND arrays.
C     WARNING: the corresponding arrays in the MAIN program of the
C     satellite (see SATLIT) must have the same dimensions.
C
C 5   NLSG, NISG, NRSG and NCSG - Dimensions of data-for-GREX arrays.
C     WARNING: the corresponding arrays in the MAIN program of the
C     satellite (see SATLIT) must have the same dimensions.
C
C 6   NUMPHI - This parameter, which appears identically in the
C     satellite MAIN program, allows up to 50 dependent variables to
C     be solved for (or their storage spaces to be occupied by other
C     variables, such as density). If a larger number is required,
C     NUMPHI should be reset to the required larger number. Numbers
C     smaller than 50 are not permitted.
C
C 9   NMOTMX - Set the maximum number of the VR object classes. The user
C     may increase it to introduce his/her own classes for VR objects.
C     In this case he/she MUST provide the appropriate treatment of new
C     objects through GROUND coding. NMCHAM is the default number of VR
C     classes defined and supported by CHAM (set internally).
C
C 11  NELMPHI=5  number of ele. per PHI stored per cut-cell. Do not change
C
C 12  MXR2I=8000000  max integer number stored in real f(). Do not change
C
C 13  MAXPLT=200000 maximum number of points stored for graphical convergence
C     monitor plot
C
C 15  NSPM=5000 size of the SPEDAT arrays
C
C  CHEMKIN/TRANLIB Databases and work-space: The arrays associated with these  
C     parameters are allocated dynamically at run-time.
      PARAMETER (NCMR=0,NCMI=0,NCMC=0,NCML=0)
C***********************************************************************
C
      PARAMETER ( NFDIM=0)
      PARAMETER ( NPNAM=0, NPVDM=30, NMOTMX=20 )
      PARAMETER ( NLG =100, NIG =200, NRG =200, NCG =100 )
      PARAMETER ( NLSG=100, NISG=100, NRSG=150, NCSG=10 )
      PARAMETER ( NUMPHI=150 )
c      PARAMETER ( NDM=0, NDMB=0, NSPM=5000, NLWRK= 0 )
      PARAMETER ( NDM=0, NDMB=0, NSPM=0, NLWRK= 0 )
      PARAMETER ( NFGV=0)
      PARAMETER ( NELMPHI=5 )     ! number of ele. per PHI stored per cut-cell
      PARAMETER ( MAXR2I=8000000) ! max integer number stored in real f()
c      PARAMETER ( MAXPLT=20000)   ! now set in include file gxmarr above
      PARAMETER ( MAXMBD=0)     ! Maximum number of MBD patches
      PARAMETER ( NFACET=0)
      INCLUDE '/phoenics/d_includ/pltcfile'
C
C***********************************************************************
C
      PARAMETER ( NM=NUMPHI, NM4=NM*4, NMB=NDM*NDMB ,MXMBD6=MAXMBD*6)
C
      COMMON/CMOBTP/OBJTYP(NMOTMX) /CMNOTP/NMOTYP,NMCHAM
C
      COMMON/INDPV/NPVMX,NIMAX,NITOT,L0PV(NPVDM)
C
      COMMON/LGRND/LG(NLG)/IGRND/IG(NIG)/RGRND/RG(NRG)/CGRND/CG(NCG)
      COMMON/LSG/LSGD(NLSG)/ISG/ISGD(NISG)/RSG/RSGD(NRSG)/CSG/CSGD(NCSG)
C
      COMMON/LGE4/L4(NM)/LDB1/L5(NM)/IDA1/I1(NM)/IDA2/I2(NM)/IDA3/I3(NM)
     1 /IDA4/I4(NM)/IDA5/I5(NM)/IDA6/I6(NM)/GI1/I7(NM)/GI2/I8(NM)/HDA1
     1 /IH1(NM)/GH1/IH2(NM)/RDA1/R1(NM)/RDA2/R2(NM)/RDA3/R3(NM)/RDA4
     1 /R4(NM)/RDA5/R5(NM)/RDA6/R6(NM)/RDA7/R7(NM)/RDA8/R8(NM)/RDA9
     1 /R9(NM)/RDA10/R10(NM)/RDA11/R11(NM)/GR1/R12(NM)/
     1       GR4/R15(NM)/RDA16/R16(NM)/IPIP1/IP1(NM)/HPIP2/IHP2(NM)
     1 /RPIP1/RVAL(NM)/LPIP1/LVAL(NM)/IFPL/IPL0(NM)/RFPL1/ORPRIN(NM)
     1 /RFPL2/ORMAX(NM)/RFPL3/ORMIN(NM)/IDA7/ID7(NM)/IDA8/ID8(NM)
     1 /IDA9/ID9(NM)/IDA10/ID10(NM)/IDASOL/IDSL(NM)/IDASCH/IDSC(NM)
     1 /PLCMN1/PLOTNM(NM)/RFPL4/CELAV(NM)
     1 /PARA1/ MYNAME(NM) /PARA2/ MYSTOR(NM)
      COMMON/F01/I9(NM4)
C
      COMMON/DISC/DBGFIL
      COMMON /DOMINF/NDOM,NDMX,NDMBMX
      COMMON /SPEDAI/NSPMAX,NSPEDA
C... Commons from CHEMKIN
      COMMON /CKMIND/ NDCMI,NDCMR,NDCMC,NDCML
c... Commons from OBJECT
      COMMON /LIMDEF/MAXLMS
      COMMON /INTDMN/IDMN,NUMDMN,NXMAX,NYMAX,NZMAX,NXYMAX,NXYZMX,NCLTOT,
     1               NDOMMX
C.... Commons from FGEMCB
      COMMON /LNKFGE1/ IFGLNK(1),NLINKEL,NFGDM,NELEPHI,MXRL2INT
C.... Commons from GBFSCB
      COMMON /GBFSM1/ NGBDM,MXMBD6M,MAXBDM,NGBL
C.... Commons for monitoring
c      COMMON /PLCMN2/MXPLT,PLOTRA(MAXPLT)
c      COMMON /PLCMN3/PLOTSA(MAXPLT)
C.... Declarations:
C
      LOGICAL      DBGFIL,L4,L5,LG,LSGD,LVAL
      CHARACTER*4  CG,CSGD,IH1,IH2,IHP2,MYNAME
      CHARACTER*14 OBJTYP
      CHARACTER*4 PLOTNM
C+++ mimd start
      INCLUDE '/phoenics/d_includ/parear'
      COMMON/CSAVSP/SAVSEP
      LOGICAL SAVSEP
      COMMON/WQSTOP/IWQSTOP
      common/dbe/dbear
      logical dbear
c----------------------------------------------------------------      
      dbear=.false.
      open(61,file='dbear',status='old',err=111)
      dbear=.true.
  111 CONTINUE
!!!!!!!!      CALL PARMAN(NFDIM0)
      NSPMAX=NSPM
c+++ mimd end
C.... Memory allocation if available
      NFDIM2=ITWO(NFDIM1,0,NFDIM1.NE.0)
      IF(NFDIM2.EQ.0) CALL GETMEM(NFDIM1,NFDIM2,2)
C
      CALL SUB4( NPVMX,NPVDM, NIMAX,NPVDM, NMOTYP,NMOTMX,NDOMMX,NFGV )
      CALL SUB4( NDOM,0, NDMX,NDM, NDMBMX,NDMB, MAXLMS,0)
      CALL SUB3( NELEPHI,NELMPHI, MXRL2INT,MAXR2I, MXPLT,MAXPLT)
      CALL SUB3( MAXBDM,MAXMBD,NGBL,MXMBD6, MAXFCT,NFACET)
      CALL SUB4( NDCMR,NCMR, NDCMI,NCMI, NDCMC,NCMC, NDCML,NCML)
C... Read configuration file
      CALL CNFGZZ(2)
C**********************************************************
      IF (MIMD .AND. NPROC .GT. 1) THEN
!---VIA(New PPH) 300304 ---
!!!        CALL EDSUBD(NFDIM2,NUMPHI,NLSG,NISG,NRSG,NCSG,NLG,NIG,NRG,
!!!     1              NCG,NPNAM)
        CALL CreatePSD(NFDIM2) 
!---VIA(New PPH) 300304 ---

        SAVSEP=LG(1)
!!!!!!        IF(IWQSTOP.EQ.1) RETURN
      ENDIF
C**********************************************************
      CALL EARSET(1)
      CALL OPENFL(6)
      if(dbear) write(61,*) 'main before main1'
      CALL MAIN1(NFDIM2,NUMPHI,NLSG,NISG,NRSG,NCSG,NLG,NIG,NRG,NCG,
     1           NPNAM)
      CLOSE(61,IOSTAT=IOS)
      CLOSE(62,IOSTAT=IOS)
      CLOSE(63,IOSTAT=IOS)
      END
c