win10子系統ubuntu16.04安裝HOS-NWT全過程

前言:

  按照官方文檔的安裝說明,安裝HOS-NWT出錯,經過一番搗鼓,終於成功。因此,把win10子系統ubuntu16.04安裝HOS-NWT的全過程記錄如下。

(1)HOS-NWT

  HOS-NWT is a Numerical Wave Tank based on the High-Order Spectral (HOS) method. It is dedicated to the generation and propagation of highly non-linear wave fields in wave basins with arbitrary constant depth. The proposed model reproduce all features of an ocean wave basin: directional wavemaker, reflective walls and absorbing beach. HOS-NWT takes into account free surface nonlinearities as well as wavemaker ones. It has been developed at Ecole Centrale de Nantes for 10 years and is used in several research projects.

下載地址:https://github.com/LHEEA/HOS-NWT/wiki

 (2)已測試平臺

1、ubuntu14.04+gcc/gfortran 4.8.4

2、ubuntu16.04+gcc/gfortran 5.

上述兩種環境均能成功安裝HOS-NWT,親測通過,可放心進行安裝。

一、安裝ubuntu16.04子系統

(1)查看你的win10版本,正常系統只要是1709以上就能使用下面的方法安裝ubuntu子系統。操作如下:開始--設置--系統--關於。

 

 

(2) 開啓開發者選項,操作如下:開始--設置--更新和安全--開發者選項--右側勾選開發人員模式。

(3)啓用win10的linux子系統組件。操作如下:開始--設置--應用--程序和功能--啓用開啓或關閉windows功能--勾選適用於linux的windows子系統,之後重啓系統。

 

(4) 安裝ubuntu

    打開microsoft store,搜索ubuntu,下載ubuntu16.04,點擊安裝。操作過程如下圖

 

 (5)安裝完成之後啓動系統,可能需要等待幾分鐘,然後設置用戶名和密碼,如下圖所示:

 

(6)爲了獲得更好的下載速度,更換系統默認的源爲阿里源。操作過程如下:

 sudo su #進入root用戶

cd /etc/apt/

cp sources.list sources.list_backup

vim sources.list

在閱讀模式(esc鍵)下輸入:1,$d刪除sources.list的全部內容,然後進入輸入模式(按i 鍵進入)輸入下面的內容:

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
# 源碼
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

最後返回閱讀模式(esc鍵)輸入:wq保存退出。

 (7)更新源

apt-get update #root下運行,如下圖

 

(8)安裝gcc、g++、gfortran(root賬戶下)

sudo su#使用root賬戶來安裝

apt-get install build-essential#安裝gcc和g++

apt-get install gfortran#安裝gfortran

至此,win10子系統ubuntu16.04的基本編譯環境就已經搭載好了。接下來的第二部分安裝HOS-NWT所需要的數學函數庫:blas和lapack以及fftw3。

二、安裝HOS-NWT需要用到的三個數學函數庫(使用root用戶來安裝的)

(1)安裝blas

apt install libblas-dev

(2)安裝lapack

apt install liblapack-dev

(3)安裝fftw3

apt install libfftw3-dev

(4)查找確定這三個數學函數安裝的位置(同樣使用root賬戶)

 updatedb#更新搜索數據庫

locate libblas#查找blas庫所在位置

locate liblapack#查找liblapack位置

locate libfftw3#查找libfftw3位置

(5)三個數學函數庫的安裝位置分別爲:

blas:/usr/lib/

lapack:/usr/lib/

fftw3:/usr/lib/x86_64-linux-gnu/

 三、安裝HOS-NWT

(1)把HOS-NWT源代碼從win10複製到ubuntu16.04子系統並解壓,假設我的源代碼放在F盤,那個操作過程如下(使用的是普通賬戶):

cp /mnt/f/HOS-NWT-1.2.tar.gz .#從win10 F盤複製到當前目錄(最後一點表示當前目錄)

tar zxvf HOS-NWT-1.2.tar.gz#解壓到當前目錄

 

(2)修改makefile如下所示:

 (3)把目錄sources/main/ 下的dealiasing.f90裏頭的MOD全部替換成MODULO,如下所示:

(4)安裝makedepf90

sudo apt-get install makedepf90

(5) 編譯HOS-NWT,如下所示:

make clean#清楚上一次編譯結果

make#編譯

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章