GUIA PARA INSTALAR O WRF 4 NUMA MAQUINA CENTOS 7 USANDO GNU FORTRAN

540 views
Skip to first unread message

Regis Grundig

unread,
May 4, 2016, 5:38:15 PM5/4/16
to cli...@googlegroups.com
PRIMEIRA PARTE -  PREPARAR SISTEMA OPERACIONAL

INSTALAR COMO CONTA ROOT OU USO DO SUDO


O modelo wrf não deve ser instalado  na conta root.  Contudo,  devemos como root preparar o sistema operacional caso alguem não o tenha feito. Sempre bom perguntar ao pessoal da TI se já instalaram os pacotes abixo.

a conta root é uma conta especial com todos os previlégios.  Com grandes poderes, grandes responsabilidades.

Alguns sistemas não permitem aos usuários comuns a conta root e usam o comando sudo.






yum install epel-release

yum install openmpi openmpi
-devel csh

yum install libpng libpng
-devel

yum install netcdf netcdf
-devel netcdf-openmpi netcdf-openmpi-devel netcdf-fortran netcdf-fortran-devel netcdf-fortran-openmpi netcdf-fortran-openmpi-devel netcdf4-python  hdf hdf-devel hdf5 hdf5-devel hdf5-openmpi hdf5-openmpi-devel

yum groupinstall
"Compatibility Libraries"

yum install gcc
-c++.x86_64

yum install vi vim nano  

yum install gcc
-c++.x86_64

yum install time

SEGUNDA PARTE - INSTALAÇÃO DAS BIBLIOTECAS


Basicamente basta seguir as etapas sem pular nenhuma.

As bibliotecas não devem ser instaladas por comandos yum ou apt-get.
 
Usar o wgt para baixar as bibliotecas
Usar o comando tar -xzvf  xxxxxx   para  descompacta-las. xxxx é a biblioteca. 
Usar o comando cd xxxxx para entrar no instalador.
Usar o comando ./configure para configurar baseado na sua  maquina e sistema operacional.
Usar o comando make para  compilar as bibliotecas
Usar o comando make install  para instalar
O comando cd ..  retorna ao diretorio anterior.







INSTALAÇÃO PARTICULAR DO NETCDF3 E NETCDF4 (CONTROLADA)

NETCDF 3  



tar -xzvf netcdf-3.6.2.tar.gz


cd netcdf
-3.6.2/
cd examples

cd cxx
vim ncvalues
.cpp


/*********************************************************************
 *   Copyright 1992, University Corporation for Atmospheric Research
 *   See netcdf/README file for copying and redistribution conditions.
 *
 *   Purpose: implementation of classes of typed arrays for netCDF
 *
 *   $Header: /upc/share/CVS/netcdf-3/cxx/ncvalues.cpp,v 1.11 2006/12/29 16:38:5
6 ed Exp $
 *********************************************************************/
#include <cstring>   ACRESCENTE ESSA LINHA AQUI!!
#include <config.h>
#include <iostream>
#include <string>

#include "ncvalues.h"

NcValues::NcValues( void ) : the_type(ncNoType), the_number(0)



vim sfc_pres_temp_rd.cpp 


/* This is part of the netCDF package.
   Copyright 2006 University Corporation for Atmospheric Research/Unidata.
   See COPYRIGHT file for conditions of use.

   This is an example which reads some surface pressure and
   temperatures. The data file read by this program is produced
   companion program sfc_pres_temp_wr.cxx. It is intended to
   illustrate the use of the netCDF C++ API.

   This program is part of the netCDF tutorial:

   Full documentation of the netCDF C++ API can be found at:

   $Id: sfc_pres_temp_rd.cpp,v 1.16 2007/01/19 12:52:13 ed Exp $
*/
#include <cstring>   ACRESCENTE ESSA LINHA AQUI!!
#include <iostream>
#include <netcdfcpp.h>

using namespace std;


cd ..
cd ..
cd cxx
vim ncvalues.cpp

