包含基于射线追踪的任意复杂界面计算

这个提交包含在:
2026-08-14 08:00:47 +08:00
父节点 d1a709985d
当前提交 b4cf75ce78
修改 91 个文件,包含 1612224 行新增515 行删除
二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 574 KiB

@@ -0,0 +1,114 @@
import os
import glob
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
# ==========================
# User parameters
# ==========================
# Read all files matching this pattern in the same directory as this script
file_pattern = "dBzdt_*.txt"
label_fontsize = 18
tick_fontsize = 15
legend_fontsize = 15
linewidth = 2.5
xmin = 1e-6
xmax = 1e-1
ymin = None
ymax = None
use_abs = True
figsize = (8, 6)
savefig = True
save_name = "TEM_decay_curve.png"
dpi = 600
# ==========================
# Colors
# ==========================
# Fixed-order categorical palette (colorblind-safe, validated).
# For more than 8 series, a sequential blue ramp is used instead of cycling.
PALETTE = ["#2a78d6", "#eb6834", "#1baf7a", "#eda100",
"#e87ba4", "#008300", "#4a3aa7", "#e34948"]
RAMP_HEX = ["#86b6ef", "#5598e7", "#3987e5", "#2a78d6",
"#256abf", "#1c5cab", "#184f95", "#104281"]
def series_color(i, n):
"""Color for the i-th series of n (fixed order, never cycled)."""
if n <= len(PALETTE):
return PALETTE[i]
cmap = LinearSegmentedColormap.from_list("seq_blue", RAMP_HEX)
return cmap(i / (n - 1))
# ==========================
# Read data
# ==========================
script_dir = os.path.dirname(os.path.abspath(__file__))
files = sorted(glob.glob(os.path.join(script_dir, file_pattern)))
if not files:
raise FileNotFoundError(
f"No files matching '{file_pattern}' in {script_dir}")
if use_abs:
ylabel = r"$|dB_z/dt|$ (V/A)"
else:
ylabel = r"$dB_z/dt$ (V/A)"
plt.figure(figsize=figsize)
for i, filename in enumerate(files):
# Header: line 1 = point name, line 2 = receiver coordinates (x, y, z)
with open(filename) as f:
point_name = f.readline().strip()
coords = [float(v) for v in f.readline().split()]
x, y, z = coords
label = f"{point_name} ({x:g}, {y:g}, {z:g}) m"
data = np.loadtxt(filename, skiprows=2)
time = data[:, 1]
dbdt = data[:, 2]
if use_abs:
dbdt_plot = np.abs(dbdt)
else:
dbdt_plot = dbdt
mask = (time > 0) & (dbdt_plot > 0)
plt.loglog(time[mask], dbdt_plot[mask], linewidth=linewidth,
color=series_color(i, len(files)), label=label)
# ==========================
# Plot
# ==========================
plt.xlabel("Time (s)", fontsize=label_fontsize)
plt.ylabel(ylabel, fontsize=label_fontsize)
plt.xticks(fontsize=tick_fontsize)
plt.yticks(fontsize=tick_fontsize)
plt.grid(True, which="both", linestyle="--", alpha=0.4)
if xmin is not None or xmax is not None:
plt.xlim(xmin, xmax)
if ymin is not None or ymax is not None:
plt.ylim(ymin, ymax)
plt.legend(fontsize=legend_fontsize)
plt.tight_layout()
if savefig:
plt.savefig(os.path.join(script_dir, save_name), dpi=dpi)
plt.show()
文件差异内容过多而无法显示 加载差异
文件差异内容过多而无法显示 加载差异
文件差异内容过多而无法显示 加载差异
@@ -0,0 +1,35 @@
1 ! 1-Ground TEM;2-SATEM
210 ! 回线源尺寸
121,121,120 ! x、y、z网格数量
0 ! 边界条件开关:1=CPML吸收边界,0=原始非均匀网格Dirichlet边界
10,10,10 ! PML层数(x、y、z方向,仅开关=1时有效)
30,30 ! x方向均匀核心区域范围/数量
30,30 ! y方向均匀核心区域范围/数量
20,30 ! z方向均匀核心区域范围/数量
10 ! 核心均匀网格尺寸
0.01 ! 背景介质电导率(S/m)
2 ! 介质数量
1,121
1,121
1,60
1e-5
1,121
1,121
61,120
1e-2
4000000 ! 最大迭代次数
90.101 ! 最大计算时间
1e-6,1e-9 ! 上升沿时间及时间步
60000e-6 ! 平台阶段持续时间
1e-7,1e-9 ! 下降沿时间及时间步
1e-9 ! 初始时间步
1 ! AMP
2.0 ! The conductivity of abnormal body (When the file Complex_anomalous.dat exists)
TIXING_UPCOS ! source type
3 ! 接收测点数量
1 ! 测点1编号
-60,0,0 ! 测点1坐标
2
-30,0,0
3
0,0,0
文件差异内容过多而无法显示 加载差异