RANS CRM wing 2-D data set

import numpy as np

raw = np.array(
    [
        [
            2.000000000000000000e00,
            4.500000000000000111e-01,
            1.536799999999999972e-02,
            3.674239999999999728e-01,
            5.592279999999999474e-01,
            -1.258039999999999992e-01,
            -1.248699999999999984e-02,
        ],
        [
            3.500000000000000000e00,
            4.500000000000000111e-01,
            1.985100000000000059e-02,
            4.904470000000000218e-01,
            7.574600000000000222e-01,
            -1.615260000000000029e-01,
            8.987000000000000197e-03,
        ],
        [
            5.000000000000000000e00,
            4.500000000000000111e-01,
            2.571000000000000021e-02,
            6.109189999999999898e-01,
            9.497949999999999449e-01,
            -1.954619999999999969e-01,
            4.090900000000000092e-02,
        ],
        [
            6.500000000000000000e00,
            4.500000000000000111e-01,
            3.304200000000000192e-02,
            7.266120000000000356e-01,
            1.131138999999999895e00,
            -2.255890000000000117e-01,
            8.185399999999999621e-02,
        ],
        [
            8.000000000000000000e00,
            4.500000000000000111e-01,
            4.318999999999999923e-02,
            8.247250000000000414e-01,
            1.271487000000000034e00,
            -2.397040000000000004e-01,
            1.217659999999999992e-01,
        ],
        [
            0.000000000000000000e00,
            5.799999999999999600e-01,
            1.136200000000000057e-02,
            2.048760000000000026e-01,
            2.950280000000000125e-01,
            -7.882100000000000217e-02,
            -2.280099999999999835e-02,
        ],
        [
            1.500000000000000000e00,
            5.799999999999999600e-01,
            1.426000000000000011e-02,
            3.375619999999999732e-01,
            5.114130000000000065e-01,
            -1.189420000000000061e-01,
            -1.588200000000000028e-02,
        ],
        [
            3.000000000000000000e00,
            5.799999999999999600e-01,
            1.866400000000000003e-02,
            4.687450000000000228e-01,
            7.240400000000000169e-01,
            -1.577669999999999906e-01,
            3.099999999999999891e-03,
        ],
        [
            4.500000000000000000e00,
            5.799999999999999600e-01,
            2.461999999999999952e-02,
            5.976639999999999731e-01,
            9.311709999999999710e-01,
            -1.944160000000000055e-01,
            3.357500000000000068e-02,
        ],
        [
            6.000000000000000000e00,
            5.799999999999999600e-01,
            3.280700000000000283e-02,
            7.142249999999999988e-01,
            1.111707999999999918e00,
            -2.205870000000000053e-01,
            7.151699999999999724e-02,
        ],
        [
            0.000000000000000000e00,
            6.800000000000000488e-01,
            1.138800000000000055e-02,
            2.099310000000000065e-01,
            3.032230000000000203e-01,
            -8.187899999999999345e-02,
            -2.172699999999999979e-02,
        ],
        [
            1.500000000000000000e00,
            6.800000000000000488e-01,
            1.458699999999999927e-02,
            3.518569999999999753e-01,
            5.356630000000000003e-01,
            -1.257649999999999879e-01,
            -1.444800000000000077e-02,
        ],
        [
            3.000000000000000000e00,
            6.800000000000000488e-01,
            1.952800000000000022e-02,
            4.924879999999999813e-01,
            7.644769999999999621e-01,
            -1.678040000000000087e-01,
            6.023999999999999841e-03,
        ],
        [
            4.500000000000000000e00,
            6.800000000000000488e-01,
            2.666699999999999973e-02,
            6.270339999999999803e-01,
            9.801630000000000065e-01,
            -2.035240000000000105e-01,
            3.810000000000000192e-02,
        ],
        [
            6.000000000000000000e00,
            6.800000000000000488e-01,
            3.891800000000000120e-02,
            7.172730000000000494e-01,
            1.097855999999999943e00,
            -2.014620000000000022e-01,
            6.640000000000000069e-02,
        ],
        [
            0.000000000000000000e00,
            7.500000000000000000e-01,
            1.150699999999999987e-02,
            2.149069999999999869e-01,
            3.115740000000000176e-01,
            -8.498999999999999611e-02,
            -2.057700000000000154e-02,
        ],
        [
            1.250000000000000000e00,
            7.500000000000000000e-01,
            1.432600000000000019e-02,
            3.415969999999999840e-01,
            5.199390000000000400e-01,
            -1.251009999999999900e-01,
            -1.515400000000000080e-02,
        ],
        [
            2.500000000000000000e00,
            7.500000000000000000e-01,
            1.856000000000000011e-02,
            4.677589999999999804e-01,
            7.262499999999999512e-01,
            -1.635169999999999957e-01,
            3.989999999999999949e-04,
        ],
        [
            3.750000000000000000e00,
            7.500000000000000000e-01,
            2.472399999999999945e-02,
            5.911459999999999493e-01,
            9.254930000000000101e-01,
            -1.966150000000000120e-01,
            2.524900000000000061e-02,
        ],
        [
            5.000000000000000000e00,
            7.500000000000000000e-01,
            3.506800000000000195e-02,
            7.047809999999999908e-01,
            1.097736000000000045e00,
            -2.143069999999999975e-01,
            5.321300000000000335e-02,
        ],
        [
            0.000000000000000000e00,
            8.000000000000000444e-01,
            1.168499999999999921e-02,
            2.196390000000000009e-01,
            3.197160000000000002e-01,
            -8.798200000000000465e-02,
            -1.926999999999999894e-02,
        ],
        [
            1.250000000000000000e00,
            8.000000000000000444e-01,
            1.481599999999999931e-02,
            3.553939999999999877e-01,
            5.435950000000000504e-01,
            -1.317419999999999980e-01,
            -1.345599999999999921e-02,
        ],
        [
            2.500000000000000000e00,
            8.000000000000000444e-01,
            1.968999999999999917e-02,
            4.918299999999999894e-01,
            7.669930000000000359e-01,
            -1.728079999999999894e-01,
            3.756999999999999923e-03,
        ],
        [
            3.750000000000000000e00,
            8.000000000000000444e-01,
            2.785599999999999882e-02,
            6.324319999999999942e-01,
            9.919249999999999456e-01,
            -2.077100000000000057e-01,
            3.159800000000000109e-02,
        ],
        [
            5.000000000000000000e00,
            8.000000000000000444e-01,
            4.394300000000000289e-02,
            7.650689999999999991e-01,
            1.188355999999999968e00,
            -2.332680000000000031e-01,
            5.645000000000000018e-02,
        ],
        [
            0.000000000000000000e00,
            8.299999999999999600e-01,
            1.186100000000000002e-02,
            2.232899999999999885e-01,
            3.261100000000000110e-01,
            -9.028400000000000314e-02,
            -1.806500000000000120e-02,
        ],
        [
            1.000000000000000000e00,
            8.299999999999999600e-01,
            1.444900000000000004e-02,
            3.383419999999999761e-01,
            5.161710000000000464e-01,
            -1.279530000000000112e-01,
            -1.402400000000000001e-02,
        ],
        [
            2.000000000000000000e00,
            8.299999999999999600e-01,
            1.836799999999999891e-02,
            4.554270000000000262e-01,
            7.082190000000000429e-01,
            -1.642339999999999911e-01,
            -1.793000000000000106e-03,
        ],
        [
            3.000000000000000000e00,
            8.299999999999999600e-01,
            2.466899999999999996e-02,
            5.798410000000000508e-01,
            9.088819999999999677e-01,
            -2.004589999999999983e-01,
            1.892900000000000138e-02,
        ],
        [
            4.000000000000000000e00,
            8.299999999999999600e-01,
            3.700400000000000217e-02,
            7.012720000000000065e-01,
            1.097366000000000064e00,
            -2.362420000000000075e-01,
            3.750699999999999867e-02,
        ],
        [
            0.000000000000000000e00,
            8.599999999999999867e-01,
            1.224300000000000041e-02,
            2.278100000000000125e-01,
            3.342720000000000136e-01,
            -9.307600000000000595e-02,
            -1.608400000000000107e-02,
        ],
        [
            1.000000000000000000e00,
            8.599999999999999867e-01,
            1.540700000000000056e-02,
            3.551839999999999997e-01,
            5.433130000000000459e-01,
            -1.364730000000000110e-01,
            -1.162200000000000039e-02,
        ],
        [
            2.000000000000000000e00,
            8.599999999999999867e-01,
            2.122699999999999934e-02,
            4.854620000000000046e-01,
            7.552919999999999634e-01,
            -1.817850000000000021e-01,
            1.070999999999999903e-03,
        ],
        [
            3.000000000000000000e00,
            8.599999999999999867e-01,
            3.178899999999999781e-02,
            6.081849999999999756e-01,
            9.510380000000000500e-01,
            -2.252020000000000133e-01,
            1.540799999999999982e-02,
        ],
        [
            4.000000000000000000e00,
            8.599999999999999867e-01,
            4.744199999999999806e-02,
            6.846989999999999466e-01,
            1.042564000000000046e00,
            -2.333600000000000119e-01,
            2.035400000000000056e-02,
        ],
    ]
)


