Exemple #1
0
    def calcAuto(self, discipline='', deviationAmplitude=0.0, debug=False):
        '''
        Call Calc for self
        Validate Self
        if validation gives back an error than rerun
        Quit if Calc is called more than 2000 times

        ...todo :

           Capsle the initialising loops into a single routine
        '''

        self.log.info('')
        self.log.info("##############################################################################")
        self.log.info("VAMPzero CALCAuto")
        self.log.info("calculation run will be repeated till converged")
        self.log.info("##############################################################################")

        count = 6

        # Do some preruns to make it nicer
        for i in range(count):
            self.preCalc(debug, i)

        while not self.converge(True):
            self.log.info('VAMPzero CALC: Iteration %i', count)
            
            try:
                self.calc(discipline, deviationAmplitude)
            except OverflowError:
                self.log.info("##############################################################################")
                self.log.info("##############################################################################")
                self.log.error("VAMPzero CALC: An Overflow Error in Python occurred.")
                self.log.error("VAMPzero CALC: Probably Your Calculation is not Converging")
                self.log.error("VAMPzero CALC: Closing without success")
                printFooter()
                exit()#@note: enter exit code here

            if debug:
                self.report()
                raw_input('Press Enter to continue')
            count += 1
            if count > 2000:
                self.log.info("##############################################################################")
                self.log.info("##############################################################################")
                self.log.error("VAMPzero CALC: more than " + str(count) + " Iterations in calcAuto, hence quitting")
                printFooter()
                raise NotConvergingError()
#                exit()#@note: enter exit code here

        self.log.info("VAMPzero CALCAuto: done.")
Exemple #2
0
    def run(self, argv=None):
        '''
        Runs VAMPzero.
        '''
        if argv is None:
            argv = sys.argv
        try:
            generalLib.printHeader()
            print argv
            self.args = self.parser.parse_args()
            self.readConfig()
            ###################################################################################################
            ##VAMPzero Initialize
            ###################################################################################################
            self.aircraft.engine.sfcCR.calc = self.aircraft.engine.sfcCR.calcOverallEff
            self.setFixed()

            ###################################################################################################
            ##VAMPzero Imports
            ###################################################################################################
            if self.args.m:
                importMatlabLib.importMatlab(self.aircraft)
            else:
                guiLib.importGUI(self.aircraft, self.cpacsIn)

            tixiHandle = tixiLib.openTIXI(self.cpacsIn)
            hasModel = tixiLib.checkElement(tixiHandle,
                                            '/cpacs/vehicles/aircraft/model')
            if hasModel:
                self.aircraft.cpacsImport(self.cpacsIn)

            self.aircraft.atmosphere.hCR.setValueFix(
                self.aircraft.altCR.getValue())
            self.aircraft.atmosphere.MaCR.setValueFix(
                self.aircraft.machCR.getValue())

            self.calc()
            self.finish()
            self.setUIDs()

            self.exportToolspecific(
            )  # needs to be called after the last use of cpacsLib (otherwise all nodes not in the schema will be removed)
            generalLib.printFooter()

            return 0

        except (argparse.ArgumentError), err:
            print >> sys.stderr, err
            self.parser.print_help()
            return 2
Exemple #3
0
    def run(self, argv=None):
        '''
        Runs VAMPzero.
        '''
        if argv is None:
            argv = sys.argv
        try:
            generalLib.printHeader()
            print argv
            self.args = self.parser.parse_args()
            self.readConfig()
            ###################################################################################################
            ##VAMPzero Initialize
            ###################################################################################################
            self.aircraft.engine.sfcCR.calc = self.aircraft.engine.sfcCR.calcOverallEff
            self.setFixed()
            
            ###################################################################################################
            ##VAMPzero Imports
            ###################################################################################################
            if self.args.m:
                importMatlabLib.importMatlab(self.aircraft)
            else:
                guiLib.importGUI(self.aircraft, self.cpacsIn)
            
            tixiHandle  = tixiLib.openTIXI(self.cpacsIn)
            hasModel    = tixiLib.checkElement(tixiHandle,'/cpacs/vehicles/aircraft/model')
            if hasModel:
                self.aircraft.cpacsImport(self.cpacsIn)

            hasEngine   = tixiLib.checkElement(tixiHandle,'/cpacs/vehicles/engines/engine')
            if hasEngine:
                self.aircraft.engine.cpacsImport(self.cpacsIn)

            self.aircraft.atmosphere.hCR.setValueFix(self.aircraft.altCR.getValue())
            self.aircraft.atmosphere.MaCR.setValueFix(self.aircraft.machCR.getValue())
            
            self.calc()
            self.finish()
            self.setUIDs()
            
            self.exportToolspecific() # needs to be called after the last use of cpacsLib (otherwise all nodes not in the schema will be removed)
            generalLib.printFooter()
            
            return 0
            
        except (argparse.ArgumentError), err:
            print >>sys.stderr, err
            self.parser.print_help()
            return 2
Exemple #4
0
    def calcAuto(self, discipline='', deviationAmplitude=0.0, debug=False):
        '''
        Call Calc for self
        Validate Self
        if validation gives back an error than rerun
        Quit if Calc is called more than 2000 times

        ...todo :

           Capsle the initialising loops into a single routine
        '''

        self.log.info('')
        self.log.info(
            "##############################################################################"
        )
        self.log.info("VAMPzero CALCAuto")
        self.log.info("calculation run will be repeated till converged")
        self.log.info(
            "##############################################################################"
        )

        count = 6

        # Do some preruns to make it nicer
        for i in range(count):
            self.preCalc(debug, i)

        while not self.converge(True):
            self.log.info('VAMPzero CALC: Iteration %i', count)

            try:
                self.calc(discipline, deviationAmplitude)
            except OverflowError:
                self.log.info(
                    "##############################################################################"
                )
                self.log.info(
                    "##############################################################################"
                )
                self.log.error(
                    "VAMPzero CALC: An Overflow Error in Python occurred.")
                self.log.error(
                    "VAMPzero CALC: Probably Your Calculation is not Converging"
                )
                self.log.error("VAMPzero CALC: Closing without success")
                printFooter()
                exit()  #@note: enter exit code here

            if debug:
                self.report()
            count += 1
            if count > 2000:
                self.log.info(
                    "##############################################################################"
                )
                self.log.info(
                    "##############################################################################"
                )
                self.log.error("VAMPzero CALC: more than " + str(count) +
                               " Iterations in calcAuto, hence quitting")
                printFooter()
                raise NotConvergingError()
#                exit()#@note: enter exit code here

        self.log.info("VAMPzero CALCAuto: done.")