Esempio n. 1
0
    def _create_and_load_hydro_data_obj(self):
        '''
        Function to load hydrodynamic data into HydrodynamicData object
        '''
        for i in xrange(self.cal.n_bods):
            self.body[i] = bem.HydrodynamicData()
            self.body[i].am.all = self.am[0 + 6 * i:6 + 6 * i, :]
            self.body[i].rd.all = self.rd[0 + 6 * i:6 + 6 * i, :]

            self.body[i].ex.mag = self.ex_mag[0 + 6 * i:6 + 6 * i, :, :]
            self.body[i].ex.phase = self.ex_phase[0 + 6 * i:6 + 6 * i, :, :]
            self.body[i].ex.im = self.ex_im[0 + 6 * i:6 + 6 * i, :, :]
            self.body[i].ex.re = self.ex_re[0 + 6 * i:6 + 6 * i, :, :]

            self.body[i].am.inf = self.am_inf[0 + 6 * i:6 + 6 * i, :]

            self.body[i].w = self.w
            self.body[i].T = 2. * np.pi / self.w

            self.body[i].water_depth = self.cal.water_depth
            self.body[i].g = self.cal.g
            self.body[i].rho = self.cal.rho
            self.body[i].cg = self.cal.cg[i]

            self.body[i].bem_code = 'NEMOH'
            self.body[i].bem_raw_data = self.raw_output

            self.body[i].body_num = i
            self.body[i].name = self.cal.name[i]
            self.body[i].num_bodies = self.cal.n_bods
            self.body[i].scaled = self.scaled
            self.body[i].wave_dir = self.cal.wave_dir

            self.body[i].scale(
                self.scaled_at_read
            )  # Note... this is missing the KH nondimensionalization because of where it is called