def get_rans_crm_wing():
    # data structure:
    # alpha, mach, cd, cl, cmx, cmy, cmz

    deg2rad = np.pi / 180.0

    xt = np.array(raw[:, 0:2])
    yt = np.array(raw[:, 2:4])
    xlimits = np.array([[-3.0, 10.0], [0.4, 0.90]])

    xt[:, 0] *= deg2rad
    xlimits[0, :] *= deg2rad

    return xt, yt, xlimits


def plot_rans_crm_wing(xt, yt, limits, interp):
    import matplotlib
    import numpy as np

    matplotlib.use("Agg")
    import matplotlib.pyplot as plt

    rad2deg = 180.0 / np.pi

    num = 500
    num_a = 50
    num_M = 50

    x = np.zeros((num, 2))
    colors = ["b", "g", "r", "c", "m", "k", "y"]

    nrow = 3
    ncol = 2
    plt.close()
    fig, axs = plt.subplots(nrow, ncol, figsize=(15, 15))

    # -----------------------------------------------------------------------------

    mach_numbers = [0.45, 0.68, 0.80, 0.86]
    legend_entries = []

    alpha_sweep = np.linspace(0.0, 8.0, num)

    for ind, mach in enumerate(mach_numbers):
        x[:, 0] = alpha_sweep / rad2deg
        x[:, 1] = mach
        CD = interp.predict_values(x)[:, 0]
        CL = interp.predict_values(x)[:, 1]

        mask = np.abs(xt[:, 1] - mach) < 1e-10
        axs[0, 0].plot(xt[mask, 0] * rad2deg, yt[mask, 0], "o" + colors[ind])
        axs[0, 0].plot(alpha_sweep, CD, colors[ind])

        mask = np.abs(xt[:, 1] - mach) < 1e-10
        axs[0, 1].plot(xt[mask, 0] * rad2deg, yt[mask, 1], "o" + colors[ind])
        axs[0, 1].plot(alpha_sweep, CL, colors[ind])

        legend_entries.append("M={}".format(mach))
        legend_entries.append("exact")

    axs[0, 0].set(xlabel="alpha (deg)", ylabel="CD")
    axs[0, 0].legend(legend_entries)

    axs[0, 1].set(xlabel="alpha (deg)", ylabel="CL")
    axs[0, 1].legend(legend_entries)

    # -----------------------------------------------------------------------------

    alphas = [2.0, 4.0, 6.0]
    legend_entries = []

    mach_sweep = np.linspace(0.45, 0.86, num)

    for ind, alpha in enumerate(alphas):
        x[:, 0] = alpha / rad2deg
        x[:, 1] = mach_sweep
        CD = interp.predict_values(x)[:, 0]
        CL = interp.predict_values(x)[:, 1]

        axs[1, 0].plot(mach_sweep, CD, colors[ind])
        axs[1, 1].plot(mach_sweep, CL, colors[ind])

        legend_entries.append("alpha={}".format(alpha))

    axs[1, 0].set(xlabel="Mach number", ylabel="CD")
    axs[1, 0].legend(legend_entries)

    axs[1, 1].set(xlabel="Mach number", ylabel="CL")
    axs[1, 1].legend(legend_entries)

    # -----------------------------------------------------------------------------

    x = np.zeros((num_a, num_M, 2))
    x[:, :, 0] = np.outer(np.linspace(0.0, 8.0, num_a), np.ones(num_M)) / rad2deg
    x[:, :, 1] = np.outer(np.ones(num_a), np.linspace(0.45, 0.86, num_M))
    CD = interp.predict_values(x.reshape((num_a * num_M, 2)))[:, 0].reshape(
        (num_a, num_M)
    )
    CL = interp.predict_values(x.reshape((num_a * num_M, 2)))[:, 1].reshape(
        (num_a, num_M)
    )

    axs[2, 0].plot(xt[:, 1], xt[:, 0] * rad2deg, "o")
    axs[2, 0].contour(x[:, :, 1], x[:, :, 0] * rad2deg, CD, 20)
    pcm1 = axs[2, 0].pcolormesh(
        x[:, :, 1],
        x[:, :, 0] * rad2deg,
        CD,
        cmap=plt.get_cmap("rainbow"),
        shading="auto",
    )
    fig.colorbar(pcm1, ax=axs[2, 0])
    axs[2, 0].set(xlabel="Mach number", ylabel="alpha (deg)")
    axs[2, 0].set_title("CD")

    axs[2, 1].plot(xt[:, 1], xt[:, 0] * rad2deg, "o")
    axs[2, 1].contour(x[:, :, 1], x[:, :, 0] * rad2deg, CL, 20)
    pcm2 = axs[2, 1].pcolormesh(
        x[:, :, 1],
        x[:, :, 0] * rad2deg,
        CL,
        cmap=plt.get_cmap("rainbow"),
        shading="auto",
    )
    fig.colorbar(pcm2, ax=axs[2, 1])
    axs[2, 1].set(xlabel="Mach number", ylabel="alpha (deg)")
    axs[2, 1].set_title("CL")

    plt.show()

