• 地震褶积方法制作合成地震记录c++


     地震褶积方法制作合成地震记录

    包括,(1)读取相模型,设置每种相的密度和速度,(2)计算反射系数,添加噪音,(3)设置子波,(4)进行褶积计算。具体的代码如下

    1. void syntheticSeis(const string& faciesFileName, const string&synseisFileName,
    2. vectorint, double, double>>faciesDenVelocity,
    3. double dt, double fm, int convLength)
    4. {
    5. const double PI = 4 * (4 * atan(1.0f / 5) - atan(1.0f / 239));
    6. IModel3D<int> facies;
    7. facies.loadNumpy(faciesFileName);
    8. int ni = facies.getNi();
    9. int nj = facies.getNj();
    10. int nk = facies.getNk();
    11. auto faciesList = facies.getValueVec();
    12. for (auto item : faciesList) {
    13. bool find = false;
    14. for (auto fv : faciesDenVelocity) {
    15. if (get<0>(fv) == item) {
    16. find = true;
    17. break;
    18. }
    19. }
    20. if (find == false) {
    21. std::cout << "fail to find facies " << item <<
    22. " in facies_velocity_set" << std::endl;
    23. return;
    24. }
    25. }
    26. // define the velocity of each facies
    27. auto impedance = IModel3D<float>(nj,ni,nk,"veclocity");
    28. const int* faciesPtr = facies.grid().data();
    29. float* impPtr = impedance.grid().data();
    30. random_device dev;
    31. default_random_engine rnd(dev());
    32. uniform_real_distribution<double> u(0.95, 1);
    33. for (int i = 0; i < ni * nj * nk; i++) {
    34. int faciesV = faciesPtr[i];
    35. for (const auto& item : faciesDenVelocity) {
    36. if (get<0>(item) == faciesV) {
    37. //impPtr[i] = get<1>(item)* get<2>(item);
    38. impPtr[i] = get<1>(item) * get<2>(item) * u(rnd); //with noise
    39. break;
    40. }
    41. }
    42. }
    43. // define the reflection coefficient
    44. auto refCoef = IModel3D<float>(nj, ni, nk, "reflectionCoefficient");
    45. for (int j = 0; j < nj; j++) {
    46. for (int i = 0; i < ni; i++) {
    47. refCoef.setValue(j, i, nk - 1, 0);
    48. for (int k = nk - 2; k >= 0; k--) {
    49. float imp1 = impedance.getValue(j, i, k + 1);
    50. float imp2 = impedance.getValue(j, i, k);
    51. float coef = (imp2 - imp1) / (imp2 + imp1);
    52. refCoef.setValue(j, i, k, coef);
    53. }
    54. }
    55. }
    56. float vMin = FLT_MAX, vMax = -FLT_MAX;
    57. refCoef.getMinMax(vMin, vMax);
    58. std::cout << "refcoef vmin= " << vMin << " vmax= " << vMax << std::endl;
    59. // calculate syntheic seismic
    60. int n = convLength;
    61. auto rickerWave = [=](int kk)->float {
    62. return (1 - 2 * pow(PI * fm * dt*kk, 2)) * exp(-pow(PI * fm * dt*kk, 2));
    63. };
    64. // define the synthetic seismic trace
    65. auto synSeis = IModel3D<float>(nj, ni, nk, "syntheticSeis");
    66. for (int j = 0; j < nj; j++) {
    67. for (int i = 0; i < ni; i++) {
    68. for (int k = nk - 1; k >= 0; k--) {
    69. // seismic convolution
    70. double trace = 0.0;
    71. for (int t = -int(n / 2); t<int(n / 2); t++) {
    72. if (t + k < 0 || t + k >= nk)
    73. continue;
    74. else
    75. {
    76. double riker = rickerWave(t);
    77. double coef = refCoef.getValue(j, i, k + t);
    78. double value = riker * coef;
    79. trace += value;
    80. }
    81. }
    82. synSeis.setValue(j, i, k, trace);
    83. }
    84. }
    85. }
    86. synSeis.saveNumpy(synseisFileName);
    87. vMin = FLT_MAX;
    88. vMax = -FLT_MAX;
    89. synSeis.getMinMax(vMin, vMax);
    90. std::cout <<"create syntheitc seismic"<" synseis vmin= " << vMin << " vmax= " << vMax << std::endl;
    91. }

    读取的参数文件

    参数文件

    #option data for create synthetic seismic trace
    ricker_fm 25
    ricker_dt 0.002
    ricker_conv_length 40


    #define density velocity of each facies
    max_facies_num 12
    facies_den_velocity_0 0 0.1 3000
    facies_den_velocity_1 1 0.1 3200
    facies_den_velocity_2 2 0.1 3500
    facies_den_velocity_3 3 0.1 3200
    facies_den_velocity_4 4 0.1 3500
    facies_den_velocity_5 5 0.1 3200
    facies_den_velocity_6 6 0.1 3500
    facies_den_velocity_7 7 0.1 3200
    facies_den_velocity_8 8 0.1 3500
    facies_den_velocity_9 9 0.1 3000
    facies_den_velocity_10 95 0.1 3200
    facies_den_velocity_11 100 0.1 3200

    files_contians_npy3dfile_at_each_line npy3dfiles.txt

  • 相关阅读:
    点云处理【六】(点云分割)
    三对角矩阵原理及C++实现
    第十四届蓝桥杯模拟赛(第二期)
    edusoho企培版纯内网部署教程(解决播放器,上传,后台卡顿问题)
    【零基础入门MyBatis系列】第七篇——Javassist生成类与接口代理机制
    FPGA原理与结构——时钟IP核的使用与测试
    (十六)Spring对事务的支持
    GRS全球回收标准-未来趋势
    输入法发展历史
    外贸网站做Google SEO 用wordpress模板的优势
  • 原文地址:https://blog.csdn.net/yanfeng1022/article/details/126593223