コード例 #1
0
    def compute_partials(self, inputs, J):

        # rename
        rho = inputs['rho']
        U = inputs['U']
        d = inputs['d']
        mu = inputs['mu']
        beta = inputs['beta']

        # dynamic pressure
        q = 0.5 * rho * U**2

        # Reynolds number and drag
        if float(inputs['cd_usr']) < 0.:
            Re = rho * U * d / mu
            cd, dcd_dRe = cylinderDrag(Re)
        else:
            cd = inputs['cd_usr']
            Re = 1.0
            dcd_dRe = 0.0

        # derivatives
        dq_dU = rho * U
        const = (dq_dU * cd + q * dcd_dRe * rho * d / mu) * d
        dPx_dU = const * cosd(beta)
        dPy_dU = const * sind(beta)

        const = (cd + dcd_dRe * Re) * q
        dPx_dd = const * cosd(beta)
        dPy_dd = const * sind(beta)

        n = len(inputs['z'])

        zeron = np.zeros((n, n))

        J['windLoads_Px', 'U'] = np.diag(dPx_dU)
        J['windLoads_Px', 'z'] = zeron
        J['windLoads_Px', 'd'] = np.diag(dPx_dd)

        J['windLoads_Py', 'U'] = np.diag(dPy_dU)
        J['windLoads_Py', 'z'] = zeron
        J['windLoads_Py', 'd'] = np.diag(dPy_dd)

        J['windLoads_Pz', 'U'] = zeron
        J['windLoads_Pz', 'z'] = zeron
        J['windLoads_Pz', 'd'] = zeron

        J['windLoads_qdyn', 'U'] = np.diag(dq_dU)
        J['windLoads_qdyn', 'z'] = zeron
        J['windLoads_qdyn', 'd'] = zeron

        J['windLoads_z', 'U'] = zeron
        J['windLoads_z', 'z'] = np.eye(n)
        J['windLoads_z', 'd'] = zeron
コード例 #2
0
ファイル: wind_wave_drag.py プロジェクト: maitimalay3/WISDEM
    def compute(self, inputs, outputs):

        rho = inputs["rho_air"]
        U = inputs["U"]
        d = inputs["d"]
        mu = inputs["mu_air"]
        beta = inputs["beta_wind"]

        # dynamic pressure
        q = 0.5 * rho * U**2

        # Reynolds number and drag
        if float(inputs["cd_usr"]) < 0.0:
            Re = rho * U * d / mu
            cd, dcd_dRe = cylinderDrag(Re)
        else:
            cd = inputs["cd_usr"]
            Re = 1.0
            dcd_dRe = 0.0
        Fp = q * cd * d

        # components of distributed loads
        Px = Fp * cosd(beta)
        Py = Fp * sind(beta)
        Pz = 0 * Fp

        # pack data
        outputs["windLoads_Px"] = Px
        outputs["windLoads_Py"] = Py
        outputs["windLoads_Pz"] = Pz
        outputs["windLoads_qdyn"] = q
        outputs["windLoads_z"] = inputs["z"]
        outputs["windLoads_beta"] = beta
コード例 #3
0
ファイル: WindWaveDrag.py プロジェクト: nikhar-abbas/WEIS
    def compute(self, inputs, outputs):

        rho = inputs['rho_air']
        U = inputs['U']
        d = inputs['d']
        mu = inputs['mu_air']
        beta = inputs['beta_wind']

        # dynamic pressure
        q = 0.5 * rho * U**2

        # Reynolds number and drag
        if float(inputs['cd_usr']) < 0.:
            Re = rho * U * d / mu
            cd, dcd_dRe = cylinderDrag(Re)
        else:
            cd = inputs['cd_usr']
            Re = 1.0
            dcd_dRe = 0.0
        Fp = q * cd * d

        # components of distributed loads
        Px = Fp * cosd(beta)
        Py = Fp * sind(beta)
        Pz = 0 * Fp

        # pack data
        outputs['windLoads_Px'] = Px
        outputs['windLoads_Py'] = Py
        outputs['windLoads_Pz'] = Pz
        outputs['windLoads_qdyn'] = q
        outputs['windLoads_z'] = inputs['z']
        outputs['windLoads_beta'] = beta
