- Define Initial Temperatures: Create a function or an array to specify the initial temperature for each node.
- Modify Initial Conditions: Use the 'InitialConditions' property of the model to apply these temperatures.
- Solve the Model: Use the 'solve' function to perform the analysis.
Apply individual temperatures to nodes as initial conditions for thermal transient analysis
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Using the unified modelling workflow i want to be ale to specify the starting temperature of each node in the model.
The domain specific workflow has thermalIC which allows this to be done - is there something equivalent i can use in the unified workflow?
% GEOMETRY
radius = 10e-6;
% MESH
SeedSize = 0.0000005;
EdgeSeed = {1,SeedSize,2,SeedSize,3,SeedSize};
R1 = [3;4
0;radius;radius;0
0;0;radius;radius];
C1 = [1;0;0;radius];
C1 = [C1;zeros(length(R1) - length(C1),1)];
gd = [R1,C1];
ns = char('R1','C1');
ns = ns';
sf = 'R1 * C1';
% components, equation, labels
g = decsg(gd,sf,ns);
model = femodel(AnalysisType="thermalTransient", ...
Geometry=g);
model.MaterialProperties = ...
materialProperties(ThermalConductivity=0.2, ...
MassDensity=1160, ...
SpecificHeat=1200);
model.EdgeLoad(1) = edgeLoad(Heat=0);
model.EdgeLoad(2) = edgeLoad(Heat=0);
model.EdgeBC(3) = edgeBC(Temperature=240);
model.FaceIC = faceIC(Temperature=20); %<-- Change this to apply temps to each node
model = generateMesh(model,'GeometricOrder','quadratic',...
'Hedge',EdgeSeed,'Hmax',SeedSize);
R = solve(model, tlist);
pdeplot(R.Mesh, XYData=R.Temperature(:,end), ColorMap="hot");
axis square
0 Kommentare
Antworten (1)
Ruchika Parag
am 29 Nov. 2024
Hi @matjam, in the unified modeling workflow, you can specify the initial temperature for each node using a custom initial condition function. The 'thermalIC' function in the domain-specific workflow allows you to set initial conditions, but in the unified workflow, you can achieve similar functionality by directly manipulating the node temperatures.
Here’s how you can apply individual temperatures to nodes as initial conditions in a thermal transient analysis:
Below is an example of how you might implement this in your script:
% GEOMETRY
radius = 10e-6;
% MESH
SeedSize = 0.0000005;
EdgeSeed = {1, SeedSize, 2, SeedSize, 3, SeedSize};
R1 = [3; 4; 0; radius; radius; 0; 0; 0; radius; radius];
C1 = [1; 0; 0; radius];
C1 = [C1; zeros(length(R1) - length(C1), 1)];
gd = [R1, C1];
ns = char('R1', 'C1');
ns = ns';
sf = 'R1 * C1';
% Components, equation, labels
g = decsg(gd, sf, ns);
model = femodel(AnalysisType="thermalTransient", Geometry=g);
model.MaterialProperties = materialProperties(ThermalConductivity=0.2, MassDensity=1160, SpecificHeat=1200);
model.EdgeLoad(1) = edgeLoad(Heat=0);
model.EdgeLoad(2) = edgeLoad(Heat=0);
model.EdgeBC(3) = edgeBC(Temperature=240);
% Define a function for initial temperatures
function T0 = initialTemperatureFcn(location)
% Example: Set initial temperature based on node location
% You can customize this based on your needs
T0 = 20 + 10 * location.x; % Example: Linear gradient
end
% Apply initial conditions to each node
model.InitialConditions = initialConditions(Temperature=@initialTemperatureFcn);
% Generate mesh
model = generateMesh(model, 'GeometricOrder', 'quadratic', 'Hedge', EdgeSeed, 'Hmax', SeedSize);
% Define the time list for the transient analysis
tlist = linspace(0, 100, 50); % Example time vector, adjust as needed
% Solve the model
R = solve(model, tlist);
% Plot results
pdeplot(R.Mesh, XYData=R.Temperature(:, end), ColorMap="hot");
axis square;
Hope this helps you specify individual initial temperatures for each node in a thermal transient analysis using the unified modeling workflow!
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!