CVFOnlyRoutines.f90 Source File

This File Depends On

sourcefile~~cvfonlyroutines.f90~~EfferentGraph sourcefile~cvfonlyroutines.f90 CVFOnlyRoutines.f90 sourcefile~dataglobals.f90 DataGlobals.f90 sourcefile~dataglobals.f90->sourcefile~cvfonlyroutines.f90 sourcefile~dataprecisionglobals.f90 DataPrecisionGlobals.f90 sourcefile~dataprecisionglobals.f90->sourcefile~cvfonlyroutines.f90 sourcefile~dataprecisionglobals.f90->sourcefile~dataglobals.f90
Help

Source Code


Source Code

SUBROUTINE Get_Environment_Variable(EnvName,EnvValue) !,EnvLength,EnvStatus,EnvTrim)

          ! SUBROUTINE INFORMATION:
          !       AUTHOR         Linda Lawrie
          !       DATE WRITTEN   May 2006
          !       MODIFIED       na
          !       RE-ENGINEERED  na

          ! PURPOSE OF THIS SUBROUTINE:
          ! Use often implemented extension routine "GetEnv" to mimic the
          ! F2003 standard "Get_Environment_Variable".

          ! METHODOLOGY EMPLOYED:
          ! na

          ! REFERENCES:
          ! na

          ! USE STATEMENTS:
  USE DFPORT

  IMPLICIT NONE ! Enforce explicit typing of all variables in this routine

          ! SUBROUTINE ARGUMENT DEFINITIONS:
  CHARACTER(len=*), INTENT(IN) :: EnvName  ! name of environment variable
  CHARACTER(len=*), INTENT(OUT), OPTIONAL :: EnvValue ! result of request
!  INTEGER, INTENT(OUT), OPTIONAL :: EnvLength ! Length of Value (in characters)
!  INTEGER, INTENT(OUT), OPTIONAL :: EnvStatus ! 0 if variable exists/assigned a value,
!                                              ! 1 if variable does not exist
!                                              ! 2 or greater -- processor/compiler dependent
!  LOGICAL, INTENT(IN),  OPTIONAL :: EnvTrim ! false if trailing blanks are significant

          ! SUBROUTINE PARAMETER DEFINITIONS:
          ! na

          ! INTERFACE BLOCK SPECIFICATIONS:
          ! na

          ! DERIVED TYPE DEFINITIONS:
          ! na

          ! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
  CHARACTER(len=255) :: Value

  CALL GetEnv(EnvName,Value)
  IF (PRESENT(EnvValue)) EnvValue=Value
!  IF (PRESENT(EnvLength)) EnvLength=Len_Trim(Value)
!  IF (PRESENT(EnvStatus) .and. Value /= ' ') THEN
!    EnvStatus=0
!  ELSE
!    EnvStatus=1
!  ENDIF

  RETURN

END SUBROUTINE Get_Environment_Variable

FUNCTION COMMAND_ARGUMENT_COUNT() RESULT(NumArgs)

          ! FUNCTION INFORMATION:
          !       AUTHOR         Linda Lawrie
          !       DATE WRITTEN   Feb 2007
          !       MODIFIED       na
          !       RE-ENGINEERED  na

          ! PURPOSE OF THIS FUNCTION:
          ! Use often implemented extension routine "GetEnv" to mimic the
          ! F2003 standard "Command_Argument_Count".

          ! METHODOLOGY EMPLOYED:
          ! na

          ! REFERENCES:
          ! na

          ! USE STATEMENTS:
  USE DFLIB

  IMPLICIT NONE ! Enforce explicit typing of all variables in this routine

          ! FUNCTION ARGUMENT DEFINITIONS:
  INTEGER :: numargs

          ! FUNCTION PARAMETER DEFINITIONS:
          ! na

          ! INTERFACE BLOCK SPECIFICATIONS:
          ! na

          ! DERIVED TYPE DEFINITIONS:
          ! na

          ! FUNCTION LOCAL VARIABLE DECLARATIONS:
          ! na

  numargs=NARGS()-1

  RETURN

END FUNCTION COMMAND_ARGUMENT_COUNT

