コード例 #1
0
ファイル: aero_opt.py プロジェクト: anilyil/MACH-Aero
    "useANKSolver": True,
    # NK Solver Parameters
    "useNKSolver": True,
    "nkswitchtol": 1e-6,
    # Termination Criteria
    "L2Convergence": 1e-10,
    "L2ConvergenceCoarse": 1e-2,
    "nCycles": 10000,
    # Adjoint Parameters
    "adjointL2Convergence": 1e-10,
}

# Create solver
CFDSolver = ADFLOW(options=aeroOptions, comm=comm)
CFDSolver.addLiftDistribution(150, "z")
CFDSolver.addSlices("z", np.linspace(0.1, 14, 10))
# rst adflow (end)
# ======================================================================
#         Set up flow conditions with AeroProblem
# ======================================================================
# rst aeroproblem (beg)
ap = AeroProblem(name="wing",
                 alpha=1.5,
                 mach=0.8,
                 altitude=10000,
                 areaRef=45.5,
                 chordRef=3.25,
                 evalFuncs=["cl", "cd"])

# Add angle of attack variable
ap.addDV("alpha", value=1.5, lower=0, upper=10.0, scale=0.1)
コード例 #2
0
# Add angle of attack variable
ap.addDV('alpha', value=alpha, lower=0, upper=10.0, scale=1.0)
#rst aeroproblem (end)
# ======================================================================
#         Geometric Design Variable Set-up
# ======================================================================
#rst dvgeo (beg)
# Create DVGeometry object
FFDFile = 'ffd.xyz'

DVGeo = DVGeometry(FFDFile)
DVGeo.addGeoDVLocal('shape', lower=-0.05, upper=0.05, axis='y', scale=1.0)

span = 1.0
pos = numpy.array([0.5])*span
CFDSolver.addSlices('z',pos,sliceType='absolute')

# Add DVGeo object to CFD solver
CFDSolver.setDVGeo(DVGeo)
#rst dvgeo (end)
# ======================================================================
#         DVConstraint Setup
# ======================================================================
#rst dvcon (beg)

DVCon = DVConstraints()
DVCon.setDVGeo(DVGeo)

# Only ADflow has the getTriangulatedSurface Function
DVCon.setSurface(CFDSolver.getTriangulatedMeshSurface())
コード例 #3
0
ファイル: airfoil_multiopt.py プロジェクト: gang525/MACH-Aero
    ap.addDV("alpha", value=alpha[i], lower=0, upper=10.0, scale=1.0)
    aeroProblems.append(ap)
# rst aeroproblem (end)
# ======================================================================
#         Geometric Design Variable Set-up
# ======================================================================
# rst dvgeo (beg)
# Create DVGeometry object
FFDFile = "ffd.xyz"

DVGeo = DVGeometry(FFDFile)  # DVGeo = DVGeometry_FFD(FFDFile)
DVGeo.addGeoDVLocal("shape", lower=-0.05, upper=0.05, axis="y", scale=1.0)

span = 1.0
pos = np.array([0.5]) * span
CFDSolver.addSlices("z", pos, sliceType="absolute")

# Add DVGeo object to CFD solver
CFDSolver.setDVGeo(DVGeo)
# rst dvgeo (end)
# ======================================================================
#         DVConstraint Setup
# ======================================================================
# rst dvcon (beg)
DVCon = DVConstraints()  # DVCon = DVConstraints_FFD_data()
DVCon.setDVGeo(DVGeo)

# Only ADflow has the getTriangulatedSurface Function
DVCon.setSurface(CFDSolver.getTriangulatedMeshSurface())

# Le/Te constraints
コード例 #4
0
    # NK Solver Parameters
    'useNKSolver': True,
    'nkswitchtol': 1e-4,

    # Termination Criteria
    'L2Convergence': 1e-6,
    'L2ConvergenceCoarse': 1e-2,
    'nCycles': 1000,
}
#rst Start ADflow
# Create solver
CFDSolver = ADFLOW(options=aeroOptions)

# Add features
CFDSolver.addLiftDistribution(150, 'z')
CFDSolver.addSlices('z', numpy.linspace(0.1, 14, 10))

#rst Create AeroProblem
ap = AeroProblem(name='wing',
                 mach=0.8,
                 altitude=10000,
                 alpha=1.5,
                 areaRef=45.5,
                 chordRef=3.25,
                 evalFuncs=['cl', 'cd'])

#rst Create polar arrays

# Create an array of alpha values.
# In this case we create 6 evenly spaced values from 0 - 5.
alphaList = numpy.linspace(0, 5, 6)
コード例 #5
0
class TestSolve(reg_test_classes.RegTest):
    """
    Tests that ADflow can converge the wing from the mdo tutorial using the euler
    equation to the required accuracy as meassure by the norm of the residuals,
    and states, and the accuracy of the functions

    based on the old regression test 15
    """

    N_PROCS = 2
    ref_file = "solve_rans_time_acc_naca0012.json"

    def setUp(self):
        super().setUp()

        gridFile = os.path.join(baseDir,
                                "../../inputFiles/naca0012_rans-L2.cgns")

        f = 10.0  # [Hz] Forcing frequency of the flow
        period = 1.0 / f  # [sec]
        nStepPerPeriod = 8
        nPeriods = 1
        nfineSteps = nStepPerPeriod * nPeriods
        dt = period / nStepPerPeriod  # [s] The actual timestep

        options = copy.copy(adflowDefOpts)
        options.update({
            "gridfile":
            gridFile,
            "outputdirectory":
            os.path.join(baseDir, "../output_files"),
            "writevolumesolution":
            False,
            "vis4":
            0.025,
            "vis2":
            0.5,
            "restrictionrelaxation":
            0.5,
            "smoother":
            "dadi",
            "equationtype":
            "RANS",
            "equationmode":
            "unsteady",
            "timeIntegrationscheme":
            "bdf",
            "ntimestepsfine":
            nfineSteps,
            "deltat":
            dt,
            "nsubiterturb":
            10,
            "nsubiter":
            5,
            "useale":
            False,
            "usegridmotion":
            True,
            "cfl":
            2.5,
            "cflcoarse":
            1.2,
            "ncycles":
            2000,
            "mgcycle":
            "3w",
            "mgstartlevel":
            1,
            "monitorvariables": ["cpu", "resrho", "cl", "cd", "cmz"],
            "usenksolver":
            False,
            "l2convergence":
            1e-6,
            "l2convergencecoarse":
            1e-4,
            "qmode":
            True,
            "alphafollowing":
            False,
            "blockSplitting":
            True,
            "useblockettes":
            False,
        })

        # Setup aeroproblem
        self.ap = copy.copy(ap_naca0012_time_acc)

        # Create the solver
        self.CFDSolver = ADFLOW(options=options, debug=False)
        self.CFDSolver.addSlices("z", [0.5])

    def test_solve(self):

        # do the solve
        self.CFDSolver(self.ap)

        # check its accuracy
        utils.assert_functions_allclose(self.handler,
                                        self.CFDSolver,
                                        self.ap,
                                        tol=1e-8)
コード例 #6
0
ファイル: test15.py プロジェクト: joanibal/adflow
def setup_cb(comm):
    CFDSolver = ADFLOW(options=options, comm=comm)
    CFDSolver.addSlices('z', [0.5])
    CFDSolver(ap)

    return CFDSolver, None, None, None