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

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

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

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

rm *.o $(PROGRAM)  


make changes like in compile.sh 
 for compile.sh

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

# Cygwin
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

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


  1. Hi waybov!
    I am trying also to run calwrf and I am following your instructions but they don’t work for me. I am also installing calwrf 1.4 in Ubuntu, and I compiled Netcdf with gfortran. I have these questions:
    1. You create a make file, so did you use the command “make” after creating it?
    2. Did you use “./compile” in order to compile the code after doing make?
    3. I compiled netcdf with gfortran, so in the make file should I state FC=gfortran instead of FC=pgf90?
    4. I had FFLAGS in netcdf as FFLAGS=-g –O2, If I put FFLAGS = -fast -g -Mlfs I am getting an Error 1 when I try to do “make” and it says that it does not recognize “fast” nor “Mlfs”.
    If I use FFLAGS=-g, I get Error 1. Collect2: error: ld returned 1 exit status.
    5. I don’t understand how did you run calwrf, if you don’t have a calwrf.exe file in the directory, don’t you have to type ./calwrf.exe?

  2. g'day mate..
    some times its complicated..
    u dont need to compile or make or dont need to use calwrf.exe
    just did what i said and go to directory as i shown above and type calwrf
    and thats it

    I am sorry i for get to mention above one thing that u can see in above updated text in red (bold) colour
    (but it already in images please follow screen-shots that would be very useful)

    its little bit tricky as i already said it took long time for me to run calwrf

    but i thk it will hopefully work

    please let me know...if any error ?


  3. Dear waybov,

    Thanks for your prompt answer. Yes, I have seen it is a tough work. However I still have more doubts, I hope you can help me.

    1) If the purpose of makefile is to create a .exe file, why just create a make file and not to use it with “make” command?

    2) Is work_calwrf directory created at the same level than calwrf directory or into this one? Does work_calwrf just have calwrf.inp file or something else into it?

    3) Where is created lib directory, into work_calwrf? Will this be just an empty directory?

    4) What should I place in the bin folder, calwrf.exe file? I can not copy anything to this directory, even if it has allowed access for all type of users.

    5) Which netCDF version is your WRFout file?

    Thanks and best regards,

    Francisco Leal
    MSc. Student Wageningen University

  4. hey.. i am busy 4 few more days .. will give u reply on weekend

  5. the new CALWRF2.0.1 is on website and simple to use it

  6. Can you instruct how to run CALPUFF and FLEXPART in ubuntu 14.04 ?

    Thank you in advance.

  7. A small out of context question. How do you get you create the input file for calwrf ... i.e what are the steps to create wrf output ? plz give me some hints

    1. I didnt get u mate..
      i think u want to create WRFOUT ??

  8. I think this instructions is incomplete, you can't run wrf.exe without compiling and ubuntu doesn't wok with LD_LIBRARY_PATH, not a standard library path is defined in this directory : /etc/ld.so.conf.d/

  9. This comment has been removed by the author.

  10. I'm running Calwrf in windows and have this error:

    Control inp file:calwrf.inp
    2D.DAT flag input not exist, set to one
    Set 2D.DAT flag to 1: 1
    Default 2D.DAT filename:calwrf_em.m2d
    Assertion failed: extent < X_INT_MAX, file posixio.c, line 413

    Program received signal SIGABRT: Process abort signal.

    Backtrace for this error:
    #0 6f61143e
    #1 6f68ec2f
    #2 75686f60
    Can you help me?

    1. Hi,

      I get the same error. Did you solve it?