SUBROUTINE GET_COMMAND(command,length,status)

          ! SUBROUTINE INFORMATION:
          !       AUTHOR         Linda Lawrie
          !       DATE WRITTEN   Feb 2007
          !       MODIFIED       na
          !       RE-ENGINEERED  na

          ! PURPOSE OF THIS SUBROUTINE:
          ! <description>

          ! METHODOLOGY EMPLOYED:
          ! <description>

          ! REFERENCES:
          ! na

          ! USE STATEMENTS:
  USE DFLIB

  IMPLICIT NONE ! Enforce explicit typing of all variables in this routine

          ! SUBROUTINE ARGUMENT DEFINITIONS:
  CHARACTER(len=*), OPTIONAL :: command
  INTEGER, OPTIONAL :: length
  INTEGER, OPTIONAL :: status

          ! SUBROUTINE PARAMETER DEFINITIONS:
          ! na

          ! INTERFACE BLOCK SPECIFICATIONS:
          ! na

          ! DERIVED TYPE DEFINITIONS:
          ! na

          ! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
  INTEGER :: numargs
  CHARACTER(len=255) :: commandline
  CHARACTER(len=100) :: carg
  INTEGER :: arg

  numargs=NARGS()-1
  commandline=' '
  do arg=0,numargs
    call get_command_argument(arg,carg)
    if (arg == 0) then
      commandline=carg
    else
      commandline=' '//trim(commandline)//carg
    endif
  enddo

  if (present(command)) then
    command=commandline
  endif
  if (present(length)) then
    length=len_trim(commandline)
  endif
  if (present(status)) then
    status = -1  ! not exactly correct
  endif

  RETURN

END SUBROUTINE GET_COMMAND

SUBROUTINE GET_COMMAND_ARGUMENT(n,value,length,status)

          ! SUBROUTINE INFORMATION:
          !       AUTHOR         Linda Lawrie
          !       DATE WRITTEN   Feb 2007
          !       MODIFIED       na
          !       RE-ENGINEERED  na

          ! PURPOSE OF THIS SUBROUTINE:
          ! <description>

          ! METHODOLOGY EMPLOYED:
          ! <description>

          ! REFERENCES:
          ! na

          ! USE STATEMENTS:
  USE DFLIB

  IMPLICIT NONE ! Enforce explicit typing of all variables in this routine

          ! SUBROUTINE ARGUMENT DEFINITIONS:
  INTEGER :: n
  CHARACTER(len=*), OPTIONAL :: value
  INTEGER, OPTIONAL :: length
  INTEGER, OPTIONAL :: status

          ! SUBROUTINE PARAMETER DEFINITIONS:
          ! na

          ! INTERFACE BLOCK SPECIFICATIONS:
          ! na

          ! DERIVED TYPE DEFINITIONS:
          ! na

          ! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
  INTEGER*2 getarg_n
  CHARACTER(len=255) getarg_buffer
  INTEGER*2 getarg_status

  getarg_n=n

  CALL GETARG(getarg_n,getarg_buffer,getarg_status)

  if (present(value)) then
    value=getarg_buffer
  endif
  if (present(length)) then
    if (getarg_status > 0) then
      length=getarg_status
    else
      length=0
    endif
  endif
  if (present(status)) then
    if (getarg_status < 0) then
      status=10
    elseif (getarg_status > 0) then
      status=-1
    else
      status=0
    endif
  endif

  RETURN

END SUBROUTINE GET_COMMAND_ARGUMENT

FUNCTION ERF(Var1) RESULT(ErfValue)

          ! FUNCTION INFORMATION:
          !       AUTHOR         Craig Wray, LBNL
          !       DATE WRITTEN   25Aug2010
          !       MODIFIED       na
          !       RE-ENGINEERED  na

          ! PURPOSE OF THIS FUNCTION:
          ! Given the independent variable, returns the value of the error function

          ! METHODOLOGY EMPLOYED:
          ! na

          ! REFERENCES:
          ! Geelen, B.D. 1993. "Technical Note: An Accurate Solution FORTRAN Algorithm for the erf
          ! and Related Error Functions", Advances in Engineering Software, 18, pp.67-71

          ! USE STATEMENTS:
   USE DataPrecisionGlobals
   USE DataGlobals, ONLY: PI

   IMPLICIT NONE    ! Enforce explicit typing of all variables in this routine

          ! FUNCTION ARGUMENT DEFINITIONS:
   REAL(r64), INTENT (IN) :: Var1        ! 1st independent variable (x) [-]
   REAL(r64)              :: ErfValue    ! Error function result [-]

          ! FUNCTION PARAMETER DEFINITIONS:
   REAL(r64), PARAMETER ::   F12 = 132.d0 * 3628800.d0 ! Twelve factorial [-]

          ! INTERFACE BLOCK SPECIFICATIONS
          ! na

          ! DERIVED TYPE DEFINITIONS
          ! na

          ! FUNCTION LOCAL VARIABLE DECLARATIONS:
   INTEGER   :: SumTermID !Summation term counter (integer) [-]
   INTEGER   :: AN
