Changeset 460

Show
Ignore:
Timestamp:
04/15/09 14:24:12 (7 months ago)
Author:
becker
Message:

Updated HC.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/modules/mc/hc/grdinttester.c

    r114 r460  
    1313  struct ggrd_gt g1[1],g2[1]; 
    1414  char char_dummy; 
    15   float x,y,x1,y1,dx,dy,rad,rad_km; 
     15  float x,y,x1,y1,dx,dy,rad_km; 
    1616  int n; 
    1717  double *z1,*z2; 
  • trunk/modules/mc/hc/hc_init.c

    r445 r460  
    340340      fprintf(stderr,"This version by Thorsten Becker and Craig O'Neill\n\n"); 
    341341       
     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 
    342353      fprintf(stderr,"density anomaly options:\n"); 
    343354      fprintf(stderr,"-dens\tname\tuse name as a SH density anomaly model (%s)\n", 
  • trunk/modules/mc/hc/Makefile

    r438 r460  
    1818# 
    1919# 
     20ifdef ARCH 
     21suffix="/$(ARCH)" 
     22endif 
     23ifdef HC_HOME 
     24prefix="$(HC_HOME)/" 
     25endif 
    2026# object file directory 
    21 ODIR = ../hc/objects/$(ARCH)/ 
    22 
     27ODIR = "$(prefix)objects$(suffix)" 
    2328# 
    2429# binary directory 
    25 BDIR = ../hc/bin/$(ARCH)/ 
     30BDIR = "$(prefix)bin$(suffix)" 
    2631 
    2732# include files 
     
    6469PREM_OBJS = $(ODIR)/prem_util.o 
    6570# default PREM model file 
    66 PREM_DEFINES = -DPREM_MODEL_FILE=\"$(PWD)/prem/prem.dat\" 
     71PREM_DEFINES = -DPREM_MODEL_FILE=\"prem/prem.dat\" 
    6772PREM_INCS = prem.h 
    6873# 
     
    113118HC_LIBS_DEBUG =  $(ODIR)/libhc.dbg.a 
    114119 
    115 LIB_FLAGS = -L$(HOME)/progs/lib/$(ARCH)/ \ 
    116         $(HEAL_LIB_FLAGS) $(RICK_LIB_FLAGS) \ 
     120LIB_FLAGS = $(HEAL_LIB_FLAGS) $(RICK_LIB_FLAGS) \ 
    117121        $(GGRD_LIB_FLAGS) \ 
    118122        -L$(ODIR)/ 
    119123 
    120124# 
    121 INC_FLAGS = -I$(HOME)/progs/include/ $(HEAL_INC_FLAGS) \ 
     125INC_FLAGS = $(HEAL_INC_FLAGS) \ 
    122126        $(RICK_INC_FLAGS) $(GGRD_INC_FLAGS)  
    123127# 
     
    133137 
    134138all: dirs libs hc  hc_extract_sh_layer \ 
    135         sh_syn sh_corr sh_ana sh_power rotvec2vel 
     139        sh_syn sh_corr sh_ana sh_power sh_extract_layer rotvec2vel 
    136140 
    137141libs: dirs hc_lib  $(HEAL_LIBS) $(RICK_LIB) 
     
    170174        $(CC) $(LIB_FLAGS) $(ODIR)/sh_ana.o \ 
    171175                -o $(BDIR)/sh_ana -lhc -lrick $(HEAL_LIBS_LINKLINE) $(GGRD_LIBS_LINKLINE) -lm $(LDFLAGS) 
     176 
     177sh_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) 
    172182 
    173183rotvec2vel: rotvec2vel.c 
     
    218228 
    219229dirs: 
    220         if [ ! -s ../hc/ ]; then\ 
    221                 mkdir ../hc/;\ 
     230        if [ ! -s $(ODIR) ]; then\ 
     231                mkdir -p "$(ODIR)";\ 
    222232        fi; 
    223         if [ ! -s ../hc/objects/ ]; then\ 
    224                 mkdir ../hc/objects;\ 
     233        if [ ! -s $(BDIR) ]; then\ 
     234                mkdir -p "$(BDIR)";\ 
    225235        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         fi 
    235236 
    236237clean: 
    237         rm $(ODIR)/*.o  $(ODIR)/*.a 
     238        rm -f $(ODIR)/*.o  $(ODIR)/*.a 
    238239 
    239240# 
  • trunk/modules/mc/hc/README.TXT

    r290 r460  
    22 
    33The code should compile on any basic UNIX/Linux system with the GMT 
    4 tools and libraries installed. See the Makefile for comments and what 
    5 to modify.  
     4tools (by default, version > 4.2.1) and libraries installed. See the 
     5Makefile for comments and what to modify. 
    66 
    77 
     
    1111the README there. 
    1212 
    13  
    1413The Makefile assumes that the following environment variables are 
    1514predefined:  
    1615 
    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, 
     161) GMTHOME: needs to point to the base directory of the GMT installation, 
    2517e.g. 
    2618        /usr/local/src/GMTdev/GMT3.4.5/ 
    27          
    28  
    29 3) NETCDFHOME: for the netcdf libraries, should be e.g. 
     19 
     20if you installed GMT yourself, or 
     21 
     22        /usr/lib/gmt 
     23 
     24if you installed GMT with a package manager. 
     25 
     262) NETCDFHOME: for the netcdf libraries.  This could be e.g. 
    3027 
    3128   /usr/local/src/netcdf-3.5.0/ 
    3229 
     30or 
     31 
     32   /usr 
     33 
     343) 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 
     394) 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 
    3349Also, 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. 
     50F90, CFLAGS, LD, and LDFLAGS.  So to make static executables, set 
     51LDFLAGS="-static" 
     52 
     53By default, the Makefile is set up for the new syntax of GMT version 
     544.1.2 and higher. The alternative is to use GMT3, which can be done by 
     55defining -DUSE_GMT3 and modifying the two corresponding lines in the 
     56Makefile.include. 
    4257 
    4358With all things set up, you should be able to type  
     
    5166HC CODE usage 
    5267 
    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  
     68Described in the help page that is displayed for "hc -h" as below.  
     69Also see http://geosys.usc.edu/projects/seatree/ for a graphical user 
     70interface, and example plotting scripts as provided below. 
    5871 
    5972>>> 
    6073 
    61 > hc -help 
    62 hc - perform Hager & O'Connell flow computation 
     74bin/hc - perform Hager & O'Connell flow computation 
    6375 
    6476This code can compute velocities, tractions, and geoid for simple density distributions 
     
    6880This version by Thorsten Becker and Craig O'Neill 
    6981 
     82usage example: 
     83 
     84bin/hc -vvv 
     85 
     86Compute 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 
     90and provide lots of output. Default setting is quiet operation. 
     91 
     92See README.TXT in the installation directory for example for how to plot output, and 
     93http://geosys.usc.edu/projects/seatree/ for a graphical user interface. 
     94 
    7095density 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 
    77104 
    78105Earth 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 
    82110 
    83111boundary condition options: 
    84 -fs             perform free slip computation (ON) 
    85 -ns             perform no slip computation (OFF) 
    86 -pvel   name    set 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. 
    88116 
    89117solution 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 
    96129 
    97130 
     
    166199viscosity upward until the next entry. Use the graphical tool 
    167200pvisc.py to edit such files. 
    168  
    1692012) Depth dependent density scaling file  
    170202 
  • trunk/modules/mc/hc/sh_power.c

    r114 r460  
    4141  struct sh_lms *exp; 
    4242  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    } 
    4665  } 
    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]); 
    4968  while(sh_read_parameters_from_file(&type,&lmax,&shps,&ilayer,&nset, 
    5069                                     &zlabel,&ivec,stdin,short_format,