/*********************************************************************
 *   Copyright 1992, University Corporation for Atmospheric Research
 *   See netcdf/README file for copying and redistribution conditions.
 *
 *   Purpose:   implementation of classes of typed arrays for netCDF
 *
 *   $Header: /upc/share/CVS/netcdf-3/cxx/ncvalues.cpp,v 1.11 2006/12/29 16:38:56 ed Exp $
 *********************************************************************/

#include <cstring>  ====>>>  incluir essa linha
#include <config.h>
#include <iostream>
#include <string>




cd ..

./configure --prefix=/usr/local/netcdf3

make check
make install




NETCDF4 

export CC=gcc
export CXX=g++
export FC=gfortran
export FCFLAGS=-m64
export F77=gfortran
export FFLAGS=-m64





 wget
ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.1.3.tar.gz


tar
-xzvf netcdf-4.1.3.tar.gz
cd netcdf
-4.1.3/
./configure --prefix=/usr/local/netcdf4 --disable-dap --disable-netcdf-4 --disable-cxx --disable-shared --enable-fortran

make
make install
cd
..



wget http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/mpich-3.0.4.tar.gz

tar -xzvf  mpich-3.0.4.tar.gz

cd mpich-3.0.4

./configure  --prefix=/usr/local/mpich

make

make install

cd
..


export LDFLAGS=-L/usr/local/grib2/lib

export  CPPFLAGS=-I/usr/local/grib2/include



wget http
://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/zlib-1.2.7.tar.gz

tar xzvf zlib
-1.2.7.tar.gz     #or just .tar if no .gz present

cd zlib
-1.2.7

./configure --prefix=$DIR/grib2

make

make install

cd
..

wget
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/libpng-1.2.50.tar.gz

tar
-xzvf libpng-1.2.50.tar.gz

cd libpng
-1.2.50/

./configure --prefix=/usr/local/grib2

make

make install

cd
..

wget
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz

tar
-xzvf jasper-1.900.1.tar.gz

cd jasper
-1.900.1/

./configure --prefix=/usr/local/grib2

make

make install

cd
..



INSTALAÇÃO DO WRF


AGORA  SAIDO DO ROOT COMO O COMANDO exit OU ABRA OUTRO TERMINAL.

A SEGUIR NÃO FAÇA USO DO ROOT


criação do ambiente

Editar o arquivo .bashrc  (tem um ponto no nome ) usando o vim ou vi ou o editor nano Oou gedit.

export NETCDF=/usr/local/netcdf4
export JASPERLIB=/usr/local/grib2/lib
export JASPERINC=/usr/local/grib2/include
export MPI=/usr/local/mpich
export NETCDF_classic=1

export LD_LIBRAY_PATH=$LD_LIBRARY_PATH:/usr/local/grib2/lib:/usr/local/lib:$MPI/lib

export PATH=/opt/opengrads:$MPI/bin:$PATH  

apos a ediçao do arquivo .bashrc , salve-o , saia do editor e  digite o comando:

source .bashrc




wget http
://www2.mmm.ucar.edu/wrf/src/WRFV4.0.TAR.gz




tar
-xzvf  WRFV4.0.TAR.gz


cd WRF



./configure


Please select from among the following Linux x86_64 options:

 
1. (serial)   2. (smpar)   3. (dmpar)   4. (dm+sm)   PGI (pgf90/gcc)
 
5. (serial)   6. (smpar)   7. (dmpar)   8. (dm+sm)   PGI (pgf90/pgcc): SGI MPT
 
9. (serial)  10. (smpar)  11. (dmpar)  12. (dm+sm)   PGI (pgf90/gcc): PGI accelerator
 
13. (serial)  14. (smpar)  15. (dmpar)  16. (dm+sm)   INTEL (ifort/icc)
                                         
17. (dm+sm)   INTEL (ifort/icc): Xeon Phi (MIC architecture)
 
18. (serial)  19. (smpar)  20. (dmpar)  21. (dm+sm)   INTEL (ifort/icc): Xeon (SNB with AVX mods)
 
