[cig-commits] r19638 - seismo/3D/FAULT_SOURCE/branches/new_fault_db/utils

ampuero at geodynamics.org ampuero at geodynamics.org
Tue Feb 14 22:39:03 PST 2012


Author: ampuero
Date: 2012-02-14 22:39:03 -0800 (Tue, 14 Feb 2012)
New Revision: 19638

Added:
   seismo/3D/FAULT_SOURCE/branches/new_fault_db/utils/FSEM3D_read_fault_nodes.m
Log:
matlab function to read fault nodes to setup heterogeneous inputs

Added: seismo/3D/FAULT_SOURCE/branches/new_fault_db/utils/FSEM3D_read_fault_nodes.m
===================================================================
--- seismo/3D/FAULT_SOURCE/branches/new_fault_db/utils/FSEM3D_read_fault_nodes.m	                        (rev 0)
+++ seismo/3D/FAULT_SOURCE/branches/new_fault_db/utils/FSEM3D_read_fault_nodes.m	2012-02-15 06:39:03 UTC (rev 19638)
@@ -0,0 +1,34 @@
+%FSEM3D_read_fault_nodes reads fault nodes from output of generate_database
+%	Useful to set heterogeneous initial conditions and friction parameters
+%
+% xyz = FSEM3D_fault_nodes(filename)
+%
+% INPUTS	filename name of the file
+%
+% OUTPUTS	xyz	fault node coordinates, size = [number_of_nodes 3] 
+%
+% Jean-Paul Ampuero	ampuero at gps.caltech.edu
+
+function xyz = FSEM3D_snapshot(filename,NGLL)
+
+if ~exist(filename,'file'), error(sprintf('File %s does not exist',filename)), end
+fid=fopen(filename);
+BinRead = fread(fid,[1,inf],'single')' ;
+fclose(fid);
+
+nspec = BinRead(2);
+nglob = BinRead(3);
+
+NINT = 1; % number of single words (4 bytes) per integer
+
+N1 = 2+2*NINT + (2+NGLL^2*nspec*NINT)*2 + 2+NGLL^2*nspec*3 + (2+NINT*nglob)*2 +1;
+xyz(:,1) = BinRead(N1+1:N1+nglob);
+N1 = N1+nglob+2;
+xyz(:,2) = BinRead(N1+1:N1+nglob);
+N1 = N1+nglob+2;
+xyz(:,3) = BinRead(N1+1:N1+nglob);
+
+clear BinRead
+
+
+return



More information about the CIG-COMMITS mailing list