Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
Time dependent alternating temperature/thermal insulation boundary conditions
Posted 15 juin 2013, 01:15 UTC−4 Interfacing, Heat Transfer & Phase Change, Results & Visualization Version 5.1 7 Replies
Please login with a confirmed email address before reporting spam
I am trying to setup alternating boundary conditions for a certain boundary based on the hours of each day. My model will run for about 2 months, and I would like to set the boundary condition such that:
- 0-6 hours: Temperature BC
- 6-24 hours: Thermal insulation BC
The boundary condition would switch from Temperature to Insulation and vice versa each day until the end of running. I am wondering if this is possible, or if there is a more practical approach.
I would be grateful if you could help me. Thanks,
--
Tolga
Please login with a confirmed email address before reporting spam
Imagine that you have tens of transient solvers each corresponding to a different time period of the problem. In COMSOL, is it possible to combine these results and get continuous data?
My solver configuration looks like:
Solver 1: range(0, 15[min], 6[h])
Solver 2: range(6[h], 15[min], 24[h])
Solver 3: range(24[h], 15[min], 30[h])
Solver 4: range(30[h], 15[min], 48[h])
....
Can I extract the data, i.e. integration of heat flux over a certain boundary for the total period (0 to 48 hours)? Right now I can only do it per solution within COMSOL. I think this is also doable by writing a script in Matlab, but I was wondering if there is a practical way to do it within COMSOL.
Thanks,
--
Tolga
Please login with a confirmed email address before reporting spam
There is a simple trick to do this. For the first day write your prescribed temperature as
if(t<6[h],T0,T)
where T0 is your prescribed temperature, and T is the name of the temperature degree of freedom. The 'if' condition has to be generalized to cover more days of course.
This reason that this works is that the constraint applied is T-T_prescribed = 0. So if we set the prescribed temperature to T itself, no constraint is generated since T-T cancels.
Now you can run all in one study, and can avoid the problems with merging results.
Regards,
Henrik
Please login with a confirmed email address before reporting spam
Thank you so much for the trick. I couldn't imagine that this would work.
I was struggling with writing code in Matlab to generate the needed study steps and extract result data. I've been successful so far, but the trick you provided will make things way easier and faster.
--
Tolga
Please login with a confirmed email address before reporting spam
I set the prescribed temperature as follows: (Works perfectly, thanks again!)
if(mod(t/3600, 24) <= 6, T0, T)
For the Matlab solution, the trick is to conditionally toggle the Temperature BC node:
model.physics('ht').feature('temp1').active(true);
model.physics('ht').feature('temp1').active(false);
and in order to extract data from the model:
% get the heat flux magnitude for current solver step
totalHeatFluxMagnitudeOfPipeInnerBoundaryForCurrentStep = mphint2(model, {'ht.tfluxMag'}, 'line', 'dataset', solutionSet, 'selection', 'sel5');
% Merge the data: Only for the first step, directly assign it to current data
totalHeatFluxMagnitudeOfPipeInnerBoundary = totalHeatFluxMagnitudeOfPipeInnerBoundaryForCurrentStep;
% Merge the data: For other steps, add current data and obtain cumulative data
totalHeatFluxMagnitudeOfPipeInnerBoundary = [totalHeatFluxMagnitudeOfPipeInnerBoundary totalHeatFluxMagnitudeOfPipeInnerBoundaryForCurrentStep];
Here solutionSet is the name of the solution set, which you will need to iterate in your loop, i.e. 'dset1', 'dset2', ...
--
Tolga
Please login with a confirmed email address before reporting spam
another way to do this is
T-T*(t<0.6[h])+T0*(t<0.6[h])
this is useful when the switch is based on randomly-changing variables (say you want to switch to insulation when temperature(x,y,z) reaches 90 [degC])
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.