22. (serial)  23. (smpar)  24. (dmpar)  25. (dm+sm)   INTEL (ifort/icc): SGI MPT
 
26. (serial)  27. (smpar)  28. (dmpar)  29. (dm+sm)   INTEL (ifort/icc): IBM POE
 
30. (serial)               31. (dmpar)                PATHSCALE (pathf90/pathcc)
 
32. (serial)  33. (smpar)  34. (dmpar)  35. (dm+sm)   GNU (gfortran/gcc)
 
36. (serial)  37. (smpar)  38. (dmpar)  39. (dm+sm)   IBM (xlf90_r/cc_r)
 
40. (serial)  41. (smpar)  42. (dmpar)  43. (dm+sm)   PGI (ftn/gcc): Cray XC CLE
 
44. (serial)  45. (smpar)  46. (dmpar)  47. (dm+sm)   CRAY CCE (ftn $(NOOMP)/cc): Cray XE and XC
 
48. (serial)  49. (smpar)  50. (dmpar)  51. (dm+sm)   INTEL (ftn/icc): Cray XC
 
52. (serial)  53. (smpar)  54. (dmpar)  55. (dm+sm)   PGI (pgf90/pgcc)
 
56. (serial)  57. (smpar)  58. (dmpar)  59. (dm+sm)   PGI (pgf90/gcc): -f90=pgf90
 
60. (serial)  61. (smpar)  62. (dmpar)  63. (dm+sm)   PGI (pgf90/pgcc): -f90=pgf90
 
64. (serial)  65. (smpar)  66. (dmpar)  67. (dm+sm)   INTEL (ifort/icc): HSW/BDW
 
68. (serial)  69. (smpar)  70. (dmpar)  71. (dm+sm)   INTEL (ifort/icc): KNL MIC
 
72. (serial)  73. (smpar)  74. (dmpar)  75. (dm+sm)   FUJITSU (frtpx/fccpx): FX10/FX100 SPARC64 IXfx/Xlfx

<<<< ver opçao  usando serial Gfortran  >>>>>> opçao 32

./compile em_real

 (demora muito.  vai tomar café)


Ao fim tem que ter no diretorio MAIN 3 os executaveis:

