Exemplo n.º 1
0
    def setUp(self):
        if not hasattr(self, "name"):
            # return immediately when the setup method is being called on the based class and NOT the
            # classes created using parametrized
            # this will happen when training, but will hopefully be fixed down the line
            return
        super().setUp()

        options = copy.copy(adflowDefOpts)
        options["outputdirectory"] = os.path.join(baseDir, options["outputdirectory"])
        options.update(self.options)

        self.ffdFile = os.path.join(baseDir, "../../input_files/mdo_tutorial_ffd.fmt")

        mesh_options = copy.copy(IDWarpDefOpts)
        mesh_options.update({"gridFile": options["gridfile"]})

        self.ap = copy.deepcopy(self.aero_prob)

        # Setup aeroproblem
        self.ap.evalFuncs = self.evalFuncs

        # add the default dvs to the problem
        for dv in defaultAeroDVs:
            self.ap.addDV(dv)

        self.CFDSolver = ADFLOW_C(options=options, debug=True)

        self.CFDSolver.setMesh(USMesh_C(options=mesh_options))
        self.CFDSolver.setDVGeo(setDVGeo(self.ffdFile, cmplx=True))

        # propagates the values from the restart file throughout the code
        self.CFDSolver.getResidual(self.ap)
Exemplo n.º 2
0
    def setUp(self):
        if not hasattr(self, "name"):
            # return immediately when the setup method is being called on the based class and NOT the
            # classes created using parametrized
            # this will happen when training, but will hopefully be fixed down the line
            return

        super().setUp()

        # start with the default options dictionary
        options = copy.copy(adflowDefOpts)

        # set the output directory
        options["outputdirectory"] = os.path.join(baseDir,
                                                  options["outputdirectory"])

        # these are the modified options common to these tests
        options.update(commonTestOptions)

        # finally, bring in the specific options for each parameterized test
        options.update(self.options)

        self.ap = copy.deepcopy(ap_simple_cart_cube)

        # Create the solver
        self.CFDSolver = ADFLOW_C(options=options, debug=False)
Exemplo n.º 3
0
    def setUp(self):
        if not hasattr(self, "name"):
            # return immediately when the setup method is being called on the based class and NOT the
            # classes created using parametrized
            # this will happen when training, but will hopefully be fixed down the line
            return
        super().setUp()

        options = copy.copy(adflowDefOpts)
        options["outputdirectory"] = os.path.join(baseDir,
                                                  options["outputdirectory"])
        options.update(self.options)

        self.ap = copy.deepcopy(self.aero_prob)

        # Setup aeroproblem
        self.ap = copy.deepcopy(self.aero_prob)
        # add the default dvs to the problem
        for dv in defaultAeroDVs:
            self.ap.addDV(dv)

        # add the default dvs to the problem
        for dv in defaultAeroDVs:
            self.ap.addDV(dv)

        self.CFDSolver = ADFLOW_C(options=options, debug=True)

        # propagates the values from the restart file throughout the code
        self.CFDSolver.getResidual(self.ap)
Exemplo n.º 4
0
    'timeIntervals':
    ntimeintervalsspectral,
    'qmode':
    True,
    'alphaFollowing':
    False,
    'TSStability':
    False,
    'usetsinterpolatedgridvelocity':
    False,
    'useblockettes':
    False,
}

if complex_flag:
    CFDSolver = ADFLOW_C(options=aeroOptions)
else:
    CFDSolver = ADFLOW(options=aeroOptions)

ap = AeroProblem(name=name, alpha=alpha, mach=mach, altitude=10000.0, areaRef=1.0, chordRef=1.0, evalFuncs=['cl','cd', 'cmz'],
    xRef=xRef,xRot=xRot,\
    degreePol=0,coefPol=[0.0],\
    degreeFourier=1,omegaFourier=omega,cosCoefFourier=[0.0,0.0],sinCoefFourier=[alpha_mag])

