[mpas-developers] changes to global_scvt code

Michael Duda duda at ucar.edu
Wed Mar 24 12:35:51 MDT 2010


Hi, All.

I'd like to make a few changes to the global_scvt grid
generation code in the trunk. The changes will have no 
effect on results.

1) In the top-level Makefile, add a configuration option
   for gfortran 
   (attachment: Makefile)

2) In src/Makefile, add dependencies among source files
   so that a change to one file will trigger the proper
   re-compilation of dependent code and the final executable;
   currently, it is necessary to 'make clean' followed
   by 'make' after changing any source code 
   (attachment: src_Makefile)

3) Move the namelist declaration in module_grid_params.F
   before the initialization of the variable 'pi', since
   such declarations should occur before any executable
   statements (this was caught by gfortran) 
   (attachment: module_grid_params.F)

If anyone has any questions, suggestions, or objections,
please let me know.

Cheers,
Michael
-------------- next part --------------
FC = ifort
FFLAGS = -FR -m64 -O3 -fast -ipo -openmp
F77FLAGS = -FI -m64 -O3 -fast -ipo -openmp
CPPFLAGS = -DRKIND=8
PROMOTION = -r8
LDFLAGS = -m64 -O3 -fast -ipo -openmp

#FC = gfortran
#FFLAGS = -ffree-form -O3 -fopenmp -ffree-line-length-none -fsecond-underscore
#F77FLAGS = -ffixed-form -O3 -fopenmp -fsecond-underscore
#CPPFLAGS = -DRKIND=8
#PROMOTION = -fdefault-real-8
#LDFLAGS = -O3 -fopenmp

#FC = pgf90
#FFLAGS = -Mfree -O3 -mp -byteswapio
#F77FLAGS = -O3 -byteswapio
#CPPFLAGS = -DRKIND=8
#PROMOTION = -r8
#LDFLAGS = -O3 -mp -byteswapio

all: grid_gen grid_ref

grid_gen:
	( cd src; make FC="$(FC)" FFLAGS="$(FFLAGS)" F77FLAGS="$(F77FLAGS)" CPPFLAGS="$(CPPFLAGS)" PROMOTION="$(PROMOTION)" LDFLAGS="$(LDFLAGS)" )
	if [ ! -e grid_gen ]; then ln -s src/grid_gen .; fi

grid_ref:
	$(FC) refine/grid_ref.f refine/svtgen.f -o refine/grid_ref
	if [ ! -e grid_ref ]; then ln -s refine/grid_ref .; fi

clean:
	( cd src; make clean )
	rm -f grid_gen grid_ref refine/grid_ref

-------------- next part --------------
.SUFFIXES: .F .f .o

OBJS = STRIPACK.o module_grid_params.o module_grid_constants.o module_data_types.o module_sphere_utilities.o module_voronoi_utils.o module_grid_gen_utils.o module_scvt.o module_write_netcdf.o module_grid_meta.o grid_gen.o

all: $(OBJS)
	$(FC) $(PROMOTION) $(LDFLAGS) -o grid_gen $(OBJS) -L$(NETCDF)/lib -lnetcdf


grid_gen.o: module_grid_params.o module_grid_constants.o module_data_types.o module_grid_gen_utils.o module_voronoi_utils.o STRIPACK.o module_scvt.o module_grid_meta.o

module_grid_gen_utils.o: module_sphere_utilities.o

module_scvt.o: module_data_types.o module_sphere_utilities.o module_voronoi_utils.o module_grid_constants.o module_grid_params.o

module_write_netcdf.o: module_grid_params.o

module_data_types.o:

module_grid_meta.o: module_data_types.o module_grid_constants.o module_sphere_utilities.o module_write_netcdf.o

module_sphere_utilities.o: module_data_types.o

module_grid_constants.o:

module_grid_params.o:

module_voronoi_utils.o: module_grid_constants.o STRIPACK.o


.F.o:
	cpp -C -P -traditional $(CPPFLAGS) $< > $*.f90
	$(FC) $(FFLAGS) $(PROMOTION) -c $*.f90 -I$(NETCDF)/include
	rm -f $*.f90

.f.o:
	$(FC) $(F77FLAGS) $(PROMOTION) -c $<

clean:
	rm -f *.o *.mod grid_gen
-------------- next part --------------
module grid_params

   integer :: np
   logical :: locs_as_xyz
   logical :: l2_conv, inf_conv
   integer :: n_scvt_iterations
   real :: eps

   contains

   subroutine read_namelist()

      implicit none

      integer :: funit
      real :: pi

      namelist /domains/ np, locs_as_xyz, n_scvt_iterations, eps, l2_conv, inf_conv

      pi = 4.0*atan(1.0)

      funit = 21 

      np = 40962
      locs_as_xyz = .true.
      n_scvt_iterations = 0
      eps = 0.0000000001
      l2_conv = .true.
      inf_conv = .false.

      open(funit,file='namelist.input',status='old',form='formatted')
      read(funit,domains)
      close(funit)

      if(l2_conv) then
          inf_conv = .false.
      endif

   end subroutine read_namelist

end module grid_params


More information about the mpas-developers mailing list