How do you apply a rotating (in time) 2d gaussian function to a round plate with a center hole, my script does not seem to rotate the function?
clear all
close all
model=createpde(‘thermal’,’transient’)
geo=multicylinder([1/2,4/2],0.04,"Void",[1,0])
model.Geometry = geo;
pdegplot(model,’FaceLabels’,’on’,’CellLabels’,’on’);grid on
generateMesh(model,’Hmax’,0.1)
pdeplot3d(model)
thermalProperties(model,’ThermalConductivity’,2.1,…
‘MassDensity’,1050,…
‘SpecificHeat’,822)
a = linspace(-2,2,200);
b = linspace(-2,2,200);
time = linspace(0,100,1);
[x,y] = meshgrid(a,b)
state.time = meshgrid(time)
location.x = x;
location.y = y;
thermalIC(model,22)
thermalBC(model,’Face’,1,’Temperature’,22)
thermalBC(model,’Face’,2,’HeatFlux’,@externalHeatFlux)
pdeplot3d(model)
t=0:1:180
state.time = t;
modelresults = solve(model,t)
figure
for n=1:numel(modelresults.SolutionTimes)
pdeplot3d(model.mesh,"ColorMapData",modelresults.Temperature(:,n))
drawnow
pause(0.2)
end
function flux=externalHeatFlux(location,state)
t = state.time
A = 1;
x0 = 0;
y0 = 0;
sx = 0.5;
sy = 2;
for index=1:length(t)
ang = index-1;
flux(:,:,index) = imrotate(A*exp(-(((location.x-x0).^2/(2*sx^2)) +…
((location.y-y0).^2/(2*sy^2)))).*exp(-t(index)),ang,’crop’)
end
endclear all
close all
model=createpde(‘thermal’,’transient’)
geo=multicylinder([1/2,4/2],0.04,"Void",[1,0])
model.Geometry = geo;
pdegplot(model,’FaceLabels’,’on’,’CellLabels’,’on’);grid on
generateMesh(model,’Hmax’,0.1)
pdeplot3d(model)
thermalProperties(model,’ThermalConductivity’,2.1,…
‘MassDensity’,1050,…
‘SpecificHeat’,822)
a = linspace(-2,2,200);
b = linspace(-2,2,200);
time = linspace(0,100,1);
[x,y] = meshgrid(a,b)
state.time = meshgrid(time)
location.x = x;
location.y = y;
thermalIC(model,22)
thermalBC(model,’Face’,1,’Temperature’,22)
thermalBC(model,’Face’,2,’HeatFlux’,@externalHeatFlux)
pdeplot3d(model)
t=0:1:180
state.time = t;
modelresults = solve(model,t)
figure
for n=1:numel(modelresults.SolutionTimes)
pdeplot3d(model.mesh,"ColorMapData",modelresults.Temperature(:,n))
drawnow
pause(0.2)
end
function flux=externalHeatFlux(location,state)
t = state.time
A = 1;
x0 = 0;
y0 = 0;
sx = 0.5;
sy = 2;
for index=1:length(t)
ang = index-1;
flux(:,:,index) = imrotate(A*exp(-(((location.x-x0).^2/(2*sx^2)) +…
((location.y-y0).^2/(2*sy^2)))).*exp(-t(index)),ang,’crop’)
end
end clear all
close all
model=createpde(‘thermal’,’transient’)
geo=multicylinder([1/2,4/2],0.04,"Void",[1,0])
model.Geometry = geo;
pdegplot(model,’FaceLabels’,’on’,’CellLabels’,’on’);grid on
generateMesh(model,’Hmax’,0.1)
pdeplot3d(model)
thermalProperties(model,’ThermalConductivity’,2.1,…
‘MassDensity’,1050,…
‘SpecificHeat’,822)
a = linspace(-2,2,200);
b = linspace(-2,2,200);
time = linspace(0,100,1);
[x,y] = meshgrid(a,b)
state.time = meshgrid(time)
location.x = x;
location.y = y;
thermalIC(model,22)
thermalBC(model,’Face’,1,’Temperature’,22)
thermalBC(model,’Face’,2,’HeatFlux’,@externalHeatFlux)
pdeplot3d(model)
t=0:1:180
state.time = t;
modelresults = solve(model,t)
figure
for n=1:numel(modelresults.SolutionTimes)
pdeplot3d(model.mesh,"ColorMapData",modelresults.Temperature(:,n))
drawnow
pause(0.2)
end
function flux=externalHeatFlux(location,state)
t = state.time
A = 1;
x0 = 0;
y0 = 0;
sx = 0.5;
sy = 2;
for index=1:length(t)
ang = index-1;
flux(:,:,index) = imrotate(A*exp(-(((location.x-x0).^2/(2*sx^2)) +…
((location.y-y0).^2/(2*sy^2)))).*exp(-t(index)),ang,’crop’)
end
end time dependent heat flux, rotating heat flux MATLAB Answers — New Questions