コード例 #4
0
ファイル: wind_wave_drag.py プロジェクト: maitimalay3/WISDEM
    def compute_partials(self, inputs, J):

        # wlevel = inputs['wlevel']
        # if wlevel > 0.0: wlevel *= -1.0

        rho = inputs["rho_water"]
        U = inputs["U"]
        # U0 = inputs['U0']
        d = inputs["d"]
        # zrel= inputs['z']-wlevel
        mu = inputs["mu_water"]
        beta = inputs["beta_wave"]
        # beta0 = inputs['beta0']

        # dynamic pressure
        q = 0.5 * rho * U**2
        # q0= 0.5*rho*U0**2

        # Reynolds number and drag
        if float(inputs["cd_usr"]) < 0.0:
            cd = inputs["cd_usr"] * np.ones_like(d)
            Re = 1.0
            dcd_dRe = 0.0
        else:
            Re = rho * U * d / mu
            cd, dcd_dRe = cylinderDrag(Re)

        # derivatives
        dq_dU = rho * U
        const = (dq_dU * cd + q * dcd_dRe * rho * d / mu) * d
        dPx_dU = const * cosd(beta)
        dPy_dU = const * sind(beta)

        const = (cd + dcd_dRe * Re) * q + rho * inputs[
            "cm"] * math.pi / 4.0 * 2 * d * inputs["A"]
        dPx_dd = const * cosd(beta)
        dPy_dd = const * sind(beta)

        const = rho * inputs["cm"] * math.pi / 4.0 * d**2
        dPx_dA = const * cosd(beta)
        dPy_dA = const * sind(beta)

        J["waveLoads_Px", "A"] = dPx_dA
        J["waveLoads_Py", "A"] = dPy_dA
        J["waveLoads_qdyn", "U"] = dq_dU
        J["waveLoads_pt", "U"] = dq_dU
コード例 #5
0
ファイル: wind_wave_drag.py プロジェクト: maitimalay3/WISDEM
    def compute_partials(self, inputs, J):

        # rename
        rho = inputs["rho_air"]
        U = inputs["U"]
        d = inputs["d"]
        mu = inputs["mu_air"]
        beta = inputs["beta_wind"]

        # dynamic pressure
        q = 0.5 * rho * U**2

        # Reynolds number and drag
        if float(inputs["cd_usr"]) < 0.0:
            Re = rho * U * d / mu
            cd, dcd_dRe = cylinderDrag(Re)
        else:
            cd = inputs["cd_usr"]
            Re = 1.0
            dcd_dRe = 0.0

        # derivatives
        dq_dU = rho * U
        const = (dq_dU * cd + q * dcd_dRe * rho * d / mu) * d
        dPx_dU = const * cosd(beta)
        dPy_dU = const * sind(beta)

        const = (cd + dcd_dRe * Re) * q
        dPx_dd = const * cosd(beta)
        dPy_dd = const * sind(beta)

        J["windLoads_Px", "U"] = dPx_dU
        J["windLoads_Px", "d"] = dPx_dd

        J["windLoads_Py", "U"] = dPy_dU
        J["windLoads_Py", "d"] = dPy_dd

        J["windLoads_qdyn", "U"] = dq_dU
コード例 #6
0
ファイル: WindWaveDrag.py プロジェクト: nikhar-abbas/WEIS
    def compute_partials(self, inputs, J):

        # rename
        rho = inputs['rho_air']
        U = inputs['U']
        d = inputs['d']
        mu = inputs['mu_air']
        beta = inputs['beta_wind']

        # dynamic pressure
        q = 0.5 * rho * U**2

        # Reynolds number and drag
        if float(inputs['cd_usr']) < 0.:
            Re = rho * U * d / mu
            cd, dcd_dRe = cylinderDrag(Re)
        else:
            cd = inputs['cd_usr']
            Re = 1.0
            dcd_dRe = 0.0

        # derivatives
        dq_dU = rho * U
        const = (dq_dU * cd + q * dcd_dRe * rho * d / mu) * d
        dPx_dU = const * cosd(beta)
        dPy_dU = const * sind(beta)

        const = (cd + dcd_dRe * Re) * q
        dPx_dd = const * cosd(beta)
        dPy_dd = const * sind(beta)

        J['windLoads_Px', 'U'] = dPx_dU
        J['windLoads_Px', 'd'] = dPx_dd

        J['windLoads_Py', 'U'] = dPy_dU
        J['windLoads_Py', 'd'] = dPy_dd

        J['windLoads_qdyn', 'U'] = dq_dU