!   REAL(r64) :: AN        !Term counter (double precision) [-]
   REAL(r64) :: FACT      !Factorial number [-]
   REAL(r64) :: A1        !Numerator term 1 [-]
   REAL(r64) :: A2        !Numerator term 2 power [-]
   REAL(r64) :: A3        !Numerator [-]
   REAL(r64) :: A4        !Denominator [-]
   REAL(r64) :: A5        !Summation term [-]

   REAL(r64) :: TwoX      !Two times Var1 (X) [-]
   REAL(r64) :: B1        !Var1 squared[-]
   REAL(r64) :: B2        !Scalar numerator [-]
   REAL(r64) :: B3        !Scalar denominator [-]
   REAL(r64) :: B4        !Series scalar [-]
   REAL(r64) :: BT1       !Series term 1 [-]
   REAL(r64) :: BT2       !Series term 2 [-]
   REAL(r64) :: BT3       !Series term 3 [-]
   REAL(r64) :: BT4       !Series term 4 [-]
   REAL(r64) :: BT5       !Series term 5 [-]
   REAL(r64) :: BT6       !Series term 6 [-]
   REAL(r64) :: BT7       !Series term 7 [-]
   REAL(r64) :: BT8       !Series term 8 [-]
   REAL(r64) :: BT9       !Series term 9 [-]
   REAL(r64) :: SeriesSum !Sum: 1 + terms 1 through 9 [-]
   LOGICAL, SAVE :: firstTime=.true.
   REAL(r64),SAVE :: EXP1_Value=0.0d0  ! value of EXP(1), i.e., 2.71828182845905
   REAL(r64),SAVE :: PKON=0.0d0        ! value of 2.0/SQRT(PI), i.e. 1.12837916709551
   REAL(r64),SAVE :: PI_SQRT           ! value of SQRT(PI)

   IF (firstTime) THEN
     ! Set up some globals:
     EXP1_Value=EXP(1.0d0)
     PI_SQRT=SQRT(PI)
     PKON=2.0d0/PI_SQRT
     firstTime=.false.
   ENDIF

   IF (Var1 < -2.0d0) THEN
     ErfValue=-1.0d0
     RETURN
   ENDIF

   !Select region for evaluating functions
   IF(Var1 < 3.6d0) THEN !Summation solution for 0 <= Var1 < 3.6 (Geelen's equation 16): A-range
     !Initialize values
     AN = -1 !.d0
     FACT = 1.d0
     A5 = 0.d0

     DO SumTermID=1,60
       AN = AN + 1 !.d0
       FACT = FACT * REAL(AN,r64)
       IF (AN == 0) FACT = 1.d0
       A1 = (-1.d0)**AN
       A2 = (2.d0 * REAL(AN,r64)) + 1.d0
       A3 = A1 * Var1**A2
       A4 = FACT * ((2.d0 * REAL(AN,r64)) + 1.d0)
       A5 = (A3 / A4) + A5
     END DO
     ErfValue = PKON * A5

   ELSE !Series solution (Geelen's equation 22): B-range
     !Factorial values not combined so that source of terms more clear
     TwoX = 2.d0 * Var1

     B1 = Var1**2
     B2 = EXP1_Value**(-B1)
     B3 = Var1 * PI_SQRT
     B4 = B2 / B3

     BT1 = 2.d0 /(TwoX**2)
     BT2 = 24.d0 / (2.d0 * (TwoX**4))
     BT3 = 720.0d0 / (6.d0 * (TwoX**6))
     BT4 = 40320.d0 / (24.d0 * (TwoX**8))
     BT5 = 3628800.d0 / (120.d0 * (TwoX**10))
     BT6 = F12 / (720.d0 * (TwoX**12.d0))
     BT7 = (F12 * 182.d0) / (5040.d0 * (TwoX**14))
     BT8 = (F12 * 240.d0 * 182.d0) / (40320.d0 * (TwoX**16))
     BT9 = (F12 * 306.d0 * 240.d0 * 182.d0) / (362880.d0 * (TwoX**18))
     SeriesSum = 1.d0 - BT1 + BT2 - BT3 + BT4 - BT5 + BT6 - BT7 + BT8 - BT9

     ErfValue = 1.d0 - B4 * SeriesSum
   END IF

RETURN
END FUNCTION ERF

AirflowNetworkBalanceManager.f90 AirflowNetworkSolver.f90 BaseboardRadiator.f90 BaseboardRadiatorElectric.f90 BaseboardRadiatorSteam.f90 BaseboardRadiatorWater.f90 BranchInputManager.f90 BranchNodeConnections.f90 ConductionTransferFunctionCalc.f90 CoolTower.f90 CostEstimateManager.f90 CurveManager.f90 CVFOnlyRoutines.f90 DataAirflowNetwork.f90 DataAirLoop.f90 DataAirSystems.f90 DataBranchAirLoopPlant.f90 DataBranchNodeConnections.f90 DataBSDFWindow.f90 DataComplexFenestration.f90 DataContaminantBalance.f90 DataConvergParams.f90 DataConversions.f90 DataCostEstimate.f90 DataDaylighting.f90 DataDaylightingDevices.f90 Datadefineequip.f90 DataDElight.f90 DataEnvironment.f90 DataEquivalentLayerWindow.f90 DataErrorTracking.f90 DataGenerators.f90 DataGlobalConstants.f90 DataGlobals.f90 DataHeatBalance.f90 DataHeatBalFanSys.f90 DataHeatBalSurface.f90 DataHVACControllers.f90 DataHVACGlobals.f90 DataInterfaces.f90 DataIPShortCuts.f90 DataLoopNode.f90 DataMoistureBalance.f90 DataMoistureBalanceEMPD.f90 DataOutputs.f90 DataPhotovoltaics.f90 DataPlant.f90 DataPlantPipingSystems.f90 DataPrecisionGlobals.f90 DataReportingFlags.f90 DataRoomAir.f90 DataRootFinder.f90 DataRuntimeLanguage.f90 DataShadowingCombinations.f90 DataSizing.f90 DataStringGlobals.f90 DataSurfaceColors.f90 DataSurfaceLists.f90 DataSurfaces.f90 DataSystemVariables.f90 DataTimings.f90 DataUCSDSharedData.f90 DataVectorTypes.f90 DataViewFactorInformation.f90 DataWater.f90 DataZoneControls.f90 DataZoneEnergyDemands.f90 DataZoneEquipment.f90 DaylightingDevices.f90 DaylightingManager.f90 DElightManagerF.f90 DElightManagerF_NO.f90 DemandManager.f90 DesiccantDehumidifiers.f90 DirectAir.f90 DisplayRoutines.f90 DXCoil.f90 EarthTube.f90 EconomicLifeCycleCost.f90 EconomicTariff.f90 EcoRoof.f90 ElectricPowerGenerators.f90 ElectricPowerManager.f90 EMSManager.f90 EnergyPlus.f90 ExteriorEnergyUseManager.f90 ExternalInterface_NO.f90 FanCoilUnits.f90 FaultsManager.f90 FluidProperties.f90 General.f90 GeneralRoutines.f90 GlobalNames.f90 HeatBalanceAirManager.f90 HeatBalanceConvectionCoeffs.f90 HeatBalanceHAMTManager.f90 HeatBalanceInternalHeatGains.f90 HeatBalanceIntRadExchange.f90 HeatBalanceManager.f90 HeatBalanceMovableInsulation.f90 HeatBalanceSurfaceManager.f90 HeatBalFiniteDifferenceManager.f90 HeatRecovery.f90 Humidifiers.f90 HVACControllers.f90 HVACCooledBeam.f90 HVACDualDuctSystem.f90 HVACDuct.f90 HVACDXSystem.f90 HVACEvapComponent.f90 HVACFanComponent.f90 HVACFurnace.f90 HVACHeatingCoils.f90 HVACHXAssistedCoolingCoil.f90 HVACInterfaceManager.f90 HVACManager.f90 HVACMixerComponent.f90 HVACMultiSpeedHeatPump.f90 HVACSingleDuctInduc.f90 HVACSingleDuctSystem.f90 HVACSplitterComponent.f90 HVACStandAloneERV.f90 HVACSteamCoilComponent.f90 HVACTranspiredCollector.f90 HVACUnitaryBypassVAV.f90 HVACUnitarySystem.f90 HVACVariableRefrigerantFlow.f90 HVACWaterCoilComponent.f90 HVACWatertoAir.f90 HVACWatertoAirMultiSpeedHP.f90 InputProcessor.f90 MatrixDataManager.f90 MixedAir.f90 MoistureBalanceEMPDManager.f90 NodeInputManager.f90 NonZoneEquipmentManager.f90 OutAirNodeManager.f90 OutdoorAirUnit.f90 OutputProcessor.f90 OutputReportPredefined.f90 OutputReports.f90 OutputReportTabular.f90 PackagedTerminalHeatPump.f90 PackagedThermalStorageCoil.f90 Photovoltaics.f90 PhotovoltaicThermalCollectors.f90 PlantAbsorptionChillers.f90 PlantBoilers.f90 PlantBoilersSteam.f90 PlantCentralGSHP.f90 PlantChillers.f90 PlantCondLoopOperation.f90 PlantCondLoopTowers.f90 PlantEIRChillers.f90 PlantEvapFluidCoolers.f90 PlantExhaustAbsorptionChiller.f90 PlantFluidCoolers.f90 PlantGasAbsorptionChiller.f90 PlantGroundHeatExchangers.f90 PlantHeatExchanger.f90 PlantIceThermalStorage.f90 PlantLoadProfile.f90 PlantLoopEquipment.f90 PlantLoopSolver.f90 PlantManager.f90 PlantOutsideEnergySources.f90 PlantPipeHeatTransfer.f90 PlantPipes.f90 PlantPipingSystemManager.f90 PlantPondGroundHeatExchanger.f90 PlantPressureSystem.f90 PlantPumps.f90 PlantSolarCollectors.f90 PlantSurfaceGroundHeatExchanger.f90 PlantUtilities.f90 PlantValves.f90 PlantWaterSources.f90 PlantWaterThermalTank.f90 PlantWatertoWaterGSHP.f90 PlantWaterUse.f90 PollutionAnalysisModule.f90 PoweredInductionUnits.f90 PsychRoutines.f90 Purchasedairmanager.f90 RadiantSystemHighTemp.f90 RadiantSystemLowTemp.f90 RefrigeratedCase.f90 ReportSizingManager.f90 ReturnAirPath.f90 RoomAirManager.f90 RoomAirModelCrossVent.f90 RoomAirModelDisplacementVent.f90 RoomAirModelMundt.f90 RoomAirModelUFAD.f90 RoomAirModelUserTempPattern.f90 RootFinder.f90 RuntimeLanguageProcessor.f90 ScheduleManager.f90 SetPointManager.f90 SimAirServingZones.f90 SimulationManager.f90 SizingManager.f90 SolarReflectionManager.f90 SolarShading.f90 SortAndStringUtilities.f90 sqlite3.c SQLiteCRoutines.c SQLiteFortranRoutines.f90 SQLiteFortranRoutines_NO.f90 StandardRatings.f90 SurfaceGeometry.f90 SystemAvailabilityManager.f90 SystemReports.f90 TarcogComplexFenestration.f90 ThermalChimney.f90 ThermalComfort.f90 UnitHeater.f90 UnitVentilator.f90 UserDefinedComponents.f90 UtilityRoutines.f90 VectorUtilities.f90 VentilatedSlab.f90 WaterManager.f90 WeatherManager.f90 WindowAC.f90 WindowComplexManager.f90 WindowEquivalentLayer.f90 WindowManager.f90 WindTurbine.f90 Zoneairloopequipmentmanager.f90 ZoneContaminantPredictorCorrector.f90 ZoneDehumidifier.f90 Zoneequipmentmanager.f90 ZonePlenumComponent.f90 ZoneTempPredictorCorrector.f90