RMTB

from smt.examples.rans_crm_wing.rans_crm_wing import (
    get_rans_crm_wing,
    plot_rans_crm_wing,
)
from smt.surrogate_models import RMTB

xt, yt, xlimits = get_rans_crm_wing()

interp = RMTB(
    num_ctrl_pts=20, xlimits=xlimits, nonlinear_maxiter=100, energy_weight=1e-12
)
interp.set_training_values(xt, yt)
interp.train()

plot_rans_crm_wing(xt, yt, xlimits, interp)
___________________________________________________________________________

                                   RMTB
___________________________________________________________________________

 Problem size

      # training points.        : 35

___________________________________________________________________________

 Training

   Training ...
      Pre-computing matrices ...
         Computing dof2coeff ...
         Computing dof2coeff - done. Time (sec):  0.0000000
         Initializing Hessian ...
         Initializing Hessian - done. Time (sec):  0.0000000
         Computing energy terms ...
         Computing energy terms - done. Time (sec):  0.0156271
         Computing approximation terms ...
         Computing approximation terms - done. Time (sec):  0.0000000
      Pre-computing matrices - done. Time (sec):  0.0156271
      Solving for degrees of freedom ...
         Solving initial startup problem (n=400) ...
            Solving for output 0 ...
               Iteration (num., iy, grad. norm, func.) :   0   0 9.429150220e-02 1.114942861e-02
               Iteration (num., iy, grad. norm, func.) :   0   0 2.984735241e-08 1.793055991e-10
            Solving for output 0 - done. Time (sec):  0.0156212
            Solving for output 1 ...
               Iteration (num., iy, grad. norm, func.) :   0   1 1.955493282e+00 4.799845498e+00
               Iteration (num., iy, grad. norm, func.) :   0   1 8.972452140e-07 4.567718425e-08
            Solving for output 1 - done. Time (sec):  0.0178726
         Solving initial startup problem (n=400) - done. Time (sec):  0.0334938
         Solving nonlinear problem (n=400) ...
            Solving for output 0 ...
               Iteration (num., iy, grad. norm, func.) :   0   0 6.652507490e-09 1.793038784e-10
               Iteration (num., iy, grad. norm, func.) :   0   0 5.849530864e-09 1.703953551e-10
               Iteration (num., iy, grad. norm, func.) :   1   0 3.026119118e-08 1.033358002e-10
               Iteration (num., iy, grad. norm, func.) :   2   0 1.124244132e-08 2.502763076e-11
               Iteration (num., iy, grad. norm, func.) :   3   0 3.716624334e-09 1.069397055e-11
               Iteration (num., iy, grad. norm, func.) :   4   0 2.156599976e-09 9.185410025e-12
               Iteration (num., iy, grad. norm, func.) :   5   0 6.117374981e-10 7.356144369e-12
               Iteration (num., iy, grad. norm, func.) :   6   0 1.634984192e-10 6.520846187e-12
               Iteration (num., iy, grad. norm, func.) :   7   0 3.210245246e-11 6.261004148e-12
               Iteration (num., iy, grad. norm, func.) :   8   0 2.549150186e-11 6.258506806e-12
               Iteration (num., iy, grad. norm, func.) :   9   0 1.471638517e-11 6.257588712e-12
               Iteration (num., iy, grad. norm, func.) :  10   0 1.133341700e-11 6.257511725e-12
               Iteration (num., iy, grad. norm, func.) :  11   0 3.893195802e-12 6.256384410e-12
               Iteration (num., iy, grad. norm, func.) :  12   0 1.130684894e-12 6.255762511e-12
               Iteration (num., iy, grad. norm, func.) :  13   0 1.026910429e-12 6.255701028e-12
               Iteration (num., iy, grad. norm, func.) :  14   0 1.584455272e-12 6.255682352e-12
               Iteration (num., iy, grad. norm, func.) :  15   0 3.772463044e-13 6.255651149e-12
            Solving for output 0 - done. Time (sec):  0.1675348
            Solving for output 1 ...
               Iteration (num., iy, grad. norm, func.) :   0   1 9.728856644e-08 4.567640473e-08
               Iteration (num., iy, grad. norm, func.) :   0   1 9.337495225e-08 4.538210157e-08
               Iteration (num., iy, grad. norm, func.) :   1   1 2.791948127e-06 3.155039266e-08
               Iteration (num., iy, grad. norm, func.) :   2   1 8.275304944e-07 4.459920781e-09
               Iteration (num., iy, grad. norm, func.) :   3   1 5.530192329e-07 3.938719023e-09
               Iteration (num., iy, grad. norm, func.) :   4   1 4.625412309e-07 3.226437182e-09
               Iteration (num., iy, grad. norm, func.) :   5   1 1.357185480e-07 8.960620698e-10
               Iteration (num., iy, grad. norm, func.) :   6   1 7.657562967e-08 6.428994523e-10
               Iteration (num., iy, grad. norm, func.) :   7   1 2.256133023e-08 5.304151602e-10
               Iteration (num., iy, grad. norm, func.) :   8   1 2.413627023e-08 5.204364288e-10
               Iteration (num., iy, grad. norm, func.) :   9   1 7.138188474e-09 3.460141827e-10
               Iteration (num., iy, grad. norm, func.) :  10   1 6.442125413e-09 2.791291396e-10
               Iteration (num., iy, grad. norm, func.) :  11   1 3.731819626e-09 2.760526944e-10
               Iteration (num., iy, grad. norm, func.) :  12   1 2.144556373e-09 2.758387713e-10
               Iteration (num., iy, grad. norm, func.) :  13   1 7.067737867e-10 2.756939462e-10
               Iteration (num., iy, grad. norm, func.) :  14   1 3.897646943e-10 2.733207471e-10
               Iteration (num., iy, grad. norm, func.) :  15   1 9.475544403e-11 2.716010809e-10
               Iteration (num., iy, grad. norm, func.) :  16   1 5.093208713e-11 2.714252376e-10
               Iteration (num., iy, grad. norm, func.) :  17   1 4.469206461e-11 2.714102694e-10
               Iteration (num., iy, grad. norm, func.) :  18   1 1.479537369e-11 2.713622143e-10
               Iteration (num., iy, grad. norm, func.) :  19   1 2.119881723e-11 2.713583303e-10
               Iteration (num., iy, grad. norm, func.) :  20   1 2.255262866e-11 2.713553725e-10
               Iteration (num., iy, grad. norm, func.) :  21   1 2.278207268e-11 2.713509621e-10
               Iteration (num., iy, grad. norm, func.) :  22   1 4.970532514e-12 2.713471679e-10
               Iteration (num., iy, grad. norm, func.) :  23   1 8.558323103e-12 2.713468622e-10
               Iteration (num., iy, grad. norm, func.) :  24   1 4.430058647e-12 2.713458173e-10
               Iteration (num., iy, grad. norm, func.) :  25   1 6.949979717e-12 2.713453628e-10
               Iteration (num., iy, grad. norm, func.) :  26   1 1.909219009e-12 2.713451665e-10
               Iteration (num., iy, grad. norm, func.) :  27   1 1.615904818e-12 2.713451132e-10
               Iteration (num., iy, grad. norm, func.) :  28   1 1.430058429e-12 2.713450210e-10
               Iteration (num., iy, grad. norm, func.) :  29   1 8.733556585e-13 2.713449614e-10
            Solving for output 1 - done. Time (sec):  0.2545013
         Solving nonlinear problem (n=400) - done. Time (sec):  0.4220362
      Solving for degrees of freedom - done. Time (sec):  0.4555299
   Training - done. Time (sec):  0.4711571