ap.addDV('mach', scale=1.0)
ap.addDV('alpha', scale=1.0)

funcs = {}
CFDSolver(ap)
CFDSolver.evalFunctions(ap, funcs)
Exemplo n.º 5
0
    def setUp(self):

        super().setUp()

        self.options = {
            "gridfile": os.path.join(baseDir, "../../input_files/actuator_test_pipe.cgns"),
            # the restart file was ran with thrust = 600 N and heat = 1e5 W
            # "restartfile": os.path.join(baseDir, "../../input_files/actuator_test_pipe.cgns"),
            "writevolumesolution": False,
            "writesurfacesolution": False,
            "writetecplotsurfacesolution": False,
            "mgcycle": "sg",
            "ncycles": 1000,
            "useanksolver": True,
            "usenksolver": True,
            "ankswitchtol": 10.0,
            "anksecondordswitchtol": 1e-2,
            "ankinnerpreconits": 1,
            "monitorvariables": ["cpu", "resrho", "resrhoe"],
            "volumevariables": ["temp", "mach", "resrho"],
            "surfacevariables": ["temp", "vx", "vy", "vz", "p", "ptloss", "mach", "rho"],
            "equationType": "Euler",
            "l2convergence": 1e-13,
            "adjointl2convergence": 1e-13,
        }

        options = copy.copy(adflowDefOpts)
        options["outputdirectory"] = os.path.join(baseDir, options["outputdirectory"])
        options.update(self.options)

        # CFDSolver = ADFLOW(options=options)
        CFDSolver = ADFLOW_C(options=options, debug=True)

        CFDSolver.addFunction("mdot", "inlet", name="mdot_in")
        CFDSolver.addFunction("mdot", "outlet", name="mdot_out")

        CFDSolver.addFunction("aavgptot", "outlet", name="aavgptot_out")
        CFDSolver.addFunction("aavgptot", "inlet", name="aavgptot_in")

        CFDSolver.addFunction("mavgttot", "outlet", name="mavgttot_out")
        CFDSolver.addFunction("mavgttot", "inlet", name="mavgttot_in")

        CFDSolver.addFunction("aavgps", "outlet", name="aavgps_out")
        CFDSolver.addFunction("aavgps", "inlet", name="aavgps_in")

        CFDSolver.addFunction("area", "inlet", name="area_in")
        CFDSolver.addFunction("area", "outlet", name="area_out")

        CFDSolver.addFunction("mavgvx", "inlet", name="mavgvx_in")
        CFDSolver.addFunction("mavgvx", "outlet", name="mavgvx_out")

        CFDSolver.addFunction("forcexpressure", "inlet", name="forcexpressure_in")
        CFDSolver.addFunction("forcexpressure", "outlet", name="forcexpressure_out")

        CFDSolver.addFunction("forcexmomentum", "inlet", name="forcexmomentum_in")
        CFDSolver.addFunction("forcexmomentum", "outlet", name="forcexmomentum_out")

        self.CFDSolver = CFDSolver

        # this is imported from reg_aeroproblems utility script
        self.ap = ap_actuator_pipe

        actuatorFile = os.path.join(baseDir, "../../input_files/actuator_test_disk.xyz")
        self.CFDSolver.addActuatorRegion(
            actuatorFile,
            np.array([0, 0, 0]),
            np.array([1, 0, 0]),
            "actuator_region",
            # we will set these individually in the tests below
            thrust=0.0,
            torque=0.0,
            heat=0.0,
        )

        # add thrust and heat as AP DVs
        self.ap.setBCVar("Thrust", 0.0, "actuator_region")
        self.ap.addDV("Thrust", family="actuator_region", units="N", name="thrust")

        self.ap.setBCVar("Heat", 0.0, "actuator_region")
        self.ap.addDV("Heat", family="actuator_region", units="J/s", name="heat")

        # also add flowpower as an AZ function
        CFDSolver.addFunction("flowpower", "actuator_region", name="flowpower_az")