%基于铌酸锂光波导中级联的和频与差频效应的波长转换
clear;clf;
global tmax tmin delta_t
zmin=0;zmax=40;delta_z=0.1;
tmin=-20;tmax=20;delta_t=0.1;
z=zmin:delta_z:zmax; %长度单位:mm
t=tmin:delta_t:tmax; %时间单位:ps
c=2.998e8; %光速单位:m/s
Pp10=0.5; %泵浦1功率 单位:W
Pp20=0.4905; %泵浦2功率
Ps0=0.001; %信号光功率
Ap1=zeros((zmax-zmin)/delta_z+1,(tmax-tmin)/delta_t+1); %分配空间
Ap2=zeros((zmax-zmin)/delta_z+1,(tmax-tmin)/delta_t+1);
Asf=zeros((zmax-zmin)/delta_z+1,(tmax-tmin)/delta_t+1);
As=zeros((zmax-zmin)/delta_z+1,(tmax-tmin)/delta_t+1);
Ac=zeros((zmax-zmin)/delta_z+1,(tmax-tmin)/delta_t+1);
Pp1=zeros((zmax-zmin)/delta_z+1,(tmax-tmin)/delta_t+1);
Pp2=zeros((zmax-zmin)/delta_z+1,(tmax-tmin)/delta_t+1);
Psf=zeros((zmax-zmin)/delta_z+1,(tmax-tmin)/delta_t+1);
Ps=zeros((zmax-zmin)/delta_z+1,(tmax-tmin)/delta_t+1);
Pc=zeros((zmax-zmin)/delta_z+1,(tmax-tmin)/delta_t+1);
PPp1=zeros(1,(zmax-zmin)/delta_z+1);
PPp2=zeros(1,(zmax-zmin)/delta_z+1);
PPsf=zeros(1,(zmax-zmin)/delta_z+1);
PPc=zeros(1,(zmax-zmin)/delta_z+1);
tau_0p1=7; %初始脉宽
Ap1(1,:)=sqrt(Pp10)*sech(1.76*t/tau_0p1);
tau_0p2=tau_0p1;
Ap2(1,:)=sqrt(Pp20)*sech(1.76*t/tau_0p2);
tau_0s=7;
As(1,:)=sqrt(Ps0)*sech(1.76*t/tau_0s);
Asf(1,:)=0;
Ac(1,:)=0;
bp1=1.53;
bp2=0.772*bp1/(bp1-0.772);
bsf=0.772;
bs=1.55;
bc=1/(1/bsf-1/bs);
deff=17.2; %有效非线性系数 单位:pm/v
u0=4*pi*1e-7; %磁导率 单位:N*s^2/C^2
Aeff=50; %有效相互作用面积 单位:um^2
ksf=deff/c*sqrt(2*c*u0/(Aeff*n2(bp1)*n2(bp2)*n2(bsf))); %和频耦合系数
kdf=deff/c*sqrt(2*c*u0/(Aeff*n2(bs)*n2(bc)*n2(bsf))); %差频耦合系数
delta_k=2*pi*(n2(bp1)/bp1+n2(bp2)/bp2-n2(bs)/bs-n2(bc)/bc); %相位失配
%迭代计算SFG+DFG过程中的脉冲振幅变化
for n=2:1:(zmax-zmin)/delta_z+1
Ap1(n,:)=Ap1(n-1,:)+i/2*beta2(bp1)*delta_z*gradient(gradient(Ap1(n-1,:),delta_t),delta_t)*1e-6+i*2*pi*c/bp1*delta_z*ksf*Asf(n-1,:).*conj(Ap2(n-1,:))*1e-3;
Ap2(n,:)=Ap2(n-1,:)-(1/vg(bp2)-1/vg(bp1))*delta_z*gradient(Ap2(n-1,:),delta_t)*1e12+i/2*beta2(bp2)*delta_z*gradient(gradient(Ap2(n-1,:),delta_t),delta_t)*1e-6+i*2*pi*c/bp2*delta_z*ksf*Asf(n-1,:).*conj(Ap1(n-1,:))*1e-3;
Asf(n,:)=Asf(n-1,:)-(1/vg(bsf)-1/vg(bp1))*delta_z*gradient(Asf(n-1,:),delta_t)*1e12+i/2*beta2(bsf)*delta_z*gradient(gradient(Asf(n-1,:),delta_t),delta_t)*1e-6+i*2*pi*c/bsf*delta_z*ksf*Ap1(n-1,:).*Ap2(n-1,:)*1e-3+i*2*pi*c/bsf*delta_z*kdf*Ac(n-1,:).*As(n-1,:)*exp(-i*delta_k*delta_z*(n-1)*1e3)*1e-3;
As(n,:)=As(n-1,:)-(1/vg(bs)-1/vg(bp1))*delta_z*gradient(As(n-1,:),delta_t)*1e12+i/2*beta2(bs)*delta_z*gradient(gradient(As(n-1,:),delta_t),delta_t)*1e-6+i*2*pi*c/bs*delta_z*kdf*Asf(n-1,:).*conj(Ac(n-1,:))*exp(i*delta_k*delta_z*(n-1)*1e3)*1e-3;
Ac(n,:)=Ac(n-1,:)-(1/vg(bc)-1/vg(bp1))*delta_z*gradient(Ac(n-1,:),delta_t)*1e12+i/2*beta2(bc)*delta_z*gradient(gradient(Ac(n-1,:),delta_t),delta_t)*1e-6+i*2*pi*c/bc*delta_z*kdf*Asf(n-1,:).*conj(As(n-1,:))*exp(i*delta_k*delta_z*(n-1)*1e3)*1e-3;
Pp1(n,:)=(abs(Ap1(n,:))).^2; %脉冲功率
Pp2(n,:)=(abs(Ap2(n,:))).^2;
Psf(n,:)=(abs(Asf(n,:))).^2;
Ps(n,:)=(abs(As(n,:))).^2;
Pc(n,:)=(abs(Ac(n,:))).^2;
PPp1(n)=max(cumtrapz(Pp1(n,:))); %脉冲能量
PPp2(n)=max(cumtrapz(Pp2(n,:)));
PPsf(n)=max(cumtrapz(Psf(n,:)));
PPc(n)=max(cumtrapz(Pc(n,:)));
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%画L处泵浦1波形
subplot(3,3,1)
plot(t,Pp1(n,:))
title('Pp-t');
xlabel('t/fs');ylabel('泵浦脉冲功率 Pp/W');
grid on
%画L处倍频光波形
subplot(3,3,2)
plot(t,Psf(n,:))
title('Psh-t');
xlabel('t/fs');ylabel('倍频光脉冲功率 Psh/W');
grid on
%画L处信号光波形
subplot(3,3,3)
plot(t,Ps(n,:))
title('Ps-t');
xlabel('t/fs');ylabel('信号光脉冲功率 Ps/W');
grid on
%画L处差频光波形
subplot(3,3,4)
plot(t,Pc(n,:))
title('Pc-t');
xlabel('t/fs');ylabel('差频光脉冲功率 Pc/W');
grid on