コード例 #7
0
ファイル: wind_wave_drag.py プロジェクト: maitimalay3/WISDEM
    def compute(self, inputs, outputs):

        # wlevel = inputs['wlevel']
        # if wlevel > 0.0: wlevel *= -1.0

        rho = inputs["rho_water"]
        U = inputs["U"]
        # U0 = inputs['U0']
        d = inputs["d"]
        # zrel= inputs['z']-wlevel
        mu = inputs["mu_water"]
        beta = inputs["beta_wave"]
        # beta0 = inputs['beta0']

        # dynamic pressure
        q = 0.5 * rho * U * np.abs(U)
        # q0= 0.5*rho*U0**2

        # Reynolds number and drag
        if float(inputs["cd_usr"]) < 0.0:
            Re = rho * U * d / mu
            cd, dcd_dRe = cylinderDrag(Re)
        else:
            cd = inputs["cd_usr"] * np.ones_like(d)
            Re = 1.0
            dcd_dRe = 0.0

        # inertial and drag forces
        Fi = rho * inputs["cm"] * math.pi / 4.0 * d**2 * inputs[
            "A"]  # Morrison's equation
        Fd = q * cd * d
        Fp = Fi + Fd

        # components of distributed loads
        Px = Fp * cosd(beta)
        Py = Fp * sind(beta)
        Pz = 0.0 * Fp

        # FORCES [N/m] AT z=0 m
        # idx0 = np.abs(zrel).argmin()  # closest index to z=0, used to find d at z=0
        # d0 = d[idx0]  # initialize
        # cd0 = cd[idx0]  # initialize
        # if (zrel[idx0]<0.) and (idx0< (zrel.size-1)):       # point below water
        #    d0 = np.mean(d[idx0:idx0+2])
        #    cd0 = np.mean(cd[idx0:idx0+2])
        # elif (zrel[idx0]>0.) and (idx0>0):     # point above water
        #    d0 = np.mean(d[idx0-1:idx0+1])
        #    cd0 = np.mean(cd[idx0-1:idx0+1])
        # Fi0 = rho*inputs['cm']*math.pi/4.0*d0**2*inputs['A0']  # Morrison's equation
        # Fd0 = q0*cd0*d0
        # Fp0 = Fi0 + Fd0

        # Px0 = Fp0*cosd(beta0)
        # Py0 = Fp0*sind(beta0)
        # Pz0 = 0.*Fp0

        # Store qties at z=0 MSL
        # outputs['waveLoads_Px0'] = Px0
        # outputs['waveLoads_Py0'] = Py0
        # outputs['waveLoads_Pz0'] = Pz0
        # outputs['waveLoads_qdyn0'] = q0
        # outputs['waveLoads_beta0'] = beta0

        # pack data
        outputs["waveLoads_Px"] = Px
        outputs["waveLoads_Py"] = Py
        outputs["waveLoads_Pz"] = Pz
        outputs["waveLoads_qdyn"] = q
        outputs["waveLoads_pt"] = q + inputs["p"]
        outputs["waveLoads_z"] = inputs["z"]
        outputs["waveLoads_beta"] = beta
コード例 #8
0
    def compute_partials(self, inputs, J):

        #wlevel = inputs['wlevel']
        #if wlevel > 0.0: wlevel *= -1.0

        rho = inputs['rho']
        U = inputs['U']
        #U0 = inputs['U0']
        d = inputs['d']
        #zrel= inputs['z']-wlevel
        mu = inputs['mu']
        beta = inputs['beta']
        #beta0 = inputs['beta0']

        # dynamic pressure
        q = 0.5 * rho * U**2
        #q0= 0.5*rho*U0**2

        # Reynolds number and drag
        if float(inputs['cd_usr']) < 0.:
            cd = inputs['cd_usr'] * np.ones_like(d)
            Re = 1.0
            dcd_dRe = 0.0
        else:
            Re = rho * U * d / mu
            cd, dcd_dRe = cylinderDrag(Re)

        # derivatives
        dq_dU = rho * U
        const = (dq_dU * cd + q * dcd_dRe * rho * d / mu) * d
        dPx_dU = const * cosd(beta)
        dPy_dU = const * sind(beta)

        const = (cd + dcd_dRe * Re) * q + rho * inputs[
            'cm'] * math.pi / 4.0 * 2 * d * inputs['A']
        dPx_dd = const * cosd(beta)
        dPy_dd = const * sind(beta)

        const = rho * inputs['cm'] * math.pi / 4.0 * d**2
        dPx_dA = const * cosd(beta)
        dPy_dA = const * sind(beta)

        n = len(inputs['z'])

        zeron = np.zeros((n, n))

        J['waveLoads.Px', 'U'] = np.diag(dPx_dU)
        J['waveLoads.Px', 'A'] = np.diag(dPx_dA)
        J['waveLoads.Px', 'z'] = zeron
        J['waveLoads.Px', 'd'] = np.diag(dPx_dd)
        J['waveLoads.Px', 'p'] = zeron

        J['waveLoads.Py', 'U'] = np.diag(dPy_dU)
        J['waveLoads.Py', 'A'] = np.diag(dPy_dA)
        J['waveLoads.Py', 'z'] = zeron
        J['waveLoads.Py', 'd'] = np.diag(dPy_dd)
        J['waveLoads.Py', 'p'] = zeron

        J['waveLoads.Pz', 'U'] = zeron
        J['waveLoads.Pz', 'A'] = zeron
        J['waveLoads.Pz', 'z'] = zeron
        J['waveLoads.Pz', 'd'] = zeron
        J['waveLoads.Pz', 'p'] = zeron

        J['waveLoads.qdyn', 'U'] = np.diag(dq_dU)
        J['waveLoads.qdyn', 'A'] = zeron
        J['waveLoads.qdyn', 'z'] = zeron
        J['waveLoads.qdyn', 'd'] = zeron
        J['waveLoads.qdyn', 'p'] = zeron

        J['waveLoads.pt', 'U'] = np.diag(dq_dU)
        J['waveLoads.pt', 'A'] = zeron
        J['waveLoads.pt', 'z'] = zeron
        J['waveLoads.pt', 'd'] = zeron
        J['waveLoads.pt', 'p'] = 1.0

        J['waveLoads.z', 'U'] = zeron
        J['waveLoads.z', 'A'] = zeron
        J['waveLoads.z', 'z'] = np.eye(n)
        J['waveLoads.z', 'd'] = zeron
        J['waveLoads.z', 'p'] = zeron