Changeset 460
- Timestamp:
- 04/15/09 14:24:12 (7 months ago)
- Files:
-
- trunk/modules/mc/hc/bin (added)
- trunk/modules/mc/hc/bin/x86_64 (added)
- trunk/modules/mc/hc/COPYING (added)
- trunk/modules/mc/hc/grdinttester.c (modified) (1 diff)
- trunk/modules/mc/hc/hc_init.c (modified) (1 diff)
- trunk/modules/mc/hc/Makefile (modified) (6 diffs)
- trunk/modules/mc/hc/Makefile.include (added)
- trunk/modules/mc/hc/objects (added)
- trunk/modules/mc/hc/objects/x86_64 (added)
- trunk/modules/mc/hc/README.TXT (modified) (5 diffs)
- trunk/modules/mc/hc/sh_extract_layer.c (added)
- trunk/modules/mc/hc/sh_power.c (modified) (1 diff)
- trunk/modules/mc/hc/sh_spherepack.h (added)
- trunk/modules/mc/hc/spherepack_sh.c (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/modules/mc/hc/grdinttester.c
r114 r460 13 13 struct ggrd_gt g1[1],g2[1]; 14 14 char char_dummy; 15 float x,y,x1,y1,dx,dy,rad ,rad_km;15 float x,y,x1,y1,dx,dy,rad_km; 16 16 int n; 17 17 double *z1,*z2; trunk/modules/mc/hc/hc_init.c
r445 r460 340 340 fprintf(stderr,"This version by Thorsten Becker and Craig O'Neill\n\n"); 341 341 342 fprintf(stderr,"usage example:\n\n"); 343 fprintf(stderr,"bin/hc -vvv\n\n"); 344 fprintf(stderr,"Compute mantle flow solution using the default input files:\n"); 345 fprintf(stderr," viscosity profile visc.dat\n"); 346 fprintf(stderr," density profile dens.sh.dat\n"); 347 fprintf(stderr," earth model prem/prem.dat\n"); 348 fprintf(stderr,"and provide lots of output. Default setting is quiet operation.\n\n"); 349 fprintf(stderr,"See README.TXT in the installation directory for example for how to plot output, and\n"); 350 fprintf(stderr,"http://geosys.usc.edu/projects/seatree/ for a graphical user interface.\n\n"); 351 352 342 353 fprintf(stderr,"density anomaly options:\n"); 343 354 fprintf(stderr,"-dens\tname\tuse name as a SH density anomaly model (%s)\n", trunk/modules/mc/hc/Makefile
r438 r460 18 18 # 19 19 # 20 ifdef ARCH 21 suffix="/$(ARCH)" 22 endif 23 ifdef HC_HOME 24 prefix="$(HC_HOME)/" 25 endif 20 26 # object file directory 21 ODIR = ../hc/objects/$(ARCH)/ 22 # 27 ODIR = "$(prefix)objects$(suffix)" 23 28 # 24 29 # binary directory 25 BDIR = ../hc/bin/$(ARCH)/30 BDIR = "$(prefix)bin$(suffix)" 26 31 27 32 # include files … … 64 69 PREM_OBJS = $(ODIR)/prem_util.o 65 70 # default PREM model file 66 PREM_DEFINES = -DPREM_MODEL_FILE=\" $(PWD)/prem/prem.dat\"71 PREM_DEFINES = -DPREM_MODEL_FILE=\"prem/prem.dat\" 67 72 PREM_INCS = prem.h 68 73 # … … 113 118 HC_LIBS_DEBUG = $(ODIR)/libhc.dbg.a 114 119 115 LIB_FLAGS = -L$(HOME)/progs/lib/$(ARCH)/ \ 116 $(HEAL_LIB_FLAGS) $(RICK_LIB_FLAGS) \ 120 LIB_FLAGS = $(HEAL_LIB_FLAGS) $(RICK_LIB_FLAGS) \ 117 121 $(GGRD_LIB_FLAGS) \ 118 122 -L$(ODIR)/ 119 123 120 124 # 121 INC_FLAGS = -I$(HOME)/progs/include/$(HEAL_INC_FLAGS) \125 INC_FLAGS = $(HEAL_INC_FLAGS) \ 122 126 $(RICK_INC_FLAGS) $(GGRD_INC_FLAGS) 123 127 # … … 133 137 134 138 all: dirs libs hc hc_extract_sh_layer \ 135 sh_syn sh_corr sh_ana sh_power rotvec2vel139 sh_syn sh_corr sh_ana sh_power sh_extract_layer rotvec2vel 136 140 137 141 libs: dirs hc_lib $(HEAL_LIBS) $(RICK_LIB) … … 170 174 $(CC) $(LIB_FLAGS) $(ODIR)/sh_ana.o \ 171 175 -o $(BDIR)/sh_ana -lhc -lrick $(HEAL_LIBS_LINKLINE) $(GGRD_LIBS_LINKLINE) -lm $(LDFLAGS) 176 177 sh_extract_layer: $(LIBS) $(INCS) $(ODIR)/sh_extract_layer.o 178 $(CC) $(LIB_FLAGS) $(ODIR)/sh_extract_layer.o \ 179 -o $(BDIR)/sh_extract_layer \ 180 -lhc -lrick $(HEAL_LIBS_LINKLINE) $(GGRD_LIBS_LINKLINE) \ 181 -lm $(LDFLAGS) 172 182 173 183 rotvec2vel: rotvec2vel.c … … 218 228 219 229 dirs: 220 if [ ! -s ../hc/]; then\221 mkdir ../hc/;\230 if [ ! -s $(ODIR) ]; then\ 231 mkdir -p "$(ODIR)";\ 222 232 fi; 223 if [ ! -s ../hc/objects/]; then\224 mkdir ../hc/objects;\233 if [ ! -s $(BDIR) ]; then\ 234 mkdir -p "$(BDIR)";\ 225 235 fi; 226 if [ ! -s ../hc/objects/$(ARCH)/ ]; then\227 mkdir ../hc/objects/$(ARCH);\228 fi;229 if [ ! -s ../hc/bin/ ];then\230 mkdir ../hc/bin;\231 fi;\232 if [ ! -s ../hc/bin/$(ARCH) ];then\233 mkdir ../hc/bin/$(ARCH);\234 fi235 236 236 237 clean: 237 rm $(ODIR)/*.o $(ODIR)/*.a238 rm -f $(ODIR)/*.o $(ODIR)/*.a 238 239 239 240 # trunk/modules/mc/hc/README.TXT
r290 r460 2 2 3 3 The code should compile on any basic UNIX/Linux system with the GMT 4 tools and libraries installed. See the Makefile for comments and what5 to modify. 4 tools (by default, version > 4.2.1) and libraries installed. See the 5 Makefile for comments and what to modify. 6 6 7 7 … … 11 11 the README there. 12 12 13 14 13 The Makefile assumes that the following environment variables are 15 14 predefined: 16 15 17 1) ARCH: should be the architecture you are compiling on, e.g. set with 18 19 setenv ARCH `uname -m | gawk '{print(tolower($1))}'` 20 21 for example, i686 for Intel 22 23 24 2) GMTHOME: needs to point to the base directory of the GMT installation, 16 1) GMTHOME: needs to point to the base directory of the GMT installation, 25 17 e.g. 26 18 /usr/local/src/GMTdev/GMT3.4.5/ 27 28 29 3) NETCDFHOME: for the netcdf libraries, should be e.g. 19 20 if you installed GMT yourself, or 21 22 /usr/lib/gmt 23 24 if you installed GMT with a package manager. 25 26 2) NETCDFHOME: for the netcdf libraries. This could be e.g. 30 27 31 28 /usr/local/src/netcdf-3.5.0/ 32 29 30 or 31 32 /usr 33 34 3) HC_HOME: By default, the object files and binaries will be 35 installed in the "objects/" and "bin/" directories in the current 36 directory. If HC_HOME is set (e.g. /usr/local/), then they will 37 be installed in $HC_HOME/objects and $HC_HOME/bin. 38 39 4) ARCH: If you like, you can put the object files and binaries in 40 different directories depending on your architecture. This may be 41 useful if your directories are NFS mounted on different machines. 42 One way is to use the output of uname 43 44 setenv ARCH `uname -m | gawk '{print(tolower($1))}'` # sh/tcsh 45 export ARCH=`uname -m | gawk '{print(tolower($1))}'` # bash 46 47 On a 32 bit Intel machine, this will put the binaries in bin/i686. 48 33 49 Also, the Makefile uses the commonly defined compiler variables CC, 34 F77, CFLAGS, LD, and LDFLAGS. 35 36 One common problem is the interface of the ggrd_ subroutines with 37 GMT. By default, the Makefile is set up for the old syntac of GMT 38 version 3.4.5. The other alternative is to use 4.1.2 and upward (note 39 that there were changes between 4.0 and 4.1.2). If you have GMT newer 40 or equal to 4.1.2, uncomment the two corresponding lines in the 41 Makefile. 50 F90, CFLAGS, LD, and LDFLAGS. So to make static executables, set 51 LDFLAGS="-static" 52 53 By default, the Makefile is set up for the new syntax of GMT version 54 4.1.2 and higher. The alternative is to use GMT3, which can be done by 55 defining -DUSE_GMT3 and modifying the two corresponding lines in the 56 Makefile.include. 42 57 43 58 With all things set up, you should be able to type … … 51 66 HC CODE usage 52 67 53 Described in the help page that is displayed for "hc -h" as below. See 54 also the benchmark scripts in cig_bench.tgz. This tar file will expand 55 into a cig subdirectory particularly "run_benchmark" there shows how 56 to run all CIG benchmark tests. 57 68 Described in the help page that is displayed for "hc -h" as below. 69 Also see http://geosys.usc.edu/projects/seatree/ for a graphical user 70 interface, and example plotting scripts as provided below. 58 71 59 72 >>> 60 73 61 > hc -help 62 hc - perform Hager & O'Connell flow computation 74 bin/hc - perform Hager & O'Connell flow computation 63 75 64 76 This code can compute velocities, tractions, and geoid for simple density distributions … … 68 80 This version by Thorsten Becker and Craig O'Neill 69 81 82 usage example: 83 84 bin/hc -vvv 85 86 Compute mantle flow solution using the default input files: 87 viscosity profile visc.dat 88 density profile dens.sh.dat 89 earth model prem/prem.dat 90 and provide lots of output. Default setting is quiet operation. 91 92 See README.TXT in the installation directory for example for how to plot output, and 93 http://geosys.usc.edu/projects/seatree/ for a graphical user interface. 94 70 95 density anomaly options: 71 -dens name use name as a SH density anomaly model (dens.sh.dat) 72 All density anomalies are in units of 1% of PREM, all SH coefficients in Dahlen & Tromp convention. 73 -dshs use the short, Becker & Boschi (2002) format for the SH density model (OFF) 74 -ds density scaling factor (0.2) 75 -dsf file read depth dependent density scaling from file 76 (overrides -ds, OFF), use pdens.py to edit 96 -dens name use name as a SH density anomaly model (dens.sh.dat) 97 All density anomalies are in units of 1% of PREM, all SH coefficients 98 in Dahlen & Tromp convention. 99 -dshs use the short, Becker & Boschi (2002) format for the SH density model (OFF) 100 -ds density scaling factor (0.2) 101 -dnp do not scale density anomalies with PREM but rather mean density (OFF) 102 -dsf file read depth dependent density scaling from file 103 (overrides -ds, OFF), use pdens.py to edit 77 104 78 105 Earth model options: 79 -prem name set Earth model to name (/home/walter/becker/progs/src/hc-svn/prem/prem.dat) 80 -vf name viscosity structure filename (visc.dat), use pvisc.py to edit 81 This file is in non_dim_radius viscosity[Pas] format 106 -prem name set Earth model to name (prem/prem.dat) 107 -vf name viscosity structure filename (visc.dat), use pvisc.py to edit 108 This file is in non_dim_radius viscosity[Pas] format 109 if name is "visc_scan", will loop through a four layer viscosity scan 82 110 83 111 boundary condition options: 84 -fs perform free slip computation (ON)85 -ns perform no slip computation (OFF)86 -pvel nameset prescribed surface velocities from file name (OFF)87 The file (e.g. pvel.sh.dat) is based on a DT expansion of cm/yr velocity fields.112 -fs perform free slip computation (ON) 113 -ns perform no slip computation (OFF) 114 -pvel name set prescribed surface velocities from file name (OFF) 115 The file (e.g. pvel.sh.dat) is based on a DT expansion of cm/yr velocity fields. 88 116 89 117 solution procedure and I/O options: 90 -ng do not compute and print the geoid (OFF) 91 -pptsol print pol[6] and tor[2] solution vectors (OFF) 92 -px print the spatial solution to file (OFF) 93 -rtrac compute srr,srt,srp tractions [MPa] instead of velocities [cm/yr] (default: vel) 94 -htrac compute stt,stp,spp tractions [MPa] instead of velocities [cm/yr] (default: vel) 95 -v -vv -vvv: verbosity levels (0) 118 -ng do not compute and print the geoid (1) 119 -ag compute geoid at all layer depths, as opposed to the surface only 120 -rg name compute correlation of surface geoid with that in file "name", 121 this will not print out the geoid file, but only correlations (OFF) 122 -pptsol print pol[6] and tor[2] solution vectors (OFF) 123 -px print the spatial solution to file (OFF) 124 -rtrac compute srr,srt,srp tractions [MPa] instead of velocities [cm/yr] (default: vel) 125 -htrac compute stt,stp,spp tractions [MPa] instead of velocities [cm/yr] (default: vel) 126 -v -vv -vvv: verbosity levels (0) 127 128 96 129 97 130 … … 166 199 viscosity upward until the next entry. Use the graphical tool 167 200 pvisc.py to edit such files. 168 169 201 2) Depth dependent density scaling file 170 202 trunk/modules/mc/hc/sh_power.c
r114 r460 41 41 struct sh_lms *exp; 42 42 if(argc>1){ 43 sscanf(argv[1],"%i",&i); 44 if(i) 45 short_format = TRUE; 43 if((strcmp(argv[1],"-h")==0)||(strcmp(argv[1],"--help")==0)||(strcmp(argv[1],"-help")==0)){ 44 fprintf(stderr,"usage: cat ab.sh_ana | %s [short_format, 0]\n", argv[0]); 45 fprintf(stderr,"read in a spherical harmonic expansion in Dahlen and Tromp normalization\n"); 46 fprintf(stderr, "and computer power per degree and unit area\n\n"); 47 fprintf(stderr,"if short format is 0, will expect\n"); 48 fprintf(stderr," type lmax shps ilayer nset zlabel ivec\n"); 49 fprintf(stderr," A-00 B-00\n"); 50 fprintf(stderr," A-10 B-10\n"); 51 fprintf(stderr," ...\n"); 52 fprintf(stderr,"format.\n\n"); 53 fprintf(stderr,"if short format is set, will expect\n"); 54 fprintf(stderr," lmax\n"); 55 fprintf(stderr," A-00 B-00\n"); 56 fprintf(stderr," A-10 B-10\n"); 57 fprintf(stderr," ...\n"); 58 fprintf(stderr,"format.\n"); 59 exit(-1); 60 }else{ 61 sscanf(argv[1],"%i",&i); 62 if(i) 63 short_format = TRUE; 64 } 46 65 } 47 fprintf(stderr,"%s: awaiting spherical harmonics expansion (%s) from stdin \n",48 argv[0],short_format ? "short format" : "long format" );66 fprintf(stderr,"%s: awaiting spherical harmonics expansion (%s) from stdin (use %s -h for help)\n", 67 argv[0],short_format ? "short format" : "long format",argv[0]); 49 68 while(sh_read_parameters_from_file(&type,&lmax,&shps,&ilayer,&nset, 50 69 &zlabel,&ivec,stdin,short_format,