Esempio n. 2
0
    def _read(self, list_file):
        code = 'AQWA'

        with open(self.files['out'], 'r') as fid:
            raw = fid.readlines()

        first_line = 0

        for i, line in enumerate(raw):

            if (first_line == 0) and (line[0] == "*"):
                continue
            else:
                first_line += 1
            if first_line == 1:
                tmp = np.array(raw[i].split()).astype(np.float)
                num_bodies = int(tmp[0])
                num_wave_directions = int(tmp[1])
                num_frequencies = int(tmp[2])
                num_lines_wave_directions = int(ceil(num_wave_directions / 6.))
                num_lines_frequencies = int(ceil(num_frequencies / 6.))
                for j in range(num_lines_wave_directions):
                    if j == 0:
                        wave_directions = tmp[3:]
                    else:
                        tmp = np.array(raw[i + j].split()).astype(np.float)
                        wave_directions = np.append(wave_directions, tmp)
                for j in range(num_lines_frequencies):
                    tmp = np.array(raw[i + num_lines_wave_directions +
                                       j].split()).astype(np.float)
                    if j == 0:
                        frequencies = tmp
                    else:
                        frequencies = np.append(frequencies, tmp)

            if 'GENERAL' in line:
                tmp = np.array(raw[i + 1].split()).astype(np.float)
                water_depth = tmp[0]
                density = tmp[1]
                gravity = tmp[2]
                # symmetry = tmp[3]

            if 'DRAFT' in line:
                draft = {}
                for iBod in range(num_bodies):
                    tmp = np.array(raw[i + iBod + 1].split()).astype(np.float)
                    tmp2 = int(tmp[0])
                    draft[tmp2] = tmp[1]

            if 'COG' in line:
                cg = {}
                for iBod in range(num_bodies):
                    tmp = np.array(raw[i + iBod + 1].split()).astype(np.float)
                    tmp2 = int(tmp[0])
                    cg[tmp2] = tmp[1:]

            if line.split()[0] == 'MASS':
                mass_matrix = {}
                for iBod in range(num_bodies):
                    for iRow in range(6):
                        tmp = np.array(raw[i + iBod * 6 + iRow +
                                           1].split()).astype(np.float)
                        if iRow == 0:
                            tmp2 = int(tmp[0])
                            mass_matrix[tmp2] = tmp[1:]
                        else:
                            mass_matrix[tmp2] = np.vstack(
                                [mass_matrix[tmp2], tmp])

            if 'HYDSTIFFNESS' in line:
                stiffness_matrix = {}
                for iBod in range(num_bodies):
                    for iRow in range(6):
                        tmp = np.array(raw[i + iBod * 6 + iRow +
                                           1].split()).astype(np.float)
                        if iRow == 0:
                            tmp2 = int(tmp[0])
                            stiffness_matrix[tmp2] = tmp[1:]
                        else:
                            stiffness_matrix[tmp2] = np.vstack(
                                [stiffness_matrix[tmp2], tmp])

            if 'ADDEDMASS' in line:
                added_mass = {}
                for iBod1 in range(num_bodies):
                    for iBod2 in range(num_bodies):
                        for iFreq in range(num_frequencies):
                            for iRow in range(6):
                                tmp = np.array(
                                    raw[i + iBod1 *
                                        (num_bodies * num_frequencies * 6) +
                                        iBod2 * num_frequencies * 6 +
                                        iFreq * 6 + iRow + 1].split()).astype(
                                            np.float)
                                if (iBod2 == 0) and (iFreq == 0) and (iRow
                                                                      == 0):
                                    tmp2 = tmp[0:3].astype(np.float).astype(
                                        np.int)
                                    added_mass[tmp2[0]] = np.zeros(
                                        [6, 6 * num_bodies, num_frequencies])
                                    added_mass[tmp2[0]][:, iBod2 * 6 + iRow,
                                                        iFreq] = tmp[3:]
                                elif iRow == 0:
                                    tmp2 = tmp[0:3].astype(np.float).astype(
                                        np.int)
                                    added_mass[tmp2[0]][:, iBod2 * 6 + iRow,
                                                        iFreq] = tmp[3:]
                                else:
                                    added_mass[tmp2[0]][:, iBod2 * 6 + iRow,
                                                        iFreq] = tmp

            if 'DAMPING' in line:
                radiation_damping = {}
                for iBod1 in range(num_bodies):
                    for iBod2 in range(num_bodies):
                        for iFreq in range(num_frequencies):
                            for iRow in range(6):
                                tmp = np.array(
                                    raw[i + iBod1 *
                                        (num_bodies * num_frequencies * 6) +
                                        iBod2 * num_frequencies * 6 +
                                        iFreq * 6 + iRow + 1].split()).astype(
                                            np.float)
                                if (iBod2 == 0) and (iFreq == 0) and (iRow
                                                                      == 0):
                                    tmp2 = tmp[0:3].astype(np.float).astype(
                                        np.int)
                                    radiation_damping[tmp2[0]] = np.zeros(
                                        [6, 6 * num_bodies, num_frequencies])
                                    radiation_damping[tmp2[0]][:, iBod2 * 6 +
                                                               iRow,
                                                               iFreq] = tmp[3:]
                                elif iRow == 0:
                                    tmp2 = tmp[0:3].astype(np.float).astype(
                                        np.int)
                                    radiation_damping[tmp2[0]][:, iBod2 * 6 +
                                                               iRow,
                                                               iFreq] = tmp[3:]
                                else:
                                    radiation_damping[tmp2[0]][:, iBod2 * 6 +
                                                               iRow,
                                                               iFreq] = tmp

            if 'FIDD' in line:
                fidd = {}
                for iBod in range(num_bodies):
                    tmp = np.array(raw[i + iBod + 1].split()).astype(np.float)
                    tmp2 = int(tmp[0])
                    fidd[tmp2] = tmp[1:]

            if 'FORCERAO' in line:
                excitation_magnitude = {}
                excitation_phase = {}
                for iBod in range(num_bodies):
                    for iDir in range(num_wave_directions):
                        for iFreq in range(num_frequencies):
                            tmp1_1 = np.array(
                                raw[i + iBod *
                                    (num_wave_directions * num_frequencies * 2)
                                    + iDir * num_frequencies * 2 + iFreq * 2 +
                                    1].split()).astype(np.float)
                            tmp1_2 = np.array(
                                raw[i + iBod *
                                    (num_wave_directions * num_frequencies * 2)
                                    + iDir * num_frequencies * 2 + iFreq * 2 +
                                    2].split()).astype(np.float)
                            tmp2 = tmp1_1[0:3].astype(np.float).astype(np.int)
                            if (iDir == 0) and (iFreq == 0):
                                excitation_magnitude[tmp2[0]] = np.zeros(
                                    [6, num_wave_directions, num_frequencies])
                                excitation_phase[tmp2[0]] = np.zeros(
                                    [6, num_wave_directions, num_frequencies])
                            excitation_magnitude[tmp2[0]][:, tmp2[1] - 1,
                                                          tmp2[2] -
                                                          1] = tmp1_1[3:]
                            excitation_phase[tmp2[0]][:, tmp2[1] - 1,
                                                      tmp2[2] - 1] = tmp1_2

        with open(list_file, 'r') as fid:
            raw_list = fid.readlines()
        bod_count = 1
        disp_vol = {}
        for i, line in enumerate(raw_list):
            if 'MESH BASED DISPLACEMENT' in line:
                disp_vol[bod_count] = np.array(line.split())[-1].astype(float)
                bod_count += 1

        for i in xrange(num_bodies):

            print 'body' + str(i + 1) + ':'

            self.body[i] = bem.HydrodynamicData()
            self.body[i].scaled = self.scaled

            self.body[i].rho = density
            self.body[i].g = gravity
            self.body[i].wave_dir = wave_directions
            self.body[i].num_bodies = num_bodies

            self.body[i].cg = cg[i + 1]
            self.body[i].cb = 'not_defined'
            self.body[i].k = stiffness_matrix[i + 1]
            self.body[i].T = 2 * np.pi / frequencies
            self.body[i].w = frequencies

            self.body[i].wp_area = 'not_defined'
            self.body[i].buoy_force = 'not_defined'
            self.body[i].disp_vol = disp_vol[i + 1]
            self.body[i].water_depth = water_depth
            self.body[i].body_num = i

            self.body[i].name = 'body' + str(i + 1)
            self.body[i].bem_code = code
            self.body[i].bem_raw_data = raw

            self.body[i].am.all = added_mass[i + 1]
            print '   * Setting added mass at infinite frequency to added mass at omega = ' + str(
                frequencies[-1])
            self.body[i].am.inf = added_mass[i + 1][:, :, -1]
            print '   * Setting added mass at zero frequency to added mass at omega = ' + str(
                frequencies[0])
            self.body[i].am.zero = added_mass[i + 1][:, :, 0]
            self.body[i].rd.all = radiation_damping[i + 1]
            self.body[i].ex.mag = excitation_magnitude[i + 1]
            self.body[i].ex.phase = excitation_phase[i + 1]
            print '   * Calculating real and imaginary excitation  components.'
            self.body[i].ex.re = self.body[i].ex.mag * np.cos(
                self.body[i].ex.phase)
            self.body[i].ex.im = self.body[i].ex.mag * np.sin(
                self.body[i].ex.phase)

            self.body[i].scale(self.scaled_at_read)
