Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation of WRFextraction (WRTOOF) #82

Closed
hcOnel opened this issue Sep 20, 2021 · 6 comments
Closed

Compilation of WRFextraction (WRTOOF) #82

hcOnel opened this issue Sep 20, 2021 · 6 comments

Comments

@hcOnel
Copy link

hcOnel commented Sep 20, 2021

Hi,
I am running into some problems while building the WRFextraction tool.

First of all, is it still up-to-date? The README mentions a compressed file and WRFTOOF directory, which don't exist. I assume that the aforementioned directory is WRFextraction itself? Just to make sure, am I correct?

The only thing I change in the Makefile is FC=gfortran. Should I change anything else? (i.e. FCFLAGS is defined twice and such).

Then, I just run make. The module_dm.f90 file I get with the
/lib/cpp -C -P module_dm.F > module_dm.f90
command could not be compiled by the
gfortran -o module_dm.o -c -O3 -g -I/usr/include module_dm.f90
command, because the header that is commented by /* ... */ in the module_dm.f90 file could not be processed by the gfortran compiler, leading to error:

module_dm.f90:1:1:

 /* Copyright (C) 1991-2018 Free Software Foundation, Inc.
 1
Error: Invalid character in name at (1)

I am not very experienced with pre-processing with cpp and I'm sure that I'm making a silly mistake here, but I'm completely lost and can't figure it out what the Makefile is doing. Any help would be greatly appreciated.
Regards,
Huseyin

@rthedin
Copy link

rthedin commented Sep 20, 2021

Hi Huseyin,
I suggest you take a look at my recent PR on SOWFA-6 repo and check the differences in the makefile.

I went through the same compilation process and after a few hiccups, I managed to get it working using gfortran. My issues, though, were mostly related to the correct path of the netcdf installation. I did run into the problem you are describing here, which is related to the call to make and the temporary file it gets created. If you look the error, it is complaining about c++-style comments, rather than Fortran's !. The makefile in that PR fixes this issue.

@hcOnel
Copy link
Author

hcOnel commented Sep 20, 2021

Hi Mr. Thedin,

I've run make on your version of WRFextraction and it successfully compiled (despite a few warnings, which I doubt to have any impact). Thanks!

I should also note that I didn't use only the Makefile, I've copied the whole WRFextraction directory from your PR.

Just for the reference, here are the warnings:

/lib/cpp -C -P module_dm.F > module_dm.f90
gfortran -o module_dm.o -c -O3 -cpp -I/usr/include module_dm.f90
/lib/cpp -C -P module_openfoam_bc.F > module_openfoam_bc.f90
gfortran -o module_openfoam_bc.o -c -O3 -cpp -I/usr/include module_openfoam_bc.f90
/lib/cpp -C -P wrftoof.F > wrftoof.f90
wrftoof.F:582:19: warning: missing terminating ' character
      WRITE(unit,*)'/*---------------------------------------------------------------------------*\'
                   ^
wrftoof.F:623:19: warning: missing terminating ' character
      WRITE(unit,*)'/*---------------------------------------------------------------------------*\'
                   ^
gfortran -o wrftoof.o -c -O3 -cpp -I/usr/include wrftoof.f90
wrftoof.f90:242:27:

      CALL getvar_real(ctrl,latlongid,1,'XLAT' ,xlat ,it,2,ips,ipe-1,jps,jpe-1,1,1)
                           1
Warning: Rank mismatch in argument ‘ncids’ at (1) (rank-1 and scalar) [-Wargument-mismatch]
wrftoof.f90:243:27:

      CALL getvar_real(ctrl,latlongid,1,'XLONG',xlong,it,2,ips,ipe-1,jps,jpe-1,1,1)
                           1
Warning: Rank mismatch in argument ‘ncids’ at (1) (rank-1 and scalar) [-Wargument-mismatch]
wrftoof.f90:254:101:

    write(*,'("WRF grid is clockwise rotated approx.",f9.5," deg. from true lat/lon. Compensating.")'),-theta*57.2957795
                                                                                                     1
Warning: Legacy Extension: Comma before i/o item list at (1)
gfortran -o wrftoof -O3 -cpp wrftoof.o module_dm.o module_openfoam_bc.o \
        -L/usr/lib -L/usr/lib64 -lnetcdff 

@rthedin
Copy link

rthedin commented Sep 20, 2021

Yeah, these warnings can be ignored. Glad it worked!

@hcOnel hcOnel closed this as completed Sep 20, 2021
@Zhang-Zhaoyu
Copy link

Zhang-Zhaoyu commented Nov 8, 2021

Yeah, these warnings can be ignored. Glad it worked!

Hi Huseyin, Thedin,

I have tried the same compile processing with you and got the same warnings. When I run ./wrftoof, the result shows like

opening : flnm(i) 1 wrfout_d01_2015-08-05_05_40_00.nc
Dimensions: 1 100 1 109 1 88
WRF grid is clockwise rotated approx. -0.00000 deg. from true lat/lon. Compensating.
Getting variables from solution file
Have heat flux: T
Processing body 1 : west_bc.dat
Processing body 2 : east_bc.dat
Processing body 3 : south_bc.dat
Processing body 4 : north_bc.dat
Processing body 5 : lower_bc.dat
Processing body 6 : upper_bc.dat
End.

My question is that I cannot find the output file in the folder. Does it run correctly or the result is included in other files?

Thank you very much!

@rthedin
Copy link

rthedin commented Nov 8, 2021

Answered in #83.

@gaoxiangand
Copy link

Hello, I extracted the boundary but the operation always returns an error as follows:

opening : flnm(i) 1 wrfout_d01_2000-01-24_16:00:00

Dimensions: 1 50 1 50 1 50

Reading latitude/longitude from latlong.nc

The WRF grid is blessings approx. -0.00000 deg. From true Lat /lon.

Getting variables from solution file

Have heat flux: T

Processing body 1 : west_bc.dat

Precomputing points for body 1

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:

#0 0x7efd5e8952ed in ???

#1 0x7efd5e894503 in ???

#2 0x7efd5e129f0f in ???

#3 0x55754b1f1ab7 in ???

#4 0x55754b1e76be in ???

#5 0x7efd5e10cc86 in ???

#6 0x55754b1e76f9 in ???

#7 0xffffffffffffffff in ???

Segmentation fault (core dumped)

I feel like it might be because there's a problem with the _bC.dat I extracted. So I would like to ask how to extract the coordinates x,y,z of each boundary point and convert them into longitude/latitude/altitude. Is there a program that can be provided?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants