Tuesday, June 11, 2013

how to run CALWRF 1.4 in ubuntu 13.04 64 bit

Hi after spending a lot of time in to calwrf to get 3d.dat output I come to conclusion  how to run/compile calwrf in ubuntu
this titorial might be useful for the new comer who r very new to linux (LIKE ME)
I learned by spending 2 month on internet but m sure this will help ful for u guyes n definetly will save ur couple of time...

I run CALWRF successfully in to my system use following file this is for CALWRFv1.4 , in ubuntu 13.04 64 bit
3 days before i got output.. one of my lab mate help me to sort out this problem...
step wise information...
mkdir calwrf
(paste calwrf.zip in to it then unzip it there and
then use follwong calwrf.inp file as it is , u must have to changes according to your WRFOUT


------------------------------------------------------------------------------------------------------------------
Create 3D.DAT file for WRF output
calwrf.lst ! Log file name
calwrf_em.m3d ! Output file name
-1,-1,-1,-1,-1,-1 ! Beg/End I/J/K ("-" for all)
-2011081500 ! Start date (UTC yyyymmddhh, "-" for all)
-2011090400 ! End date (UTC yyyymmddhh), "-" for all
1 ! Number of WRF output files ( 1 only now)
wrfout_d01_2011-08-15_00:00:00 ! File name of wrf output (Loop over files)


10,20,10,20,1,27 ! Beg/End I/J/K ("-" for all)
2011081500 ! Start date (UTC yyyymmddhh, "-" for all)
2011090400 ! End date (UTC yyyymmddhh), "-" for all

***** Below are comments *****************************************

Create 3D.DAT file for WRF output
calwrf.lst ! Log file name
calwrf.hrd ! Output file name
-9,-9,-9,-9,-9,-9 ! Beg/End I/J/K ("-" for all)
-9 ! Beginning time ("-" for all)
-9 ! Ending time ("-" for all)
1 ! Number of WRF output files ( 1 only now)
wrfout_d01_2011.dat ! File name of wrf output (Loop over files)


calwrf.lst ! Log file name
calwrf_070427.m3d ! Output file name
1,163,1,121,1,27 ! Beg/End I/J/K
2011081500 ! Beginning time
2011090400 ! Ending time
1 ! Number of WRF output files ( 1 only now)
wrfout_d01_2011.dat ! File name of wrf output (Loop over files)


calwrf.lst ! Log file name
calwrf_d2.m3d ! Output file name
1,111,1,96,1,27, ! Beg/End I/J/K
2011081500 ! Beginning time
2011090400 ! Ending time
1 ! Number of WRF output files ( 1 only now)
wrfout_d02_000124 ! File name of wrf output (Loop over files
)

---------------------------------------------------------------------------------------------------------------

then change NIMA.CRD to nima.crd and BLOCKDAT.CRD to blockdat.crd all in small letter 

then u have create makefile

-------------------------------------------------------------------------------------------------------------------------
# makefile for calwrf.f
PROGRAM = calwrf

FC = pgf90
FFLAGS = -fast -g -Mlfs

NETCDF = /usr/local/netcdf
LIBS = -lm -L${NETCDF}/lib -lnetcdf
INCL = -I${NETCDF}/include

OBJECTS = $(PROGRAM).o coordlib.o

$(PROGRAM): $(OBJECTS)
$(FC) $(FFLAGS) $(OBJECTS) $(LIBS) -o $@

coordlib.o : coordlib.for
$(FC) -c $(FFLAGS) $< -o $@

$(PROGRAM).o: $(PROGRAM).f
$(FC) $(FFLAGS) $(INCL) $(PROGRAM).f -c -o $(PROGRAM).o

clean:
rm *.o $(PROGRAM)  

--------------------------------------------------------------------------------------------------------------------------


make changes like in compile.sh 
--------------------------------------------------------------------------------------------------------------------------
 for compile.sh

#!/bin/sh
# Compile calwrf on Lightning
#
# On Lightning
#pgf90 calwrf.f -L${NETCDF}/lib -lnetcdf -lm \
# -I${NETCDF}/include -Mfree -o calwrf

# Cygwin
NETCDF=/usr/local
gfortran calwrf.f -L${NETCDF}/lib -lnetcdff -lm \
-I${NETCDF}/include -o calwrf 

--------------------------------------------------------------------------------------------------------------------------
then later
also create one folder to store out put

mkdir work_calwrf 

vbm@vbm:~$ mkdir lib
then copy calwrf file from calwrf folder and paste to the bin folder


need to define path

vbm@vbm:~$ export LD_LIBRARY_PATH="/usr/lib"
vbm@vbm:~$ mkdir work_calwrf 


vbm@vbm:~$ cd work_calwrf
vbm@vbm:~/work_calwrf$ cp ../calwrf/calwrf.inp . 


vbm@vbm:~/work_calwrf$ ls
calwrf.inp 


to run calwrf
vbm@vbm:~/work_calwrf$ calwrf