Esempio n. 3
0
    def _read(self):
        '''Internal function to read WAMIT output file into the class. that is called during __init__
        '''

        print '\nReading the WAMIT results in the ' + self.files[
            'out'] + ' file'

        with open(self.files['out'], 'rU') as fid:

            raw = fid.readlines()

        code = 'WAMIT'
        num_bodies = 0  # Total number of bodies
        bod_count = 0  # Counter for bodies
        T = []
        cg = {}
        cb = {}
        name = {}
        disp_vol = {}
        k = {}
        wave_dir = []
        empty_line = '\n'

        for i, line in enumerate(raw):

            if "POTEN run date and starting time:" in line:

                skip = 2
                data = raw[i + skip]
                count = 0

                while data != empty_line:

                    if float(data.split()[0]) == 0. or float(
                            data.split()[0]) == -1.:
                        count += 1
                        data = raw[i + count + skip]

                    else:
                        count += 1
                        T.append(float(data.split()[0]))
                        data = raw[i + count + skip]

            if "Wave Heading (deg)" in line:
                wave_dir.append(float(line.split()[-1]))

            if 'Water depth:' in line:
                water_depth = raw[i].split()[2]
                try:
                    water_depth = np.float(water_depth)
                except:
                    pass

            # If there is one body in the WAMIT run
            if "Input from Geometric Data File:" in line:

                num_bodies = 1
                name[0] = raw[i].split()[-1]

            # If there are two bodies in the WAMIT run
            if "Input from Geometric Data Files:" in line:

                for j in xrange(
                        20):  # look for bodies within the next 20 lines

                    if "N=" in raw[i + j]:

                        num_bodies += 1
                        name[num_bodies - 1] = raw[i + j].split()[-1]

            # Read the body positions
            # if "Total panels:" in line or "NPATCH:" in line:
            if "XBODY" in line:
                for j in xrange(
                        12
                ):  # look for position within the next 15 lines - will only work for wamit files of about 5 bodies

                    if 'XBODY =' in raw[i + j]:
                        '''
                        Note that this is the XBOD YBOD ZBOD defined in the wamit .out file, not the cg as defined in the wamit file
                        '''

                        temp = raw[i + j].split()
                        cg[bod_count] = np.array([temp[2], temp[5],
                                                  temp[8]]).astype(float)

                    if 'Volumes (VOLX,VOLY,VOLZ):' in raw[i + j]:

                        temp = raw[i + j].split()
                        disp_vol[bod_count] = float(temp[-1])

                    if 'Center of Buoyancy (Xb,Yb,Zb):' in raw[i + j]:

                        temp = raw[i + j].split()
                        cb[bod_count] = np.array(
                            [temp[-3], temp[-2], temp[-1]]).astype(float)

                    if 'C(3,3),C(3,4),C(3,5):' in raw[i + j]:

                        temp = np.zeros([6, 6])
                        temp2 = raw[i + j].split()
                        temp[2, 2] = np.float(temp2[1])
                        temp[2, 3] = np.float(temp2[2])
                        temp[2, 4] = np.float(temp2[3])
                        temp[3, 2] = temp[2, 3]
                        temp[4, 2] = temp[2, 4]

                        temp2 = raw[i + j + 1].split()
                        temp[3, 3] = np.float(temp2[1])
                        temp[3, 4] = np.float(temp2[2])
                        temp[3, 5] = np.float(temp2[3])
                        temp[4, 3] = temp[3, 4]
                        temp[5, 3] = temp[3, 5]

                        temp2 = raw[i + j + 2].split()
                        temp[4, 4] = np.float(temp2[1])
                        temp[4, 5] = np.float(temp2[2])
                        temp[5, 4] = temp[4, 5]

                        k[bod_count] = temp

                bod_count += 1

        # Put things into numpy arrays
        T = np.array(T).astype(float)
        wave_dir = np.array(wave_dir).astype(float)

        # Only select the wave headings once
        temp = 999999
        temp_wave_dir = []
        count = 0

        while temp != wave_dir[0]:

            count += 1
            temp_wave_dir.append(wave_dir[count - 1])
            temp = wave_dir[count]

        wave_dir = np.array(temp_wave_dir).astype(float)

        # Read added mass and rad damping
        count_freq = 0
        am_all = np.zeros([6 * num_bodies, 6 * num_bodies, T.size])
        rd_all = am_all.copy()
        am_inf = np.zeros([6 * num_bodies, 6 * num_bodies])
        am_zero = am_inf.copy()

        for i, line in enumerate(raw):

            # Read inf freq added mass
            if "Wave period = zero" in line:

                count = 7
                temp_line = raw[count + i]

                while temp_line != empty_line:

                    am_inf[int(temp_line.split()[0]) - 1,
                           int(temp_line.split()[1]) -
                           1] = temp_line.split()[2]
                    count += 1
                    temp_line = raw[count + i]

            # Read zero freq added mass
            if "Wave period = infinite" in line:

                count = 7
                temp_line = raw[count + i]

                while temp_line != empty_line:

                    am_zero[int(temp_line.split()[0]) - 1,
                            int(temp_line.split()[1]) -
                            1] = temp_line.split()[2]
                    count += 1
                    temp_line = raw[count + i]

            # Read freq dependent added mass and rad damping
            if "Wave period (sec) =" in line:
                temp = raw[i].split()
                T[count_freq] = temp[4]

                count = 7
                temp_line = raw[count + i]

                while temp_line != empty_line:

                    am_all[int(temp_line.split()[0]) - 1,
                           int(temp_line.split()[1]) - 1,
                           count_freq] = temp_line.split()[2]
                    rd_all[int(temp_line.split()[0]) - 1,
                           int(temp_line.split()[1]) - 1,
                           count_freq] = temp_line.split()[3]
                    count += 1
                    temp_line = raw[count + i]

                count_freq += 1

        # Terribly complicated code to read excitation forces and phases, RAOs, etc
        ex_all = np.zeros([6 * num_bodies, wave_dir.size, T.size])
        phase_all = ex_all.copy()
        rao_all = ex_all.copy()
        rao_phase_all = ex_all.copy()
        ssy_all = ex_all.copy()
        ssy_phase_all = ex_all.copy()
        haskind_all = ex_all.copy()
        haskind_phase_all = ex_all.copy()
        count_diff2 = 0
        count_rao2 = 0
        count_ssy2 = 0
        count_haskind2 = 0
        for i, line in enumerate(raw):

            count_diff = 0
            count_rao = 0
            count_ssy = 0
            count_haskind = 0

            if "DIFFRACTION EXCITING FORCES AND MOMENTS" in line:

                count_diff += 1
                count_diff2 += 1
                count_wave_dir = 0
                count = 0

                while count_wave_dir < wave_dir.size:

                    count += 1

                    if "Wave Heading (deg) :" in raw[i + count_diff + count]:

                        count_wave_dir += 1
                        temp_line = raw[i + count_diff + count + 4]
                        count2 = 0

                        while temp_line != empty_line:
                            count2 += 1
                            ex_all[int(temp_line.split()[0]) - 1,
                                   count_wave_dir - 1, count_diff2 -
                                   1] = float(temp_line.split()[1])
                            phase_all[int(temp_line.split()[0]) - 1,
                                      count_wave_dir - 1, count_diff2 -
                                      1] = float(temp_line.split()[2])
                            temp_line = raw[i + count_diff + count + 4 +
                                            count2]

            if "RESPONSE AMPLITUDE OPERATORS" in line:

                count_rao += 1
                count_rao2 += 1
                count_wave_dir = 0
                count = 0

                while count_wave_dir < wave_dir.size:

                    count += 1

                    if "Wave Heading (deg) :" in raw[i + count_rao + count]:

                        count_wave_dir += 1
                        temp_line = raw[i + count_rao + count + 4]
                        count2 = 0

                        while temp_line != empty_line:
                            count2 += 1
                            rao_all[int(temp_line.split()[0]) - 1,
                                    count_wave_dir - 1, count_rao2 -
                                    1] = float(temp_line.split()[1])
                            rao_phase_all[int(temp_line.split()[0]) - 1,
                                          count_wave_dir - 1, count_rao2 -
                                          1] = float(temp_line.split()[2])
                            temp_line = raw[i + count_rao + count + 4 + count2]

            if "HASKIND EXCITING FORCES AND MOMENTS" in line:

                count_haskind += 1
                count_haskind2 += 1
                count_wave_dir = 0
                count = 0

                while count_wave_dir < wave_dir.size:

                    count += 1

                    if "Wave Heading (deg) :" in raw[i + count_haskind +
                                                     count]:

                        count_wave_dir += 1
                        temp_line = raw[i + count_haskind + count + 4]
                        count2 = 0

                        while temp_line != empty_line:
                            count2 += 1
                            haskind_all[int(temp_line.split()[0]) - 1,
                                        count_wave_dir - 1, count_haskind2 -
                                        1] = float(temp_line.split()[1])
                            haskind_phase_all[int(temp_line.split()[0]) - 1,
                                              count_wave_dir - 1,
                                              count_haskind2 - 1] = float(
                                                  temp_line.split()[2])
                            temp_line = raw[i + count_haskind + count + 4 +
                                            count2]

            if "SURGE, SWAY & YAW DRIFT FORCES (Momentum Conservation)" in line:

                count_ssy += 1
                count_ssy2 += 1
                count_wave_dir = 0
                count = 0

                while count_wave_dir < wave_dir.size:

                    count += 1

                    if "Wave Heading (deg) :" in raw[i + count_ssy + count]:

                        count_wave_dir += 1
                        temp_line = raw[i + count_ssy + count + 4]
                        count2 = 0

                        while temp_line != empty_line:
                            count2 += 1
                            ssy_all[int(temp_line.split()[0]) - 1,
                                    count_wave_dir - 1, count_ssy2 -
                                    1] = float(temp_line.split()[1])
                            ssy_phase_all[int(temp_line.split()[0]) - 1,
                                          count_wave_dir - 1, count_ssy2 -
                                          1] = float(temp_line.split()[2])
                            temp_line = raw[i + count_ssy + count + 4 + count2]

        if os.path.exists(self.files['3sc']):
            sc_re = np.zeros([6 * num_bodies, wave_dir.size, T.size])
            sc_im = sc_re.copy()
            sc_phase = sc_re.copy()
            sc_mag = sc_re.copy()

            scattering = np.loadtxt(self.files['3sc'], skiprows=1)
            line_count = 0

            for freq_n in xrange(T.size):
                for beta_n in xrange(wave_dir.size):
                    wave_dir_hold = scattering[line_count][1]
                    while line_count < scattering.shape[0] and scattering[
                            line_count][1] == wave_dir_hold:
                        comp = int(scattering[line_count][2]) - 1
                        sc_mag[comp, beta_n,
                               freq_n] = scattering[line_count][3]
                        sc_phase[comp, beta_n,
                                 freq_n] = scattering[line_count][4]
                        sc_re[comp, beta_n, freq_n] = scattering[line_count][5]
                        sc_im[comp, beta_n, freq_n] = scattering[line_count][6]
                        wave_dir_hold = scattering[line_count][1]
                        line_count += 1

        else:
            print '\tThe file ' + self.files[
                '3sc'] + ' does not exist... not reading scattering coefficients.'

        if os.path.exists(self.files['3fk']):
            fk_re = np.zeros([6 * num_bodies, wave_dir.size, T.size])
            fk_im = fk_re.copy()
            fk_phase = fk_re.copy()
            fk_mag = fk_re.copy()

            fk = np.loadtxt(self.files['3fk'], skiprows=1)
            line_count = 0

            for freq_n in xrange(T.size):
                for beta_n in xrange(wave_dir.size):
                    wave_dir_hold = fk[line_count][1]
                    while line_count < fk.shape[0] and fk[line_count][
                            1] == wave_dir_hold:
                        comp = int(fk[line_count][2]) - 1
                        fk_mag[comp, beta_n, freq_n] = fk[line_count][3]
                        fk_phase[comp, beta_n, freq_n] = fk[line_count][4]
                        fk_re[comp, beta_n, freq_n] = fk[line_count][5]
                        fk_im[comp, beta_n, freq_n] = fk[line_count][6]
                        wave_dir_hold = scattering[line_count][1]
                        line_count += 1

        else:
            print '\tThe file ' + self.files[
                '3fk'] + ' does not exist... not reading froud krylof coefficients.'

        # Load data into the hydrodata structure
        for i in xrange(num_bodies):
            self.body[i] = bem.HydrodynamicData()
            self.body[i].scaled = self.scaled
            self.body[i].g = self.g
            self.body[i].rho = self.rho
            self.body[i].body_num = i
            self.body[i].name = name[i][0:-4]
            self.body[i].water_depth = water_depth
            self.body[i].num_bodies = num_bodies
            self.body[i].cg = cg[i]
            self.body[i].cb = cb[i]
            self.body[i].k = k[i]
            self.body[i].disp_vol = disp_vol[i]
            self.body[i].wave_dir = wave_dir
            self.body[i].T = T
            self.body[i].w = 2.0 * np.pi / self.body[i].T

            if 'am_inf' in locals():

                self.body[i].am.inf = am_inf[6 * i:6 + 6 * i, :]

            else:

                self.body[i].am.inf = np.nan * np.zeros(
                    [6 * num_bodies, 6 * num_bodies, self.body[i].T.size])
                print 'Warning: body ' + str(
                    i
                ) + ' - The WAMTI .out file specified does not contain infinite frequency added mass coefficients'

            if 'am_zero' in locals():

                self.body[i].am.zero = am_zero[6 * i:6 + 6 * i, :]

            else:

                self.body[i].am.zero = np.nan * np.zeros(
                    [6 * num_bodies, 6 * num_bodies, self.body[i].T.size])
                print 'Warning: body ' + str(
                    i
                ) + ' - The WAMTI .out file specified does not contain zero frequency added mass coefficients'

            if 'am_all' in locals():

                self.body[i].am.all = am_all[6 * i:6 + 6 * i, :, :]
            else:

                self.body[i].am.all = np.nan * np.zeros(
                    [6 * num_bodies, 6 * num_bodies, self.body[i].T.size])
                print 'Warning: body ' + str(
                    i
                ) + ' - The WAMTI .out file specified does not contain any frequency dependent added mass coefficients'

            if 'rd_all' in locals():

                self.body[i].rd.all = rd_all[6 * i:6 + 6 * i, :, :]

            else:

                self.body[i].rd.all = np.nan * np.zeros(
                    [6 * num_bodies, 6 * num_bodies, self.body[i].T.size])
                print 'Warning: body ' + str(
                    i
                ) + ' - The WAMTI .out file specified does not contain any frequency dependent radiation damping coefficients'

            if 'ex_all' in locals() and self.ex_calc == 'diffraction':

                self.body[i].ex.mag = ex_all[6 * i:6 + 6 * i, :, :]
                self.body[i].ex.phase = np.deg2rad(phase_all[6 * i:6 +
                                                             6 * i, :, :])
                self.body[i].ex.re = self.body[i].ex.mag * np.cos(
                    self.body[i].ex.phase)
                self.body[i].ex.im = self.body[i].ex.mag * np.sin(
                    self.body[i].ex.phase)

            elif 'haskind_all' in locals() and self.ex_calc == 'haskind':

                self.body[i].ex.mag = haskind_all[6 * i:6 + 6 * i, :, :]
                self.body[i].ex.phase = np.deg2rad(
                    haskind_phase_all[6 * i:6 + 6 * i, :, :])
                self.body[i].ex.re = self.body[i].ex.mag * np.cos(
                    self.body[i].ex.phase)
                self.body[i].ex.im = self.body[i].ex.mag * np.sin(
                    self.body[i].ex.phase)

            else:

                print 'Warning: body ' + str(
                    i
                ) + ' - The WAMTI .out file specified does not contain any excitation coefficients'

            if 'sc_mag' in locals():
                self.body[i].ex.sc.mag = sc_mag[6 * i:6 + 6 * i, :, :]
                self.body[i].ex.sc.phase = np.deg2rad(sc_phase[6 * i:6 +
                                                               6 * i, :, :])
                self.body[i].ex.sc.re = sc_re[6 * i:6 + 6 * i, :, :]
                self.body[i].ex.sc.im = sc_im[6 * i:6 + 6 * i, :, :]

            else:
                pass
                # print 'Warning: body ' + str(i) + ' - The WAMTI .3sc file specified does not contain any scattering coefficients'

            if 'fk_mag' in locals():
                self.body[i].ex.fk.mag = fk_mag[6 * i:6 + 6 * i, :, :]
                self.body[i].ex.fk.phase = np.deg2rad(fk_phase[6 * i:6 +
                                                               6 * i, :, :])
                self.body[i].ex.fk.re = fk_re[6 * i:6 + 6 * i, :, :]
                self.body[i].ex.fk.im = fk_im[6 * i:6 + 6 * i, :, :]

            else:
                pass
                # print 'Warning: body ' + str(i) + ' - The WAMTI .3fk file specified does not contain any froude krylof coefficients'

            if 'rao_all' in locals():

                self.body[i].rao.mag = rao_all[6 * i:6 + 6 * i, :, :]
                self.body[i].rao.phase = np.deg2rad(phase_all[6 * i:6 +
                                                              6 * i, :, :])
                self.body[i].rao.re = self.body[i].rao.mag * np.cos(
                    self.body[i].rao.phase)
                self.body[i].rao.im = self.body[i].rao.mag * np.sin(
                    self.body[i].rao.phase)

            else:

                print 'Warning: body ' + str(
                    i
                ) + ' - The WAMTI .out file specified does not contain any rao data'

            if 'ssy_all' in locals():

                self.body[i].ssy.mag = ssy_all[6 * i:6 + 6 * i, :, :]
                self.body[i].ssy.phase = np.deg2rad(phase_all[6 * i:6 +
                                                              6 * i, :, :])
                self.body[i].ssy.re = self.body[i].ssy.mag * np.cos(
                    self.body[i].ssy.phase)
                self.body[i].ssy.im = self.body[i].ssy.mag * np.sin(
                    self.body[i].ssy.phase)

            else:

                print 'Warning: body ' + str(
                    i
                ) + ' - The WAMTI .out file specified does not contain any rao data'

            self.body[i].bem_raw_data = raw
            self.body[i].bem_code = code

            self.body[i].scale(scale=self.scaled_at_read)