Ejemplo n.º 1
0
    def test_add_desvars(self):
        # load the box model and build the box model
        csmFile = os.path.join(self.input_path, "inputFiles/esp/box.csm")
        DVGeo = DVGeometryESP(csmFile)
        self.assertIsNotNone(DVGeo)

        # add variables with a mix of optional arguments
        DVGeo.addVariable("cubex0", lower=np.array([-10.0]), upper=np.array([10.0]), scale=0.1, dh=0.0001)
        self.assertEqual(DVGeo.getNDV(), 1)
        DVGeo.addVariable("cubey0")
        self.assertEqual(DVGeo.getNDV(), 2)
        DVGeo.addVariable("cubez0", lower=np.array([-10.0]), upper=np.array([10.0]))
        self.assertEqual(DVGeo.getNDV(), 3)

        # try to add a variable that isn't in the CSM file
        with self.assertRaises(Error):
            DVGeo.addVariable("cubew0")
Ejemplo n.º 2
0
                 evalFuncs=["cl", "cd"])

# Add angle of attack variable
ap.addDV("alpha", value=1.5, lower=0, upper=10.0, scale=0.1)
# rst aeroproblem (end)
# ======================================================================
#         Geometric Design Variable Set-up
# ======================================================================
# rst dvgeo (beg)
# Create DVGeometry object
DVGeo = DVGeometryESP("wing.csm",
                      suppress_stdout=True,
                      exclude_edge_projections=True)
DVGeo.addVariable("twist_local",
                  cols=[2, 3, 4, 5, 6, 7, 8],
                  lower=-10 * np.ones(7),
                  upper=10 * np.ones(7),
                  scale=0.1,
                  dh=0.0001)
DVGeo.addVariable("cst_u",
                  lower=0.0 * np.ones(8 * 7),
                  upper=1.0 * np.ones(8 * 7),
                  scale=1.0,
                  dh=0.0001)
DVGeo.addVariable("cst_l",
                  lower=-1.0 * np.ones(8 * 7),
                  upper=0.2 * np.ones(8 * 7),
                  scale=1.0,
                  dh=0.0001)

# Add DVGeo object to CFD solver
CFDSolver.setDVGeo(DVGeo)