Varying heat flux condition (by time) using the PDE toolbox
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Right now I am doing trainsient thermal analysis on a disc; however, the heatflux on the outer surface changes ever second. What do I do?
%% Code that solves the problem
thermalIC(thermalmodel,IC);
thermalBC(thermalmodel,"Edge",[1 2 3 4 5],"HeatFlux",@externalHeatFlux);
result = solve(thermalmodel,tlist);
%% My function
function Qflux = externalHeatFlux(~,state)
Qflux = [95227.9039030097 114455.563823387 135425.660711557 157617.776529485 180475.165385858 204324.157913108 227858.067584851 251003.101134129 274523.812317499 297098.522331190 318311.436782187 323176.698595420 305392.594202675 288117.647845016 271658.937742732 255993.468537760 241013.993911321 226845.242131156 213378.441610425 200585.095154491 188437.668150247 177147.477818916 166646.420735747 156884.096694863 147711.357484711 139004.597444385 130908.436836482 123221.153998762 116071.884447944 109281.539749113 102965.478517031 97026.0037629017 91382.0732628443 86131.1507489889 81139.9379314052 76495.5948022770 72125.6210873310 67969.8327658806 64101.9889457300 60422.5563374918 56997.5677066116 53773.0465608690 50745.6575110397 47878.2202413107 45199.4175544916 42709.7635677544 40322.8207583651 38091.6735598140 35978.2856042923 34002.1098024217 32164.0294207742 30398.8680203650 28747.4363759245 27181.1247724032 25715.2166145960 24350.7265689571 23038.2265010867 21809.2315365243 20642.0928786037 19548.8424532095 18530.5071956335 17549.3885688409 16629.9303816591 15755.6542995055 14946.8397416971 14172.1130778119 13434.9082288744 12752.7249114001 12094.0075420467 11476.0049848994 10899.5908825004 10342.7778317461 3328.74348477513 3219.38496346130 3114.23626002492 3013.11202639214 2915.83608415394 2824.34054634446 2734.20176589782 2647.43526872282 2563.89671847592 2483.44872235512 2405.95972759253 2329.78357712893 2257.89844537104 2188.61465351351 2123.41509503054 2058.96900831007 1996.81749207720 1936.86703622507 1879.02841577607 1823.21262445196 1769.34222544805 1718.63416818903 1668.38827988045 1619.86644765665 1573.00094220403 1527.72702702507 1483.98281172145 1441.70911316665 1400.84932411023 1362.38268797665 1324.16256838541 1287.20168310500 1251.45251496010 1216.86956432268 1183.40925404486 1151.02983930751 1120.54625852068 1090.18795693897 1060.79617220188 1032.33565135959 1004.64756800856 976.046986774630 948.301659505547 921.384760816731 895.270344622213 871.132791737868 846.516916147876 822.631569470699 799.449282698795 776.953063474315 755.121608283639 733.934305244444 713.120202691319 691.757231801032 671.529047516052 651.343130360714 631.334821148174 612.287438956765 593.781629829515 575.802817652908 558.336796914122 541.369723848541 525.313105268542 509.292108397227 493.730660351713 478.616788454776 463.630856385145 449.729501098416 435.850397703483 422.373526163925 409.287864486437 396.922732377707 384.577906342956 372.593368053278 361.271342055192 349.723440309510 338.758109791113 328.114140880535 318.061832373414 308.027444696626 298.552315011407 289.094650873518 279.711911231796 271.052604469414 262.409870755846 254.008581502692 246.064095856585 238.122419358392 230.465953880390 222.993374933540 215.956079722557 208.922252725651 202.299199530762 195.524410274280 189.110087069188 183.071693887280 177.212492223498 171.357316899228 165.544695957996 160.206359172994 155.027410415277 149.852910943569 144.984089589459 139.999329048598 135.425858247434 130.853106712067 126.547766660556 122.264026540443 118.093363102892 114.174447423600 110.374939108501 106.479264879329 102.914149659700 99.4581825289461 96.0046213490584 92.6723427048006 89.5306842740936 86.3917731115856 83.4442270631199 80.5080230399610 77.6567634375501 75.1371006159000 72.4592211499260 70.0972228130475 67.5860118062174 65.3720737294545 63.0882416810048 60.9426596807776 58.8002275852908 56.7870109878621 54.7776522709766 52.8916195319162 51.0086398301218 49.2420541126776 47.4777873911239 45.8233704581450 44.1706042849154 42.6215099665172 41.1222895708253 39.6705081620832 38.2192103887920 36.8603476033504 35.5014706459928 34.1872885931473 32.9976148169007 31.7660894227263 30.6145447128658 29.4619874301657 28.3849070739092 27.3400243362568 26.3316672875127 25.3216537579243 24.3782671913877 23.4627549563664 22.5486602212303 21.6950893529835 20.8393662018126 20.0671219886767 19.2663668451032 18.5201492304315 17.7949314414149 17.0973113163581 16.3974469986949 15.7419844339834 15.1123780538780 14.4803151176928 13.9111748832391 13.3203814979540 12.7886610632877 12.2365970285143 11.7036079650705 11.2242495824851 10.7264246494416 10.2789090702978 9.81407385435858 9.37819236709597 8.96252432871316 8.55553362922223 8.16798694315753 7.78809034174538 7.41088681176052 7.07241214729024 6.72070509251421 6.39042539305814 6.07745387930879 5.76948043790919 5.47818390206534 5.19076416082169 4.90608047766004 4.65137616263469 4.39298644970489 4.13749053890640 3.90901664119054 3.67145558815401 3.45910147854560 3.24322269261207 3.03045422888040 2.84034556561680 2.64682149610940 2.45652312505391 2.28655693436020 2.11328836825315 1.94334721639856]; % Heat source, W/m^2
end
%% The error
Error using pde.internal.pde3DBCImpl/callNeumannFuncOnFace
Each boundary condition term obtained from function "@(region,state)Qn(region,state)+htc*Tambient+emiss*SBC*(Tambient.^4-state.u.^4)" must have 1 entries.
Error in pde.internal.pde3DBCImpl/setNeumannBCOnFace (line 129)
faceG = self.callNeumannFuncOnFace(bci,xyzAllFaceNodes, sPts, bci.g, ...
Error in pde.internal.pde3DBCImpl/getBCMatrices (line 66)
[Qi, Gi] = setNeumannBCOnFace(self, bcsi);
Error in pde.EquationModel/assembleBoundary (line 74)
bcmat = bcImpl.getBCMatrices(u,time,gmat);
Error in pde.EquationModel/assembleSelectedFEMatrices (line 30)
bmat = self.assembleBoundary(u,time,gmatrix);
Error in pde.DiscretizedPDEModel/initialDiscretization (line 50)
femat0 = self.thePde.assembleSelectedFEMatrices(self.p, self.t, self.coefstruct, u0, tdummy, requiredMats, false);
Error in pde.DiscretizedPDEModel (line 33)
obj = obj.initialDiscretization(u0,tdummy);
Error in pde.DynamicDiscretizedPDEModel (line 32)
obj=obj@pde.DiscretizedPDEModel(thePde,p,e,t,coefstruct,u0,false);
Error in pde.EquationModel/solveTimeDependent (line 27)
femodel=pde.DynamicDiscretizedPDEModel(self,p,e,t,coefstruct,u0,tlist,tsecondOrder);
Error in pde.ThermalModel/solve (line 126)
u = self.solveTimeDependent(coefstruct,u0,[],tlist,false);
Error in FEA_MatLab (line 71)
result = solve(thermalmodel,tlist);
0 comentarios
Respuestas (1)
Shubham
el 13 de Oct. de 2023
I understand that while doing the transient thermal analysis on a disc, the heat flux on the outer surface changes every second.
The error being produced is related to the boundary condition for the heat flux on the outer surface of the disc. The function “externalHeatFlux” that you provided returns heat flux as an array. However, the PDE solver expects a scalar value for the heat flux for the boundary condition.
To resolve this, you can modify your “externalHeatFlux” function to return a scalar value. You can try using time values as index for obtaining the heat flux values.
You can modify your code as the following code snippet:
function Qflux = externalHeatFlux(region, state)
if isnan(state.time)
Qflux = nan(size(region.x));
return;
end
heatFluxData = [ ... ];
timeData = [ ... ]; % Time values corresponding to heat flux data
htflux = interp1(timeData, heatFluxData, tlist, 'linear', 'extrap'); %interpolate the heat flux values based on time
% return heat flux value corresponding to current time step
end
Also refer to a previous case dealing with time dependent heat flux:
Hope this helps!!
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!