[cig-commits] r14942 - mc/1D/hc/trunk

becker at geodynamics.org becker at geodynamics.org
Sat May 9 12:01:00 PDT 2009


Author: becker
Date: 2009-05-09 12:00:59 -0700 (Sat, 09 May 2009)
New Revision: 14942

Added:
   mc/1D/hc/trunk/prem2dsm.c
Modified:
   mc/1D/hc/trunk/Makefile
   mc/1D/hc/trunk/prem_util.c
Log:
Added a prem model conversion routine, of limited use to the general audience.



Modified: mc/1D/hc/trunk/Makefile
===================================================================
--- mc/1D/hc/trunk/Makefile	2009-05-09 18:17:16 UTC (rev 14941)
+++ mc/1D/hc/trunk/Makefile	2009-05-09 19:00:59 UTC (rev 14942)
@@ -136,7 +136,7 @@
 
 
 all: dirs libs hc  hc_extract_sh_layer \
-	sh_syn sh_corr sh_ana sh_power sh_extract_layer rotvec2vel
+	sh_syn sh_corr sh_ana sh_power sh_extract_layer rotvec2vel 
 
 libs: dirs hc_lib  $(HEAL_LIBS) $(RICK_LIB)
 
@@ -144,9 +144,10 @@
 
 debug_libs: $(HC_LIBS_DEBUG)
 
-really_all: proto all debug_libs hc.dbg hcplates ggrd_test grdinttester
+really_all: proto all debug_libs hc.dbg hcplates ggrd_test grdinttester prem2dsm
 
 
+
 proto: hc_auto_proto.h
 
 hcplates: 
@@ -183,6 +184,8 @@
 rotvec2vel: rotvec2vel.c
 	$(CC) $(CFLAGS) rotvec2vel.c -o $(BDIR)/rotvec2vel -lm $(LDFLAGS)
 
+prem2dsm: $(ODIR)/prem2dsm.o $(PREM_OBJS)
+	$(CC) $(ODIR)/prem2dsm.o $(PREM_OBJS) -o $(BDIR)/prem2dsm -lm $(LDFLAGS) 
 
 
 hc: $(LIBS) $(INCS) $(ODIR)/main.o $(PREM_OBJS)

Added: mc/1D/hc/trunk/prem2dsm.c
===================================================================
--- mc/1D/hc/trunk/prem2dsm.c	                        (rev 0)
+++ mc/1D/hc/trunk/prem2dsm.c	2009-05-09 19:00:59 UTC (rev 14942)
@@ -0,0 +1,45 @@
+#include "hc.h"
+/* 
+
+read the PREM model in our format and convert to DSM format
+
+ */
+
+void main(void)
+{
+  int i,j;
+  double rlast;
+  struct prem_model prem[1];
+  char filename[HC_CHAR_LENGTH];
+  strncpy(filename,PREM_MODEL_FILE,HC_CHAR_LENGTH);
+  prem_read_model(filename,prem,TRUE);
+  //fprintf(stderr,"nl %i np %i\n",prem->n,prem->np);
+  printf("%i\tn_structure_zone\n",prem->n);
+  rlast =0;
+  for(i=0;i < prem->n;i++){
+    printf("%12.1f %12.1f\t",rlast,prem->rb[i]/1000.);
+    for(j=0;j < prem->np;j++)	/* rho */
+      printf("%9.4f ",prem->crho[i*prem->np+j]);
+    printf("\n\t\t\t\t");
+    for(j=0;j < prem->np;j++)	/* vpv */
+      printf("%9.4f ",prem->cvpv[i*prem->np+j]);
+    printf("\n\t\t\t\t");
+    for(j=0;j < prem->np;j++)	/* vph */
+      printf("%9.4f ",prem->cvph[i*prem->np+j]);
+    printf("\n\t\t\t\t");
+    for(j=0;j < prem->np;j++)	/* vsv */
+      printf("%9.4f ",prem->cvsv[i*prem->np+j]);
+    printf("\n\t\t\t\t");
+    for(j=0;j < prem->np;j++)	/* vsh */
+      printf("%9.4f ",prem->cvsh[i*prem->np+j]);
+    printf("\n\t\t\t\t");
+    for(j=0;j < prem->np;j++)	/* eta */
+      printf("%9.4f ",prem->ceta[i*prem->np+j]);
+
+    printf("%9.1f %9.1f\n",	/* qmu qkappa */
+	   (prem->cqmu[i]> 1e8)?(-1.0):(prem->cqmu[i]),prem->cqkappa[i]);
+
+    
+    rlast = prem->rb[i]/1000.;
+  }
+}

Modified: mc/1D/hc/trunk/prem_util.c
===================================================================
--- mc/1D/hc/trunk/prem_util.c	2009-05-09 18:17:16 UTC (rev 14941)
+++ mc/1D/hc/trunk/prem_util.c	2009-05-09 19:00:59 UTC (rev 14942)
@@ -336,10 +336,13 @@
 }
 /* 
 
-the following comment block holds the prem.dat file
+the following comment block holds the prem.dat file, for clarification
 
 note that radii are given in [m]
 
+this is the transversely isotropic version of PREM with the ocean
+layer
+
 */
 /*
 



More information about the CIG-COMMITS mailing list