___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 2500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 2500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000
../../../_images/rans_crm_wing.png

RMTC

from smt.examples.rans_crm_wing.rans_crm_wing import (
    get_rans_crm_wing,
    plot_rans_crm_wing,
)
from smt.surrogate_models import RMTC

xt, yt, xlimits = get_rans_crm_wing()

interp = RMTC(
    num_elements=20, xlimits=xlimits, nonlinear_maxiter=100, energy_weight=1e-10
)
interp.set_training_values(xt, yt)
interp.train()

plot_rans_crm_wing(xt, yt, xlimits, interp)
___________________________________________________________________________

                                   RMTC
___________________________________________________________________________

 Problem size

      # training points.        : 35

___________________________________________________________________________

 Training

   Training ...
      Pre-computing matrices ...
         Computing dof2coeff ...
         Computing dof2coeff - done. Time (sec):  0.0166361
         Initializing Hessian ...
         Initializing Hessian - done. Time (sec):  0.0000000
         Computing energy terms ...
         Computing energy terms - done. Time (sec):  0.0000000
         Computing approximation terms ...
         Computing approximation terms - done. Time (sec):  0.0000000
      Pre-computing matrices - done. Time (sec):  0.0166361
      Solving for degrees of freedom ...
         Solving initial startup problem (n=1764) ...
            Solving for output 0 ...
               Iteration (num., iy, grad. norm, func.) :   0   0 1.279175539e-01 1.114942861e-02
               Iteration (num., iy, grad. norm, func.) :   0   0 3.676209532e-06 2.207093656e-08
            Solving for output 0 - done. Time (sec):  0.0156279
            Solving for output 1 ...
               Iteration (num., iy, grad. norm, func.) :   0   1 2.653045755e+00 4.799845498e+00
               Iteration (num., iy, grad. norm, func.) :   0   1 5.931882707e-05 6.501854582e-06
            Solving for output 1 - done. Time (sec):  0.0338449
         Solving initial startup problem (n=1764) - done. Time (sec):  0.0494728
         Solving nonlinear problem (n=1764) ...
            Solving for output 0 ...
               Iteration (num., iy, grad. norm, func.) :   0   0 8.720952301e-07 2.206099886e-08
               Iteration (num., iy, grad. norm, func.) :   0   0 9.573075853e-07 1.751682593e-08
               Iteration (num., iy, grad. norm, func.) :   1   0 3.547416599e-07 3.272729330e-09
               Iteration (num., iy, grad. norm, func.) :   2   0 1.182883368e-07 1.052930200e-09
               Iteration (num., iy, grad. norm, func.) :   3   0 6.342484570e-08 5.347132081e-10
               Iteration (num., iy, grad. norm, func.) :   4   0 3.376386183e-08 4.104178247e-10
               Iteration (num., iy, grad. norm, func.) :   5   0 2.246568041e-08 3.753037203e-10
               Iteration (num., iy, grad. norm, func.) :   6   0 1.966169575e-08 3.751149837e-10
               Iteration (num., iy, grad. norm, func.) :   7   0 1.521902520e-08 3.661319419e-10
               Iteration (num., iy, grad. norm, func.) :   8   0 1.697219384e-08 3.641704633e-10
               Iteration (num., iy, grad. norm, func.) :   9   0 1.397282892e-08 3.400303102e-10
               Iteration (num., iy, grad. norm, func.) :  10   0 8.820213268e-09 3.088343729e-10
               Iteration (num., iy, grad. norm, func.) :  11   0 2.662753070e-09 2.905736583e-10
               Iteration (num., iy, grad. norm, func.) :  12   0 2.187726215e-09 2.894175993e-10
               Iteration (num., iy, grad. norm, func.) :  13   0 2.187726215e-09 2.894175993e-10
               Iteration (num., iy, grad. norm, func.) :  14   0 2.187726215e-09 2.894175993e-10
               Iteration (num., iy, grad. norm, func.) :  15   0 4.200601330e-09 2.884082916e-10
               Iteration (num., iy, grad. norm, func.) :  16   0 6.941954104e-10 2.872761171e-10
               Iteration (num., iy, grad. norm, func.) :  17   0 1.541077466e-09 2.870609956e-10
               Iteration (num., iy, grad. norm, func.) :  18   0 1.023649448e-09 2.869921846e-10
               Iteration (num., iy, grad. norm, func.) :  19   0 1.212807643e-09 2.869885007e-10
               Iteration (num., iy, grad. norm, func.) :  20   0 8.839931392e-10 2.869758703e-10
               Iteration (num., iy, grad. norm, func.) :  21   0 1.306730857e-09 2.868275046e-10
               Iteration (num., iy, grad. norm, func.) :  22   0 4.704438219e-10 2.866869990e-10
               Iteration (num., iy, grad. norm, func.) :  23   0 5.230973601e-10 2.866251543e-10
               Iteration (num., iy, grad. norm, func.) :  24   0 5.664431546e-10 2.866043737e-10
               Iteration (num., iy, grad. norm, func.) :  25   0 4.828142306e-10 2.865968778e-10
               Iteration (num., iy, grad. norm, func.) :  26   0 5.802434115e-10 2.865861641e-10
               Iteration (num., iy, grad. norm, func.) :  27   0 3.737201709e-10 2.865567794e-10
               Iteration (num., iy, grad. norm, func.) :  28   0 3.858419016e-10 2.865426826e-10
               Iteration (num., iy, grad. norm, func.) :  29   0 2.901589088e-10 2.865289028e-10
               Iteration (num., iy, grad. norm, func.) :  30   0 3.940180990e-10 2.865189697e-10
               Iteration (num., iy, grad. norm, func.) :  31   0 1.690143798e-10 2.865096559e-10
               Iteration (num., iy, grad. norm, func.) :  32   0 1.242855464e-10 2.865072677e-10
               Iteration (num., iy, grad. norm, func.) :  33   0 1.811663536e-10 2.865044243e-10
               Iteration (num., iy, grad. norm, func.) :  34   0 1.534058465e-10 2.865018335e-10
               Iteration (num., iy, grad. norm, func.) :  35   0 1.924068784e-10 2.865004108e-10
               Iteration (num., iy, grad. norm, func.) :  36   0 1.332616182e-10 2.864992145e-10
               Iteration (num., iy, grad. norm, func.) :  37   0 1.465297323e-10 2.864980040e-10
               Iteration (num., iy, grad. norm, func.) :  38   0 1.059898490e-10 2.864964801e-10
               Iteration (num., iy, grad. norm, func.) :  39   0 6.833524389e-11 2.864949969e-10
               Iteration (num., iy, grad. norm, func.) :  40   0 7.187619523e-11 2.864946363e-10
               Iteration (num., iy, grad. norm, func.) :  41   0 8.331579773e-11 2.864944346e-10
               Iteration (num., iy, grad. norm, func.) :  42   0 1.027434435e-10 2.864938961e-10
               Iteration (num., iy, grad. norm, func.) :  43   0 2.785843313e-11 2.864931900e-10
               Iteration (num., iy, grad. norm, func.) :  44   0 4.587732601e-11 2.864931837e-10
               Iteration (num., iy, grad. norm, func.) :  45   0 3.359533850e-11 2.864931000e-10
               Iteration (num., iy, grad. norm, func.) :  46   0 6.378182023e-11 2.864929524e-10
               Iteration (num., iy, grad. norm, func.) :  47   0 2.376264253e-11 2.864927539e-10
               Iteration (num., iy, grad. norm, func.) :  48   0 2.825935022e-11 2.864925180e-10
               Iteration (num., iy, grad. norm, func.) :  49   0 9.565705264e-12 2.864924909e-10
               Iteration (num., iy, grad. norm, func.) :  50   0 9.565696711e-12 2.864924909e-10
               Iteration (num., iy, grad. norm, func.) :  51   0 9.565696216e-12 2.864924909e-10
               Iteration (num., iy, grad. norm, func.) :  52   0 1.321236786e-11 2.864924690e-10
               Iteration (num., iy, grad. norm, func.) :  53   0 3.200038592e-12 2.864924347e-10
               Iteration (num., iy, grad. norm, func.) :  54   0 4.408441668e-12 2.864924282e-10
               Iteration (num., iy, grad. norm, func.) :  55   0 3.685080752e-12 2.864924262e-10
               Iteration (num., iy, grad. norm, func.) :  56   0 5.781840079e-12 2.864924241e-10
               Iteration (num., iy, grad. norm, func.) :  57   0 3.797616430e-12 2.864924225e-10
               Iteration (num., iy, grad. norm, func.) :  58   0 3.375356538e-12 2.864924219e-10
               Iteration (num., iy, grad. norm, func.) :  59   0 3.219911457e-12 2.864924211e-10
               Iteration (num., iy, grad. norm, func.) :  60   0 3.239255276e-12 2.864924194e-10
               Iteration (num., iy, grad. norm, func.) :  61   0 2.217174829e-12 2.864924181e-10
               Iteration (num., iy, grad. norm, func.) :  62   0 1.963609045e-12 2.864924173e-10
               Iteration (num., iy, grad. norm, func.) :  63   0 2.012378650e-12 2.864924172e-10
               Iteration (num., iy, grad. norm, func.) :  64   0 1.904781413e-12 2.864924172e-10
               Iteration (num., iy, grad. norm, func.) :  65   0 3.311811443e-12 2.864924162e-10
               Iteration (num., iy, grad. norm, func.) :  66   0 4.109786374e-13 2.864924155e-10
            Solving for output 0 - done. Time (sec):  1.3435118
            Solving for output 1 ...
               Iteration (num., iy, grad. norm, func.) :   0   1 1.433843609e-05 6.499190122e-06
               Iteration (num., iy, grad. norm, func.) :   0   1 1.433915036e-05 6.252291412e-06
               Iteration (num., iy, grad. norm, func.) :   1   1 1.477636849e-05 8.059381431e-07
               Iteration (num., iy, grad. norm, func.) :   2   1 1.952541750e-05 3.823795195e-07
               Iteration (num., iy, grad. norm, func.) :   3   1 5.882568493e-06 1.304962153e-07
               Iteration (num., iy, grad. norm, func.) :   4   1 4.984583502e-06 1.036536000e-07
               Iteration (num., iy, grad. norm, func.) :   5   1 1.536768676e-06 3.777779455e-08
               Iteration (num., iy, grad. norm, func.) :   6   1 1.481834363e-06 3.211344234e-08
               Iteration (num., iy, grad. norm, func.) :   7   1 1.135248844e-06 3.114497290e-08
               Iteration (num., iy, grad. norm, func.) :   8   1 4.713119283e-07 3.086507410e-08
               Iteration (num., iy, grad. norm, func.) :   9   1 1.724080326e-07 2.442765672e-08
               Iteration (num., iy, grad. norm, func.) :  10   1 1.379805070e-07 1.867418150e-08
               Iteration (num., iy, grad. norm, func.) :  11   1 3.448834100e-08 1.502932128e-08
               Iteration (num., iy, grad. norm, func.) :  12   1 2.795611473e-08 1.473756837e-08
               Iteration (num., iy, grad. norm, func.) :  13   1 2.779055044e-08 1.473754505e-08
               Iteration (num., iy, grad. norm, func.) :  14   1 2.733312548e-08 1.473737843e-08
               Iteration (num., iy, grad. norm, func.) :  15   1 3.340811292e-08 1.460437573e-08
               Iteration (num., iy, grad. norm, func.) :  16   1 6.626498801e-09 1.449141612e-08
               Iteration (num., iy, grad. norm, func.) :  17   1 6.372795316e-09 1.448986180e-08
               Iteration (num., iy, grad. norm, func.) :  18   1 6.929167016e-09 1.448716836e-08
               Iteration (num., iy, grad. norm, func.) :  19   1 7.274804838e-09 1.448420494e-08
               Iteration (num., iy, grad. norm, func.) :  20   1 6.352089406e-09 1.448163589e-08
               Iteration (num., iy, grad. norm, func.) :  21   1 9.972423160e-09 1.447591555e-08
               Iteration (num., iy, grad. norm, func.) :  22   1 3.304064579e-09 1.447128338e-08
               Iteration (num., iy, grad. norm, func.) :  23   1 5.841019525e-09 1.447072301e-08
               Iteration (num., iy, grad. norm, func.) :  24   1 3.393827849e-09 1.446954458e-08
               Iteration (num., iy, grad. norm, func.) :  25   1 5.071952469e-09 1.446824634e-08
               Iteration (num., iy, grad. norm, func.) :  26   1 1.833014270e-09 1.446634336e-08
               Iteration (num., iy, grad. norm, func.) :  27   1 2.578318428e-09 1.446596197e-08
               Iteration (num., iy, grad. norm, func.) :  28   1 1.739541145e-09 1.446570654e-08
               Iteration (num., iy, grad. norm, func.) :  29   1 3.299993919e-09 1.446528512e-08
               Iteration (num., iy, grad. norm, func.) :  30   1 1.127306394e-09 1.446463680e-08
               Iteration (num., iy, grad. norm, func.) :  31   1 1.593374769e-09 1.446424957e-08
               Iteration (num., iy, grad. norm, func.) :  32   1 6.758050764e-10 1.446401646e-08
               Iteration (num., iy, grad. norm, func.) :  33   1 7.726504616e-10 1.446396254e-08
               Iteration (num., iy, grad. norm, func.) :  34   1 7.572925345e-10 1.446391812e-08
               Iteration (num., iy, grad. norm, func.) :  35   1 1.283660448e-09 1.446384601e-08
               Iteration (num., iy, grad. norm, func.) :  36   1 5.394268295e-10 1.446377167e-08
               Iteration (num., iy, grad. norm, func.) :  37   1 7.452734477e-10 1.446371202e-08
               Iteration (num., iy, grad. norm, func.) :  38   1 3.669013694e-10 1.446365827e-08
               Iteration (num., iy, grad. norm, func.) :  39   1 8.262896904e-10 1.446361117e-08
               Iteration (num., iy, grad. norm, func.) :  40   1 1.468229194e-10 1.446358692e-08
               Iteration (num., iy, grad. norm, func.) :  41   1 1.058490893e-10 1.446358652e-08
               Iteration (num., iy, grad. norm, func.) :  42   1 3.077890236e-10 1.446358444e-08
               Iteration (num., iy, grad. norm, func.) :  43   1 1.530864773e-10 1.446357588e-08
               Iteration (num., iy, grad. norm, func.) :  44   1 2.233487372e-10 1.446357055e-08
               Iteration (num., iy, grad. norm, func.) :  45   1 1.072821261e-10 1.446356870e-08
               Iteration (num., iy, grad. norm, func.) :  46   1 1.569858063e-10 1.446356792e-08
               Iteration (num., iy, grad. norm, func.) :  47   1 8.002372946e-11 1.446356534e-08
               Iteration (num., iy, grad. norm, func.) :  48   1 1.161997835e-10 1.446356372e-08
               Iteration (num., iy, grad. norm, func.) :  49   1 5.406312319e-11 1.446356185e-08
               Iteration (num., iy, grad. norm, func.) :  50   1 8.972085170e-11 1.446356112e-08
               Iteration (num., iy, grad. norm, func.) :  51   1 4.637381040e-11 1.446356084e-08
               Iteration (num., iy, grad. norm, func.) :  52   1 8.212169076e-11 1.446356071e-08
               Iteration (num., iy, grad. norm, func.) :  53   1 3.865629403e-11 1.446356017e-08
               Iteration (num., iy, grad. norm, func.) :  54   1 5.417993980e-11 1.446355996e-08
               Iteration (num., iy, grad. norm, func.) :  55   1 2.747884329e-11 1.446355971e-08
               Iteration (num., iy, grad. norm, func.) :  56   1 3.802715340e-11 1.446355954e-08
               Iteration (num., iy, grad. norm, func.) :  57   1 1.973480070e-11 1.446355943e-08
               Iteration (num., iy, grad. norm, func.) :  58   1 1.656900358e-11 1.446355939e-08
               Iteration (num., iy, grad. norm, func.) :  59   1 2.083227248e-11 1.446355934e-08
               Iteration (num., iy, grad. norm, func.) :  60   1 1.866621335e-11 1.446355929e-08
               Iteration (num., iy, grad. norm, func.) :  61   1 1.548239675e-11 1.446355925e-08
               Iteration (num., iy, grad. norm, func.) :  62   1 1.590006746e-11 1.446355920e-08
               Iteration (num., iy, grad. norm, func.) :  63   1 7.464996577e-12 1.446355917e-08
               Iteration (num., iy, grad. norm, func.) :  64   1 7.029534858e-12 1.446355917e-08
               Iteration (num., iy, grad. norm, func.) :  65   1 7.635808483e-12 1.446355917e-08
               Iteration (num., iy, grad. norm, func.) :  66   1 8.725141256e-12 1.446355916e-08
               Iteration (num., iy, grad. norm, func.) :  67   1 4.683846749e-12 1.446355916e-08
               Iteration (num., iy, grad. norm, func.) :  68   1 5.446573952e-12 1.446355915e-08
               Iteration (num., iy, grad. norm, func.) :  69   1 5.379658352e-12 1.446355915e-08
               Iteration (num., iy, grad. norm, func.) :  70   1 2.634341766e-12 1.446355915e-08
               Iteration (num., iy, grad. norm, func.) :  71   1 5.631339248e-12 1.446355915e-08
               Iteration (num., iy, grad. norm, func.) :  72   1 2.582076096e-12 1.446355915e-08
               Iteration (num., iy, grad. norm, func.) :  73   1 2.859607680e-12 1.446355915e-08
               Iteration (num., iy, grad. norm, func.) :  74   1 1.390873167e-12 1.446355915e-08
               Iteration (num., iy, grad. norm, func.) :  75   1 1.372832255e-12 1.446355915e-08
               Iteration (num., iy, grad. norm, func.) :  76   1 1.039726926e-12 1.446355915e-08
               Iteration (num., iy, grad. norm, func.) :  77   1 1.656395559e-12 1.446355915e-08
               Iteration (num., iy, grad. norm, func.) :  78   1 9.864571633e-13 1.446355915e-08
            Solving for output 1 - done. Time (sec):  1.5652311
         Solving nonlinear problem (n=1764) - done. Time (sec):  2.9087429
      Solving for degrees of freedom - done. Time (sec):  2.9582157
   Training - done. Time (sec):  2.9748518
___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0010328

   Prediction time/pt. (sec) :  0.0000021

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0020578

   Prediction time/pt. (sec) :  0.0000041

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 2500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000

___________________________________________________________________________

 Evaluation

      # eval points. : 2500

   Predicting ...
   Predicting - done. Time (sec):  0.0000000

   Prediction time/pt. (sec) :  0.0000000
../../../_images/rans_crm_wing.png