ls -ltr main/*.exe
-rwxrwxr-x. 1 wrf wrf 46674584 Jun 19 16:10 main/wrf.exe
-rwxrwxr-x. 1 wrf wrf 42261232 Jun 19 16:12 main/ndown.exe
-rwxrwxr-x. 1 wrf wrf 41618488 Jun 19 16:12 main/tc.exe
-rwxrwxr-x. 1 wrf wrf 42113680 Jun 19 16:12 main/real.exe

cd ..

wget wget http://www2.mmm.ucar.edu/wrf/src/WPSV4.0.TAR.gz
cd WPS
./configure

   1.  Linux x86_64, gfortran    (serial)
   2.  Linux x86_64, gfortran    (serial_NO_GRIB2)
   3.  Linux x86_64, gfortran    (dmpar)
   4.  Linux x86_64, gfortran    (dmpar_NO_GRIB2)
   5.  Linux x86_64, PGI compiler   (serial)
   6.  Linux x86_64, PGI compiler   (serial_NO_GRIB2)
   7.  Linux x86_64, PGI compiler   (dmpar)
   8.  Linux x86_64, PGI compiler   (dmpar_NO_GRIB2)
   9.  Linux x86_64, PGI compiler, SGI MPT   (serial)
  10.  Linux x86_64, PGI compiler, SGI MPT   (serial_NO_GRIB2)
  11.  Linux x86_64, PGI compiler, SGI MPT   (dmpar)
  12.  Linux x86_64, PGI compiler, SGI MPT   (dmpar_NO_GRIB2)
  13.  Linux x86_64, IA64 and Opteron    (serial)
  14.  Linux x86_64, IA64 and Opteron    (serial_NO_GRIB2)
  15.  Linux x86_64, IA64 and Opteron    (dmpar)
  16.  Linux x86_64, IA64 and Opteron    (dmpar_NO_GRIB2)
  17.  Linux x86_64, Intel compiler    (serial)
  18.  Linux x86_64, Intel compiler    (serial_NO_GRIB2)
  19.  Linux x86_64, Intel compiler    (dmpar)
  20.  Linux x86_64, Intel compiler    (dmpar_NO_GRIB2)
  21.  Linux x86_64, Intel compiler, SGI MPT    (serial)
  22.  Linux x86_64, Intel compiler, SGI MPT    (serial_NO_GRIB2)
  23.  Linux x86_64, Intel compiler, SGI MPT    (dmpar)
  24.  Linux x86_64, Intel compiler, SGI MPT    (dmpar_NO_GRIB2)
  25.  Linux x86_64, Intel compiler, IBM POE    (serial)
  26.  Linux x86_64, Intel compiler, IBM POE    (serial_NO_GRIB2)
  27.  Linux x86_64, Intel compiler, IBM POE    (dmpar)
  28.  Linux x86_64, Intel compiler, IBM POE    (dmpar_NO_GRIB2)
  29.  Linux x86_64 g95 compiler     (serial)
  30.  Linux x86_64 g95 compiler     (serial_NO_GRIB2)
  31.  Linux x86_64 g95 compiler     (dmpar)
  32.  Linux x86_64 g95 compiler     (dmpar_NO_GRIB2)
  33.  Cray XE/XC CLE/Linux x86_64, Cray compiler   (serial)
  34.  Cray XE/XC CLE/Linux x86_64, Cray compiler   (serial_NO_GRIB2)
  35.  Cray XE/XC CLE/Linux x86_64, Cray compiler   (dmpar)
  36.  Cray XE/XC CLE/Linux x86_64, Cray compiler   (dmpar_NO_GRIB2)
  37.  Cray XC CLE/Linux x86_64, Intel compiler   (serial)
  38.  Cray XC CLE/Linux x86_64, Intel compiler   (serial_NO_GRIB2)
  39.  Cray XC CLE/Linux x86_64, Intel compiler   (dmpar)
  40.  Cray XC CLE/Linux x86_64, Intel compiler   (dmpar_NO_GRIB2)

escolhemos a opção 1

./compile

(demora um pouco , mas menos que o WRF)


verifique e se tem os executaveis


ls -ltr *.exe
lrwxrwxrwx. 1 wrf wrf 23 Jun 19 16:34 geogrid.exe -> geogrid/src/geogrid.exe
lrwxrwxrwx. 1 wrf wrf 21 Jun 19 16:34 ungrib.exe -> ungrib/src/ungrib.exe
lrwxrwxrwx. 1 wrf wrf 23 Jun 19 16:35 metgrid.exe -> metgrid/src/metgrid.exe



INSTALANDO ARQUIVOS DE  TOPOGRAFIA E USO DE SOLO

cd

wget http
://www2.mmm.ucar.edu/wrf/src/wps_files/geog_high_res_mandatory.tar.gz

tar
-xzvf geog_high_res_mandatory.tar.gz

vai ser criado o diretorio WPS_GEOG


CRIANDO DOMINIOS OU GRADES

Uma boa pratica é criar um diretório para rodar os casos do WRF e n~]ao rodar no diretorio WRF.
Como sugestão, vamos criar um diretório DOMINIO e dentro dele colocaremos os nossos casos.

cd
mkdir DOMINIOS

Dentro do diretório DOMINIOS criaremos uma  pasta chamada AMS de America do Sul.

cd DOMINIOS
mkdir AMS
cd AMS
 

Agora  temos que copiar alguns arquivos. Supor que os diretorios WRFV4 e WPS estão no diretório raiz.

cp
../../WPS/geogrid/*.exe .

cp ../../WPS/geogrid/*.TBL .

cp ../../WPS/ungrib/*.exe .

cp ../../WPS/ungrib/*.TBL .

cp ../../WPS/metgrid/*.exe .

cp ../../WPS/metgrid/*.TBL .

cp ../../WRFV4/run/* .

cp ../../WPS/link_grib.csh .

Pronto: O diretorio está pronto para rodar o WRF.


RODANDO O WRF

1) Criar a grade  ( como exemplo uma grade que abrange a America do Sul)

editar o arquivo namelist.wps  (usando um editor de textos de sua preferencia... vi, nano gedit etc...)


&share
 wrf_core = 'ARW',
 max_dom = 1,
 start_date = '2018-06-11_00:00:00',
 end_date   = '2018-06-13_00:00:00',
 interval_seconds = 21600,
 io_form_geogrid = 2,
 opt_output_from_geogrid_path = '/home/wrf/DOMINIOS/AMS/',
 debug_level = 0,
/

&geogrid
 parent_id         = 1,
 parent_grid_ratio = 1,
 i_parent_start    = 1,
 j_parent_start    = 1,
 e_we          = 270,
 e_sn          = 277,
 geog_data_res = '30s',
 dx = 25000,
 dy = 25000,
 map_proj =  'mercator',
 ref_lat   = -20.211,
 ref_lon   = -60.19,
 truelat1  = -20.211,
 truelat2  = 0,
 stand_lon = -60.19,
 geog_data_path = '/home/wrf/WPS_GEOG',
 opt_geogrid_tbl_path = '/home/wrf/DOMINIOS/AMS/',
 ref_x = 135.0,
 ref_y = 138.5,
/



&ungrib
 out_format = 'WPS',
 prefix = 'FILE',
/

&metgrid
 fg_name = 'FILE',
 io_form_metgrid = 2,
 opt_output_from_metgrid_path = '/home/wrf/DOMINIOS/AMS/',
 opt_metgrid_tbl_path = '/home/wrf/DOMINIOS/AMS/',
/

&mod_levs
 press_pa = 201300 , 200100 , 100000 ,
             95000 ,  90000 ,
             85000 ,  80000 ,
             75000 ,  70000 ,
             65000 ,  60000 ,
             55000 ,  50000 ,
             45000 ,  40000 ,
             35000 ,  30000 ,
             25000 ,  20000 ,
             15000 ,  10000 ,
              5000 ,   1000
 /

 
 ----
 
 Digitar o comando:
 
 ./geogrid.exe
 
 
 Ao final ele criara um arquivo chamado ge_em.d01.nc
 
 
 
 2) INCLUINDO DADOS DE CONDIÇÃO INICIAL E DE CONTORNO
 
 Supondo que os dados de CICC estejam  no diretorio CICC/20180611 no diretorio raiz.
 
 Digitar:
 
 ./link_grib.csh  ../../CICC/20180611/gfs*
 
 ./ungrib.exe
 
 ./metgrid.exe
 
 
 3)  PREPARANDO PARA RODAR
 
Editar o arquivo namelist.input

 
&time_control            
run_days                 = 2,
run_hours                = 0,
run_minutes              = 0,
run_seconds              = 0,
start_year               = 2018,
start_month              = 06,
start_day                = 11,
start_hour               = 00,
start_minute             = 00,
start_second             = 00,
end_year                 = 2018,
end_month                = 06,
end_day                  = 13,
end_hour                 = 00,
end_minute               = 00,
end_second               = 00,
interval_seconds         = 21600,
input_from_file          = .true.,
history_interval         = 180,
frames_per_outfile       = 1000,
restart                  = .false.,
restart_interval         = 5000,
io_form_history          = 2,
io_form_restart          = 2,
io_form_input            = 2,
io_form_boundary         = 2,
debug_level              = 0,
/

&domains                
time_step                = 100,
time_step_fract_num      = 0,
time_step_fract_den      = 1,
max_dom                  = 1,
e_we                     = 270,
e_sn                     = 277,
e_vert                   = 32,
p_top_requested          = 9000,
num_metgrid_levels       = 32,
num_metgrid_soil_levels  = 4,
dx                       = 25000,
dy                       = 25000,
grid_id                  = 1,
parent_id                = 1,
i_parent_start           = 1,
j_parent_start           = 1,
parent_grid_ratio        = 1,
parent_time_step_ratio   = 1,
feedback                 = 1,
smooth_option            = 0,
/

&physics                
mp_physics               = 3,
ra_lw_physics            = 1,
ra_sw_physics            = 1,
radt                     = 30,
sf_sfclay_physics        = 1,
sf_surface_physics       = 2,
bl_pbl_physics           = 1,
bldt                     = 0,
cu_physics               = 1,
cudt                     = 5,
isfflx                   = 1,
ifsnow                   = 0,
icloud                   = 1,
surface_input_source     = 1,
num_soil_layers          = 4,
sf_urban_physics         = 0,
maxiens                  = 1,
maxens                   = 3,
maxens2                  = 3,
maxens3                  = 16,
ensdim                   = 144,
/

&fdda                    
/

&dynamics                
w_damping                = 0,
diff_opt                 = 1,
km_opt                   = 4,
diff_6th_opt             = 0,
diff_6th_factor          = 0.12,
base_temp                = 290.,
damp_opt                 = 0,
zdamp                    = 5000.,
dampcoef                 = 0.2,
khdif                    = 0,
kvdif                    = 0,
non_hydrostatic          = .true.,
moist_adv_opt            = 1,
scalar_adv_opt           = 1,
/

&bdy_control            
spec_bdy_width           = 5,
spec_zone                = 1,
relax_zone               = 4,
specified                = .true.,
nested                   = .false.,
/

&grib2                  
/

&namelist_quilt          
nio_tasks_per_group      = 0,
nio_groups               = 1,
/
                                                                                                                                                     

 -----
 
 ./real.exe
 
 E finalmente o WRF
 
 ./wrf.exe
 
 
4)  RODANDO EM PARALELO


cd

cd WRFV


./clear -a

./configure

escolher a opcao: 34

 32. (serial)  33. (smpar)  34. (dmpar)  35. (dm+sm)   GNU (gfortran/gcc)


 ./compile em_real  
 
 
 (esperar ...tomar café)
 
 
 cd
 
 cd DOMINIOS
 
 cd AMS
 
 
 cp ../../WRF/run/wrf.exe wrfp.exe .
 
 cp ../../WRF/run/real.exe realp.exe .
 

mpirun -np 4 ./wrfp.exe  
 


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 



 
 
 


PRE-VISUALIZAÇÃO

cd

wget http
://www2.mmm.ucar.edu/wrf/src/ARWpost_V3.tar.gz

tar
-xzvf ARWpost_V3.tar.gz

cd ARWpost

./configure

Will use NETCDF in dir: /usr/local/netcdf4
------------------------------------------------------------------------
Please select from among the following supported platforms.

   1.  PC Linux i486 i586 i686 x86_64, PGI compiler
   2.  PC Linux i486 i586 i686 x86_64, Intel compiler
   3.  PC Linux i486 i586 i686 x86_64, gfortran compiler

Enter selection [1-3] :


escolher opção 3


editar o arquivo configure.arwpost e ajustar oarquivo para as linhas abaixo:

#### Architecture specific settings ####

# Settings for PC Linux i486 i586 i686 x86_64, gfortran compiler
#
FC              =       gfortran
FFLAGS          =       -ffree-form -O -fno-second-underscore -fconvert=big-endian -frecord-marker=4
F77FLAGS        =       -ffixed-form -O -fno-second-underscore -fconvert=big-endian
FNGFLAGS        =       $(FFLAGS)
LDFLAGS         =       -lnetcdff
CC              =       gcc
CFLAGS          =       -m64
CPP             =       /lib/cpp -P -traditional
CPPFLAGS        =       -DIO_NETCDF -DIO_GRIB1 -DIO_BINARY -DRECL4  -Dbytesw


./compile




























Reply all
Reply to author
Forward
0 new messages