Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

APPENDIX B

WEI: A simpledemonstration
programfor nonlinearinversionof
Wenet soundings
by ridgeregression.
programVV-ENINV
C A simpledemonstration of non]Jnea
dc resistivity
C inversionby ridgeregression
usingthe SYD method.
C The Wennet/Offset
Wennetconfixationin assnmed
and
C inverts data ar spacings
of 0.5,1,2,4,8,1,
......
C Handles a maxirn-m of 5 layersin the presentform.
C Alteration o handlemore layersis trivial.
C Author: Meju, M.A.
COMMON/SOLUTION/MOD,N2
PAL RM(5),DM(4),Y(22),MOD(9),DOBS(22),AB(22),DCALC(22)
PAL A(22,9),U(22,9),V(9,9),Q(9),DMB(4),RMB(5)
INTEGER EXTIT
CttACTER*20 INFILE
C setup flagsandperforminitializations
SSQ=l.E+10
TOL=0.0003
EXTIT = 0
INTIT=0
N2=l

c readfielddatastoredas[ab,d]pairs'ab=exper/mental
geometry,
d=data.
WRXTE(,,'(/A,$)')' ENTEt DATA FILENAME'> '
PmAD(,,' (A0)')IFmV,
OPEN(UNIT=3,FILE=LNFIZE,
STATUS=' OLD')
N=I

t0 mA(a,,,ENV=0) ^n(N),nOnS(N)
N=N+I
GOTO 10
99 CONTXIUE
NDAT=N-1

CLOSE(UNIT=a,STATUS='KEEP')
WPaTE(,20)nmv,,NnAT
20 FORMAT(/2X,A20,
' NUMBER OFDATARAD = ',i3)
C readguess
model;
inputparameters
reNLAYlayerresistivities,
tLM

Downloaded 30 Oct 2012 to 192.159.106.200. Redistribution subject to SEG license or copyright; Terms of Use: http://segdl.org/
27O
U and NLAY-1 depths to layer boundariesfrom the surface, DM.
WRITE(*,'(/A,$)') 'ENTER NUMBER OF LAYEI?SIN GUESSMODEL :> '
PAD(*,-) NLAY
NCOL=NLAY,2-1

WRITE(*,'(/A)') 'NOW ENTER LAYER ISISTMTIES (ohm-m):'


READ( ,- )( PM(I),I= 1,NLAY)
WRITE(*,'(/A)') ' NowenterDEPTHS(metres)to layerBOUNDAi?F,S-'
READ(.,,)(DM(I),I=I,NLAY-1)
C initiate iterative refinementof Kuessmodel
1 CONTINUE

c first solvethe forwardproblemving DCALC andform cliscrepacy


c vector Y = Dobs-DcaJc.'Obtain S,,rnof SquaresError, SSE=Y**2.
CALL MISFIT(NLAY,RM,DM,NDAT,DOBS,DCALC,Y,SSE)
WIITE (. ,30) EXTIT,SSE
30 FOPsMAT(/' Iteration nmbcr = ',I4," Sumof squareserror= ',F10.4)
C checkfor convergence. are stoppingcriteria-satisfied
?
F(SSQ.LT.SSE)ThEN
WIITE(*,,)' DIVERGENCE' ITERATION STOPPED'
GOTO 999
END IF.

i (SS(SSQ-SSE).LE.TOL) Tn,N
WUTE(*,,)' SLOW CONVEENCE: ITEPATON ABOTEn'
GOTO 999
ENDIF

SSQ=SSE
C save best solution in arrays KMB and D MB
o 40 = :,NnAY-:
m (i)=m(I)
DM(I)=DM(I)
4O CONTh'qUE

PaS(NLY) =m(NLAY)
C write out current model

WPaTE(.,'(/^)')' cumNT OnEt IS ASFOLLOWS'


WTE (,.)(mB (I),= ,NnAY)
WPaTE(-,,)(DM(I),I=.AY-)
C calculatepartial derivativesfor the inverseproblem

Downloaded 30 Oct 2012 to 192.159.106.200. Redistribution subject to SEG license or copyright; Terms of Use: http://segdl.org/

271
CALL PAltTIAL(ND AT,DCALC,NLAY,1tM,DM,A)
C calculate SVD of A

CALL SVD(NDAT,NCOL,A,U,V,Q)
c calculatemodel correctionby ridgeregressionand return updatedmodel
c MOD in commonblock/SOLUTION/
CALL 1tlDGE(Y,NCOL,NDAT,U,V,Q,SSQ,INTIT,NLAY,R_M,D
M,DOBS)
C checkthat controlflag is in order and update parameters
IF(N2.EQ.0)THEN
GOTO 999

ELSEIF(N2.EQ.)THEN
DO 50 I=I,NLAY-1
J=I+NLAY

aM()=MO()
DM(I)=MOD(J)
5O CONTINUE

tLM(NLA)=M 0 D(NLAY)
ENDIF
EXTIT=EXTIT+I
C repeat iterative operation
GOTO 1
999 CONTINUE

WRITE(.,'(/A/)')' *****INVEILSION COMPLETED******'


WltlTE(.,*)' Here are the optimumparameters:R.HOSAND DEPTHS'
WtLIT E ( * ,. )(RMB (I),I= 1,NLAY)
WRITE( .,. )(D MB(I),I= 1,NLAY-1)
STOP
END

subroutineBIDGE(Y,NCOL,NROW,U,V,Q,SSQ0,INTIT,Nlt,R.M,DM,DOBS)
C RIDGE REGRESSION 1tOUTIhrE. M.A.MEJU 1986

C 1tef: Meju,M.A.,1992. Computers& Geoscience,vol. 18,99-118.


COMMON/SOLUTION/P,N2
IAL Q(9),v(9,9),U(22,9),X(9),QK(O:10)
+, Y(22),YT(22),UT(9,22),VQ(9,9),UTY(9)
+, DOBS(22),DCALC(22)
+, RM(5),D M(4),lT(5),DT(4),It(4),PD (9),P(9)

Downloaded 30 Oct 2012 to 192.159.106.200. Redistribution subject to SEG license or copyright; Terms of Use: http://segdl.org/
272
C INITIAL CONSTANTS AND FLAGS
ND=NR-1

FC=./0.
N2=0

SSQT0=SSQ0
ND=NR-1
NPAPI=NR+ND
C SET MARQUARDT DAMPING FACTORS FOR R2DGE lGPSSION
C FIND SMALLEST/LARGEST SINGAR VALUES QS AND QL
QL=O.00000001
QS=10000000.
DO 10 I=i,NCOL
IF(Q(I).GT. QL)TttEN
QL=Q(I)
ELSEIF(Q(I) .LT. QS)TttEN
QS=Q(I)
END IF
10 CONTINUE

QL=10,QL
QS=QS/lO.
CALCULATE TEN SAMPLES OF TI FUNCTION QK = A + BK**2
DO 20 K=l,10
QK(K)=( 100,QS-QL+ (QL-QS),FLOAT(K)** 2)/ 99.
2O CONTINUE

QK(0)=0.0
DO 30 IK--1,11.
INTIT=INTIT+I
CALCULATE DAMPING FACTOK
BETA=QK(ll-IK)**2
C dampQ to avoidsingultrix, get Q-inverse,andU-trnpose
DO 40 I=I,NCOL

DO 50 J=I,NROW
UT(I,J)=U(J,I)
50 CONTINUE

CALCULATE V/LAMBDA

Downloaded 30 Oct 2012 to 192.159.106.200. Redistribution subject to SEG license or copyright; Terms of Use: http://segdl.org/
273
DO 60 K=I,NCOL
VQ(K,I)=Q1.V(K,I)
6O CONTINUE
4O CONTINUE

CALCULATE INNER PRODUCT UT.Y

CALL INPROD (9,22,NCOL,NROW,UT,Y,UTY)


CALCULATE IGRESSION ESTIMATE X.

CALL INPROD (9,9,NCOL,NCOL,VQ,UTY,X)


NN=0

c place boundson sizeof perturbationsusingthe Smoothness


Criterion of
c JACKSON(1973) GJPS 35,121-136.
c If SQRT(SUMSQ(X)/NCOL).GT.1, solutionnot physicallyreaJizable.
c therefore, DECIASE SIZE OF X WITttOUT CttANGG ITS DIRECTION
72 SMC=0.0

DO 80 M=i,NCOL
SMC=X(M)**2+SMC
C IF X TOO LARGE,SET FLAG NN=l
IF( AB S(X (M)). GT. 3.0)NN= 1
8O CONTINUE

SMC=S QR.T(SMC/FLO AT(N COL))


IF(SMC.GT.I'.0)TItEN
C, DECtASE MAGNITUDE OF PAtLiMETER INCIMENTS
DO 73 K=I,NCOL
73 X(K)=X(K),0.9
GOTO 72
END IF

C**END OF AMPLITUDE CHECK; PROCEED WITH LINE SEAR.CIt IF NN=0


IF(NN.EQ.0)TYiEN
DD=0.0

H(1)=DM(1)
DO 75 I=2,ND
H(I)=DM(I)-DM(I-1)
75 CONTINUE
C UPDATE PAILSMETER. VALUE AFTER RF,-SCALING X

CONTROL RATE OF CHANGE OF PARAMETERSBY FACTOR.,FC (30%)


DO 9O I=I,NR

Downloaded 30 Oct 2012 to 192.159.106.200. Redistribution subject to SEG license or copyright; Terms of Use: http://segdl.org/

27
PdvI
D () = 0.**( AL0 C10(RM(I)) +X (I)* FC)
IF(I.LE.ND)THEN
J=I+NR

tt (I) = 10.**( ALOG10(I-I(I)) +X(J), F C)


DD=DD+H(I)
tLMD(J)=DD
ENDIF
90 CONTINUE
CHECK FOR. NEGATIVE MODEL PARAMETERS
DO 92 I=I,NCOL
IF (tLMD(I).L Z. 0.)TttEN
WRITE(*, (A)) NEGATIVE PARAMETEI FOUND"
PTUR. N
END IF
92 coNTINUE
C passthe elementsof tLMD backinto resistivi'ty
and depthparameters
DO 95 I=i,ND
J=I+NR

RT(I)=R/VlD(I)
DT(I)=R.MD($)
95 CONTINUE

I{T(NR)=RMD(NR)
CALL MISFIT (NR,RT,DT,NROW,DOBS,DCALC,YT,S
SQT)
IF(INTIT.LE.11)TWEN
IF(IK.EQ.1)TtIEN
WRITE(,,'(A)')' **STAGE2 (INTERAL) ITERATIONS:RIDGE**'
WRITE(,,'(" ESTIMATEDMISFIT AND DAMPING FACTOI{")')
END IF

WR/TE(,,,)SSQT,BETA
ENDIF
C STOPPING CRITERION

IF( SSQT.GT.SSQTD)THEN
RETUR/
ELSE

SSQT0=SSQT
CHECK THAT INTEltFACE DEPTHS ARE IN ORDER

Downloaded 30 Oct 2012 to 192.159.106.200. Redistribution subject to SEG license or copyright; Terms of Use: http://segdl.org/

275
DO 100 J=2,.'D

I (T( - ). G,. T ())T


WR2TE(,,'(A)') ' ABNORMAL INTEIACE POSITION FOUND '
tLETURN
END IF
100 CONTINUE
C SAVE BEST-FIT SOLUTION

DO =,NPAaM

110 CONTINUE
N2=l
BETA0=BETA
END IF
END IF
3O CONTINUE
ITUR.N
END

subroutineINP R0 D ( ,n,m,n,matrix,vec,x)
c multiplies a matrix by vector vec nd returns vector x
real vec(n.u),x(rnm),matrix(mm,an)
do 10 i=l,m
s,,m=0.0

do 20 j=l,n
s,,m=vec(j),matx(i,j) +s-m
20 continue

10 continue
retro

end

subroutineMISFIT (NLAY,tLM,DM,AT,D OBS,DCALC,Y,SSF.)


C call forward routineF, obtainsmodelresponses FCALC
C and discrepancyvectorY as well as residualerror SSE.
REAL tLM(5),DM(4),Y(22),DOBS
(22),DCALC(22)
CALL FWP (NLAY,tkM,DM,D CALC)

Downloaded 30 Oct 2012 to 192.159.106.200. Redistribution subject to SEG license or copyright; Terms of Use: http://segdl.org/
276
SSE=0.0

DO 10 I=i:NDAT
Y (I)= ALOG10(DOBS(I)/D CALC(I))
SSE=SSE+Y(),,
lO CONTINUE
CONTINUE
END

subroutineFWl{D(nlay,rm,am,Azho)
c Computeslayeredearthresponse for the DC Weuner/Oet Wennetcase.
c Pesponses
= apparentresistivities
(Arho)at spacings
a =0.5,1,2,4,...1024.
c modelprameters arerm andhrn. rm = layerresis.; h = layerthicesses;
c t = resistivity
traudorms; c -- filtercoefcients
ofBiwenandBarker(1994).
realt(21), c(11),rm(5), h(4), Arho(22),din(4)
data c/-0.000409,-0.009047,0.065211,-0.1741571,
0.38731,
&:-0.0431,
2.093407,-1.622729.,
0.3383152,-0.039963,
0.004206/
get layer t;hicknesses
,,() = am()
if(nlay.gt.2)then
do 100 i=2, nlay-1
,(i)=a(i)-a(i-)
100 continue

ca/te resistivity ra.usform,


==0:/64.
do 20O nk=l,2]
x;r----xr* 2.

xx=a/og(xr)+0.246844
x=,(x)
=(my)
(my.t.)t,
do 300 kk= 1,nly- 1
r=rm(nlay-kk)
zw=(m.v-)/x

= ( + m,)/( 1.+ m, / )

Downloaded 30 Oct 2012 to 192.159.106.200. Redistribution subject to SEG license or copyright; Terms of Use: http://segdl.org/

277
300 continue
endif

t(nk)=bb
200 continue

c **evaluate convolution*

do 400 nk=l,ll

do 500 nkk=l,ll
=r+ ( +m- ),c( 2-k)
500 continue

j=nk
Arto(j)=rrm
400 continue
re%urn

end

subroutine
PAPTIAL
(NDAT,DCALC,NLA
Y,RM,D
M,A)
Compute partiM derivativeby nnmericMforwardcHerencimg
c perturb each model,find forwardresponse,
subtractcalc (urnperturbed
c responsefrom subroutineMISFIT) from perturbedresponse mudfill up
c correspondingcolwnnso A-matrix. NOTE: for rapid convergetrace,
forward
c differencesnot divided by perturbation factor D1ELbut solution scmled
c accordinglyin R1'DGElater.
REAL A(22,9),DCALC(22),PDATA(22),RM(5),DM(4)
DEL=0.03

D O 10 J= 1,NLAY
SAFE=R.M(J)
C perturb by del-m in log space
R.M(J) = 10.**(ALOG10(RM(J))+DEL)
CALL FWRD (NLAY,RM,DM,PDATA)
C FILLG COLUMNS OF MATRIX A

D O 20 I= 1,ND AT
A(I,J) = ALOG10(PDATA(I)/DCALC(I))
2O CONTUE

R.M(J) = SAFE
10 CONTINUE

Downloaded 30 Oct 2012 to 192.159.106.200. Redistribution subject to SEG license or copyright; Terms of Use: http://segdl.org/
278
C repeat for depth parameters
DO 30 J = 1,NLAY-1
SAFE -- DM(J)
DM(J)=10.,-(ALOG10(DM(J))+DEL)
CALL FWtLD(NLAY,tLI,DM,PD ATA)
C FILLIN G C 0 LUMN S 0 F MATRIX A

DO 40 I=I,NDAT
A(I,J+NLAY) = ALOG10(PDATA(I)/DCALC(I))
4O CONTN

DM(J) = SAFE
3O CONTINUE
KETUKN
END

subroutineSVD(n,m,a,u,v,q)
C insert originalroutine5om SVDINV here .tousethis program.
return

end

Downloaded 30 Oct 2012 to 192.159.106.200. Redistribution subject to SEG license or copyright; Terms of Use: http://segdl.org/

279

You might also like