⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reflectivity.c

📁 su 的源代码库
💻 C
📖 第 1 页 / 共 3 页
字号:
/* Copyright (c) Colorado School of Mines, 2006.*//* All rights reserved.                       *//*                                                              *//*  Function RTu()                                              *//*                                                              *//*  Computation of the reflection and transmission coefficients *//*  of upgoing incident waves                                   *//*                                                              *//*  Input parameters:                                           *//*  alpha..................p-wave velocities of the model       *//*                         global variable                      *//*  beta...................s-wave velocities of the model       *//*                         global variable                      *//*  rho....................densities of the elastic model       *//*                         global variable                      *//*  thick..................thicknesses of the model             */ /*                         global variable                      *//*  i1.....................points to the first layer            *//*  i2.....................points to the second layer           *//*                                                              *//*  Output parameters:                                          *//*  coeffU.................Reflection and transmition           *//*                         coefficients                         *//*                                                              *//*                                              Wences Gouveia  *//*                                              September 1995  */#include "posteriori.h"void RTu(int i1, int i2){   /* declaration of variables */   float rho1rho2;                 /* rho1 * rho2 */   complex aux1, aux2, aux3, c;       complex cuu, caux2, aux1aux3;   /* auxiliar quantities */   complex a1, a2, b1, b2;         /* all vertical slownesses */   complex a1b1, a1b2, a2b1, a2b2; /* auxiliar quantities */   complex a1a2b1b2;               /* auxiliar quantities */   complex d1u, d2u;               /* auxiliar quantities */   complex dpda, dpdb;             /* auxiliar quantities */      /* square-root of PSlowness^2 - uuC */       auxm1 = PSlowness[i1][0].r - uuC.r;   auxm2 = PSlowness[i1][0].i - uuC.i;   auxm3 = sqrt(auxm1 * auxm1 + auxm2 * auxm2);   auxm3 = sqrt(auxm3);   angle = atan2(auxm2, auxm1) / 2;   a1.r = auxm3 * cos(angle);   a1.i = auxm3 * sin(angle);   /* square-root of SSlowness^2 - uuC */       auxm1 = SSlowness[i1][0].r - uuC.r;   auxm2 = SSlowness[i1][0].i - uuC.i;   auxm3 = sqrt(auxm1 * auxm1 + auxm2 * auxm2);   auxm3 = sqrt(auxm3);   angle = atan2(auxm2, auxm1) / 2;   b1.r = auxm3 * cos(angle);   b1.i = auxm3 * sin(angle);   /* square-root of PSlowness^2 - uuC */       auxm1 = PSlowness[i2][0].r - uuC.r;   auxm2 = PSlowness[i2][0].i - uuC.i;   auxm3 = sqrt(auxm1 * auxm1 + auxm2 * auxm2);   auxm3 = sqrt(auxm3);   angle = atan2(auxm2, auxm1) / 2;   a2.r = auxm3 * cos(angle);   a2.i = auxm3 * sin(angle);   /* square-root of SSlowness^2 - uuC */       auxm1 = SSlowness[i2][0].r - uuC.r;   auxm2 = SSlowness[i2][0].i - uuC.i;   auxm3 = sqrt(auxm1 * auxm1 + auxm2 * auxm2);   auxm3 = sqrt(auxm3);   angle = atan2(auxm2, auxm1) / 2;   b2.r = auxm3 * cos(angle);   b2.i = auxm3 * sin(angle);   /* computing auxiliary quantities */   rho1rho2 = rho[i1] * rho[i2];   c.r = 2 * (rho[i1] * S2Velocity[i1][0].r - rho[i2] * S2Velocity[i2][0].r);   c.i = 2 * (rho[i1] * S2Velocity[i1][0].i - rho[i2] * S2Velocity[i2][0].i);   cuu.r = c.r * uuC.r - c.i * uuC.i;   cuu.i = c.r * uuC.i + c.i * uuC.r;   aux1.r = cuu.r - (rho[i1] - rho[i2]);   aux1.i = cuu.i;      aux2.r = cuu.r + rho[i2];   aux2.i = cuu.i;   aux3.r = cuu.r - rho[i1];   aux3.i = cuu.i;   caux2.r = c.r * aux2.r - c.i * aux2.i;   caux2.i = c.r * aux2.i + c.i * aux2.r;   aux1aux3.r = aux1.r * aux3.r - aux1.i * aux3.i;   aux1aux3.i = aux1.r * aux3.i + aux1.i * aux3.r;   a1b1.r = a1.r * b1.r - a1.i * b1.i;   a1b1.i = a1.r * b1.i + a1.i * b1.r;   a1b2.r = a1.r * b2.r - a1.i * b2.i;   a1b2.i = a1.r * b2.i + a1.i * b2.r;   a2b1.r = a2.r * b1.r - a2.i * b1.i;   a2b1.i = a2.r * b1.i + a2.i * b1.r;   a2b2.r = a2.r * b2.r - a2.i * b2.i;   a2b2.i = a2.r * b2.i + a2.i * b2.r;   a1a2b1b2.r = a1b1.r * a2b2.r - a1b1.i * a2b2.i;   a1a2b1b2.i = a1b1.r * a2b2.i + a1b1.i * a2b2.r;   /* computing D factors */   auxm1 = aux2.r * aux2.r - aux2.i * aux2.i;   auxm2 = 2 * aux2.r * aux2.i;   auxm3 = a1b1.r * auxm1 - a1b1.i * auxm2;   auxm4 = a1b1.r * auxm2 + a1b1.i * auxm1;   d1u.r = auxm3 + a1b2.r * rho1rho2;   d1u.i = auxm4 + a1b2.i * rho1rho2;   auxm1 = aux1.r * aux1.r - aux1.i * aux1.i;   auxm2 = 2 * aux1.r * aux1.i;   auxm3 = auxm1 * uuC.r - auxm2 * uuC.i;   auxm4 = auxm1 * uuC.i + auxm2 * uuC.r;   d1u.r += auxm3;   d1u.i += auxm4;   auxm1 = aux3.r * aux3.r - aux3.i * aux3.i;   auxm2 = 2 * aux3.r * aux3.i;   auxm3 = a2b2.r * auxm1 - a2b2.i * auxm2;   auxm4 = a2b2.r * auxm2 + a2b2.i * auxm1;   d2u.r = auxm3 + a2b1.r * rho1rho2;   d2u.i = auxm4 + a2b1.i * rho1rho2;   auxm1 = c.r * cuu.r - c.i * cuu.i;   auxm2 = c.r * cuu.i + c.i * cuu.r;   auxm3 = a1a2b1b2.r * auxm1 - a1a2b1b2.i * auxm2;   auxm4 = a1a2b1b2.r * auxm2 + a1a2b1b2.i * auxm1;   d2u.r += auxm3;   d2u.i += auxm4;   /* more auxiliar quantities */   /* d1u + d2u */   dd.r = d1u.r + d2u.r;   dd.i = d1u.i + d2u.i;   /* 1 / dd */   aux = dd.r * dd.r + dd.i * dd.i;   dd.r = dd.r / aux;   dd.i = -dd.i / aux;   dpda.r = a2.r * dd.r - a2.i * dd.i;   dpda.i = a2.r * dd.i + a2.i * dd.r;   dpdb.r = b2.r * dd.r - b2.i * dd.i;   dpdb.i = b2.r * dd.i + b2.i * dd.r;   /* computing the coefficients - first reflection */   auxm1 = d2u.r - d1u.r;   auxm2 = d2u.i - d1u.i;   /* (d2u - d1u) / (d1u + d2u) */   coeffU[0].r = auxm1 * dd.r - auxm2 * dd.i;   coeffU[0].i = auxm1 * dd.i + auxm2 * dd.r;                 /* Rpp */   auxm1 = a1b1.r * caux2.r - a1b1.i * caux2.i;   auxm2 = a1b1.r * caux2.i + a1b1.i * caux2.r;   coeffU[1].r = aux1aux3.r + auxm1;   coeffU[1].i = aux1aux3.i + auxm2;                          /* Rsp */  								    coeffU[2].r = coeffU[1].r;   coeffU[2].i = coeffU[1].i;                                 /* Rps*/     auxm3 = -dpdb.r * uC2.r + dpdb.i * uC2.i;   auxm4 = -dpdb.r * uC2.i - dpdb.i * uC2.r;      aux = auxm3 * coeffU[1].r - auxm4 * coeffU[1].i;   coeffU[1].i = auxm3 * coeffU[1].i + auxm4 * coeffU[1].r;   coeffU[1].r = aux;                                         /* Rsp */   auxm3 = dpda.r * uC2.r - dpda.i * uC2.i;   auxm4 = dpda.r * uC2.i + dpda.i * uC2.r;      aux = auxm3 * coeffU[2].r - auxm4 * coeffU[2].i;   coeffU[2].i = auxm3 * coeffU[2].i + auxm4 * coeffU[2].r;   coeffU[2].r = aux;                                         /* Rps */   auxm1 = d2u.r - d1u.r;   auxm2 = d2u.i - d1u.i;   auxm3 = 2 * rho1rho2 * (a2b1.r - a1b2.r);   auxm4 = 2 * rho1rho2 * (a2b1.i - a1b2.i);   coeffU[3].r = auxm1 - auxm3;   coeffU[3].i = auxm2 - auxm4;   aux = coeffU[3].r * dd.r - coeffU[3].i * dd.i;   coeffU[3].i = coeffU[3].r * dd.i + coeffU[3].i * dd.r;   coeffU[3].r = aux;                                         /* Rss */   /* now transmition */   auxm1 = b1.r * aux2.r - b1.i * aux2.i;   auxm2 = b1.r * aux2.i + b1.i * aux2.r;   auxm3 = b2.r * aux3.r - b2.i * aux3.i;   auxm4 = b2.r * aux3.i + b2.i * aux3.r;   coeffU[4].r = auxm1 - auxm3;        coeffU[4].i = auxm2 - auxm4;   aux = 2 * rho[i2] * (dpda.r * coeffU[4].r - dpda.i * coeffU[4].i);   coeffU[4].i = 2 * rho[i2] * (dpda.r * coeffU[4].i + dpda.i * coeffU[4].r);   coeffU[4].r = aux;                                         /* Tpp */   coeffU[5].r = aux1.r + a2b1.r * c.r - a2b1.i * c.i;   coeffU[5].i = aux1.i + a2b1.r * c.i + a2b1.i * c.r;   auxm1 = rho[i2] * (dpdb.r * uC2.r - dpdb.i * uC2.i);   auxm2 = rho[i2] * (dpdb.r * uC2.i + dpdb.i * uC2.r);   aux = coeffU[5].r * auxm1 - coeffU[5].i * auxm2;   coeffU[5].i = coeffU[5].r * auxm2 + coeffU[5].i * auxm1;   /* Tsp */   coeffU[5].r = aux;    coeffU[6].r = aux1.r + a1b2.r * c.r - a1b2.i * c.i;   coeffU[6].i = aux1.i + a1b2.r * c.i + a1b2.i * c.r;   auxm1 = -rho[i2] * (dpda.r * uC2.r - dpda.i * uC2.i);   auxm2 = -rho[i2] * (dpda.r * uC2.i + dpda.i * uC2.r);   aux = coeffU[6].r * auxm1 - coeffU[6].i * auxm2;   coeffU[6].i = coeffU[6].r * auxm2 + coeffU[6].i * auxm1;   /* Tsp */   coeffU[6].r = aux;   auxm1 = a1.r * aux2.r - a1.i * aux2.i;   auxm2 = a1.r * aux2.i + a1.i * aux2.r;   coeffU[7].r = auxm1 - (a2.r * aux3.r - a2.i * aux3.i);   coeffU[7].i = auxm2 - (a2.r * aux3.i + a2.i * aux3.r);        auxm3 = 2 * rho[i2] * dpdb.r;   auxm4 = 2 * rho[i2] * dpdb.i;   aux = coeffU[7].r * auxm3 - coeffU[7].i * auxm4;   coeffU[7].i = coeffU[7].r * auxm4 + coeffU[7].i * auxm3;   /* Tss */   coeffU[7].r = aux;}/*                                                              *//*  Function RTd()                                              *//*                                                              *//*  Computation of the reflection and transmission coefficients *//*  of downgoing incident waves                                 *//*                                                              *//*  Input parameters:                                           *//*  alpha..................p-wave velocities of the model       *//*                         global variable                      *//*  beta...................s-wave velocities of the model       *//*                         global variable                      *//*  rho....................densities of the elastic model       *//*                         global variable                      *//*  thick..................thicknesses of the model             */ /*                         global variable                      *//*  i1.....................points to the first layer            *//*  i2.....................points to the second layer           *//*                                                              *//*  Output parameters:                                          *//*  coeffD.................Reflection and transmition           *//*                         coefficients                         *//*                                                              *//*                                              Wences Gouveia  *//*                                              September 1995  */void RTd(int i1, int i2){   /* declaration of variables */   float rho1rho2;                 /* rho1 * rho2 */   complex aux1, aux2, aux3, c;       complex cuu, caux3, aux1aux2;   /* auxiliar quantities */   complex a1, a2, b1, b2;         /* all vertical slownesses */   complex a1b1, a1b2, a2b1, a2b2; /* auxiliar quantities */   complex a1a2b1b2;               /* auxiliar quantities */   complex d1d, d2d;               /* auxiliar quantities */   complex dpda, dpdb;             /* auxiliar quantities */   /* square-root of Pslowness^2 - uuC */       auxm1 = PSlowness[i1][0].r - uuC.r;   auxm2 = PSlowness[i1][0].i - uuC.i;   auxm3 = sqrt(auxm1 * auxm1 + auxm2 * auxm2);   auxm3 = sqrt(auxm3);   angle = atan2(auxm2, auxm1) / 2;   a1.r = auxm3 * cos(angle);   a1.i = auxm3 * sin(angle);   /* square-root of SSlowness^2 - uuC */       auxm1 = SSlowness[i1][0].r - uuC.r;   auxm2 = SSlowness[i1][0].i - uuC.i;   auxm3 = sqrt(auxm1 * auxm1 + auxm2 * auxm2);   auxm3 = sqrt(auxm3);   angle = atan2(auxm2, auxm1) / 2;   b1.r = auxm3 * cos(angle);   b1.i = auxm3 * sin(angle);   /* square-root of PSlowness^2 - uuC */       auxm1 = PSlowness[i2][0].r - uuC.r;   auxm2 = PSlowness[i2][0].i - uuC.i;   auxm3 = sqrt(auxm1 * auxm1 + auxm2 * auxm2);   auxm3 = sqrt(auxm3);   angle = atan2(auxm2, auxm1) / 2;   a2.r = auxm3 * cos(angle);   a2.i = auxm3 * sin(angle);   /* square-root of SSlowness^2 - uuC */       auxm1 = SSlowness[i2][0].r - uuC.r;   auxm2 = SSlowness[i2][0].i - uuC.i;   auxm3 = sqrt(auxm1 * auxm1 + auxm2 * auxm2);   auxm3 = sqrt(auxm3);   angle = atan2(auxm2, auxm1) / 2;   b2.r = auxm3 * cos(angle);   b2.i = auxm3 * sin(angle);   /* computing auxiliary quantities */   rho1rho2 = rho[i1] * rho[i2];   c.r = 2 * (rho[i1] * S2Velocity[i1][0].r - rho[i2] * S2Velocity[i2][0].r);   c.i = 2 * (rho[i1] * S2Velocity[i1][0].i - rho[i2] * S2Velocity[i2][0].i);   cuu.r = c.r * uuC.r - c.i * uuC.i;   cuu.i = c.r * uuC.i + c.i * uuC.r;      aux1.r = cuu.r - (rho[i1] - rho[i2]);   aux1.i = cuu.i;   aux2.r = cuu.r + rho[i2];   aux2.i = cuu.i;      aux1aux2.r = aux1.r * aux2.r - aux1.i * aux2.i;   aux1aux2.i = aux1.r * aux2.i + aux1.i * aux2.r;   aux3.r = cuu.r - rho[i1];   aux3.i = cuu.i;   caux3.r = c.r * aux3.r - c.i * aux3.i;   caux3.i = c.r * aux3.i + c.i * aux3.r;      a1b1.r = a1.r * b1.r - a1.i * b1.i;   a1b1.i = a1.r * b1.i + a1.i * b1.r;   a1b2.r = a1.r * b2.r - a1.i * b2.i;   a1b2.i = a1.r * b2.i + a1.i * b2.r;   a2b1.r = a2.r * b1.r - a2.i * b1.i;   a2b1.i = a2.r * b1.i + a2.i * b1.r;   a2b2.r = a2.r * b2.r - a2.i * b2.i;   a2b2.i = a2.r * b2.i + a2.i * b2.r;   a1a2b1b2.r = a1b1.r * a2b2.r - a1b1.i * a2b2.i;   a1a2b1b2.i = a1b1.r * a2b2.i + a1b1.i * a2b2.r;      /* computing D factors */      auxm1 = aux3.r * aux3.r - aux3.i * aux3.i;   auxm2 = 2 * aux3.r * aux3.i;   auxm3 = a2b2.r * auxm1 - a2b2.i * auxm2;   auxm4 = a2b2.r * auxm2 + a2b2.i * auxm1;   d1d.r = auxm3 + a2b1.r * rho1rho2;   d1d.i = auxm4 + a2b1.i * rho1rho2;      auxm1 = aux1.r * aux1.r - aux1.i * aux1.i;   auxm2 = 2 * aux1.r * aux1.i;   auxm3 = auxm1 * uuC.r - auxm2 * uuC.i;   auxm4 = auxm1 * uuC.i + auxm2 * uuC.r;   d1d.r += auxm3;   d1d.i += auxm4;      auxm1 = aux2.r * aux2.r - aux2.i * aux2.i;   auxm2 = 2 * aux2.r * aux2.i;   auxm3 = a1b1.r * auxm1 - a1b1.i * auxm2;   auxm4 = a1b1.r * auxm2 + a1b1.i * auxm1;   d2d.r = auxm3 + a1b2.r * rho1rho2;   d2d.i = auxm4 + a1b2.i * rho1rho2;   auxm1 = c.r * cuu.r - c.i * cuu.i;   auxm2 = c.r * cuu.i + c.i * cuu.r;   auxm3 = a1a2b1b2.r * auxm1 - a1a2b1b2.i * auxm2;   auxm4 = a1a2b1b2.r * auxm2 + a1a2b1b2.i * auxm1;   d2d.r += auxm3;   d2d.i += auxm4;      /* more auxiliar quantities */   /* d1d + d2d */   dd.r = d1d.r + d2d.r;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -