필터 지우기
필터 지우기

PDE toolbox pulse source term in heat equation

조회 수: 2 (최근 30일)
nicolas bachelard
nicolas bachelard 2018년 6월 8일
답변: nicolas bachelard 2018년 6월 8일
Hi,
I would like to implement a source that is time dependent in the heat equation that I model with the pdetoolbox. Typically I am considering a very simple case described below. I consider a circle on a square and I wish to put a sinusoidal like source in this circle.
Can you tell ma what I am doing wrong? The error logs are below as well
R1 = [3;4;-1;1;1;-1;-1;-1;1;1];
C1 = [1;0;0;0.4];
C1 = [C1;zeros(length(R1) - length(C1),1)];
gd = [R1,C1];
sf = 'R1+C1';
ns = char('R1','C1')';
g = decsg(gd,sf,ns);
numberOfPDE = 1;
pdem = createpde(numberOfPDE);
geo = geometryFromEdges(pdem,g);
mysource = @(region,state) sin(350*state.time).^2;
% Specify PDE Coefficients: m*d^2u/dt^2 + d*du/dt - div(c*grad(u)) + a*u = f
applyBoundaryCondition(pdem,'dirichlet','Edge',[(1:4)],'u',293);
specifyCoefficients(pdem,'m',0,'d',1,'c',1,'a',0,'f',mysource,'face',2);
specifyCoefficients(pdem,'m',0,'d',1,'c',1,'a',0,'f',0,'face',1);
msh = generateMesh(pdem);
p = msh.Nodes;
endTime = 5000;
tlist = 0:50:endTime;
numNodes = size(p,2);
setInitialConditions(pdem,300);
R = solvepde(pdem,tlist);
Error logs
Error in pde.DynamicDiscretizedPDEModel (line 27)
obj=obj@pde.DiscretizedPDEModel(thePde,p,e,t,coefstruct,u0);
Error in pde.EquationModel/solveTimeDependent (line 20)
femodel=pde.DynamicDiscretizedPDEModel(self,p,e,t,coefstruct,u0,tlist,tsecondOrder);
Error in pde.PDEModel/solvepde (line 54)
[u,dudt] = self.solveTimeDependent(coefstruct, u0, ut0, tlist, ...
Error in Heat_2D (line 61)
R = solvepde(pdem,tlist);

답변 (2개)

Ravi Kumar
Ravi Kumar 2018년 6월 8일
Hi Nicolas,
What version of MATLAB are you running? I can run you code in R2018a, which produced the temperature distribution as shown in the figure.

nicolas bachelard
nicolas bachelard 2018년 6월 8일
I am running a 2017a license. Do you think this is the issue?
Best

카테고리

Help CenterFile Exchange에서 Geometry and Mesh에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by