yinliu-91 / bilibili-dg-lectures Goto Github PK
View Code? Open in Web Editor NEWThis project forked from l1ssandra/bilibili-dg-lectures
Some example programs of DG which will be teached on Bilibili
License: GNU General Public License v3.0
This project forked from l1ssandra/bilibili-dg-lectures
Some example programs of DG which will be teached on Bilibili
License: GNU General Public License v3.0
参考其他代码库给结果添加绘图
是正交基1,x,x^2-1/3各自的平方在0-1区间上积分的结果
由于质量矩阵是对角阵 可以直接被除掉
% 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
for d = 1:dimPk
uh(:,d) = uh(:,d)/mm(d); % mm在get_basis.m中定义, 这里看出,uh只是多项式的系数,并不是解
end
由于uh只是系数,所以真解要用上面2中的公式计算
由于在每个单元中,左中右的点分别为(-1,0,1),所以将其带入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
从chiwang shu 的天元课程讲义中有(注意,均值是对
那么:
且:
因此利用下图公式可以得到
for i = 1:Nx % 循环所有单元
deltaUR = uh(i,2) + (2/3)*uh(i,3); % 单元右端值减去平均值
deltaUL = uh(i,2) - (2/3)*uh(i,3); % 单元平均值减去单元左端值?这里对?
deltaURM = uhb(i + 2,1) - uhb(i + 1,1); % 右单元平均值减去本单元平均值
deltaULM = uhb(i + 1,1) - uhb(i,1); % 本单元平均值减去左单元平均值
deltaURM1 = minmod(deltaUR,deltaURM,deltaULM);
deltaULM1 = minmod(deltaUL,deltaURM,deltaULM);
uhmod(i,2) = (deltaURM1 + deltaULM1)/2;
uhmod(i,3) = 3*(deltaURM1 - deltaULM1)/4;
end
这里说明了解是正交基的线性组合
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.