Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uh的含义和如何计算单元3个点处的结果 #6

Open
YinLiu-91 opened this issue Nov 19, 2023 · 0 comments
Open

uh的含义和如何计算单元3个点处的结果 #6

YinLiu-91 opened this issue Nov 19, 2023 · 0 comments

Comments

@YinLiu-91
Copy link
Owner

YinLiu-91 commented Nov 19, 2023

uh的含义

  1. uh只是某个单元某个多项式系数的值: $c_0,c_1,c_2$
  2. 而某个单元上最终的结果表示为: $u_h=c_0\phi_0+c_1\phi_1+c_2\phi_2$
  3. 而所以有 $\int_{I_i}f(u_h^n)\phi_xdx$, uhG(i,:)表示的是对于某个单元i,所有积分点处的解的结果(不是系数,是真实的解),固定某个GLP点看,其表达的就是上面2中的叠加
% Step 1: calculate the Integral in cell
for i = 1:Nx                                      % 对所有对单元上的
    for d = 1:dimPk                               % 所有型函数进行计算,并累加到uhG上。进行对是所有型函数对累加
        uhG(i,:) = uhG(i,:) + uh(i,d)*phiG(:,d)'; % 这里计算的是f(u)中的u,下面才是计算的积分
    end
end
  1. 从下面看出,uh程序中只是解的系数,并不是解:
for d = 1:dimPk
    uh(:,d) = uh(:,d)/mm(d);  % mm在get_basis.m中定义, 这里看出,uh只是多项式的系数,并不是解
end

如何计算与保存最后的真解

  1. 由于uh只是系数,所以真解要用上面2中的公式计算

  2. 由于在每个单元中,左中右的点分别为(-1,0,1),所以将其带入2中公式后得到:

    • $u_l=c_0-c_1+\frac{2}{3}\cdot c_2$
    • $u_m=c_0-\frac{1}{3}c_2$
    • $u_r=c_0+c_1+\frac{2}{3}\cdot c_2$
    if(mod(floor(t/dt),nsaveT)==0)
      i=i+1;
      % 在单元[-1,0,1]的三个位置处计算最终的求解变量结果
      saved(i,:,:)=[uh(:,1)-uh(:,2)+2/3*uh(:,3) uh(:,1)-1/3*uh(:,3) uh(:,1)+uh(:,2)+2/3*uh(:,3)];
    end
    
  3. 真解图像为:
    image

  4. 而uh的图像为:
    image

@YinLiu-91 YinLiu-91 changed the title uh的含义 uh的含义和如何计算单元3个点处的结果 Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant