<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:3.0cm 2.0cm 3.0cm 2.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DA" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi everyone<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">I did a calculation some time ago on system with a heating element and a thermostat. When the temperature at a probe point exceeds, say, 100 C it shuts off, and switches on at 80 C. I didn’t find an easy way to code this
in getdp. So I calculated the on/off times by usual postprocessings, hardcoded the on/off times, and restarted the calculations. This is somewhat slow and clearly very crude and awkward.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Is there everyone who knows a good solution to this problem? I have included some code/pseudo code below. A solution would be useful also for other problems such as HP refinement or time loops with adaptive time stepping.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">KR Lars Rindorf<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Here is the code:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Resolution <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">{<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> { Name res_temp;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> System<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> {<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> { Name B; NameOfFormulation form_temp; }<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Operation {<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> InitSolution B ; SaveSolution B ; GenerateSeparate B ;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> TimeLoopTheta {<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Time0 t0 ; TimeMax t1 ; DTime dt ; Theta .5 ;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Operation {
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Update[B, power []] ; // The function should be updated depending on the
result of some post processing <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Solve B ;
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> SaveSolution B;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> // temperature at some point of system B:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> PostOperation[po_Temp_at_probe]; // (This is ok with getdp)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> // Pseudo code<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Tprobe = temperature at some point of system B;
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> If ( Tprobe > 100 C )<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Switch off power;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> If ( Tprobe < 80 C )<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Switch on power;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> }
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> }
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#5C5A52;mso-fareast-language:DA">__________________________________<o:p></o:p></span></b></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#595959;mso-fareast-language:DA">Lars Rindorf</span></b><span lang="EN-US" style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:#595959;mso-fareast-language:DA">
<br>
</span><span lang="EN-US" style="font-size:8.0pt;font-family:"Verdana","sans-serif";color:#595959;mso-fareast-language:DA">Senior Consultant, Ph.D.<br>
Center for Microtechnology and Surface Analysis, 6H <br>
Danish Technological Institute<br>
Gregersensvej, 2630 Taastrup, Denmark<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><span lang="EN-US" style="font-size:8.0pt;font-family:"Verdana","sans-serif";color:#595959;mso-fareast-language:DA">Phone +45 72 20 33 67
<br>
Board +45 72 20 20 00 <br>
Fax +45 72 20 33 07 </span><span lang="EN-US" style="font-size:8.0pt;font-family:"Verdana","sans-serif";color:#00B0F0;mso-fareast-language:DA"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><span style="font-size:8.0pt;font-family:"Verdana","sans-serif";color:#00B0F0;mso-fareast-language:DA"><a href="http://www.dti.dk/specialists/23601"><span lang="EN-US" style="color:blue">http://www.dti.dk/specialists/23601</span></a></span><span lang="EN-US" style="font-size:8.0pt;font-family:"Verdana","sans-serif";color:#00B0F0;mso-fareast-language:DA">
(English)<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><span style="font-size:8.0pt;font-family:"Verdana","sans-serif";color:#00B0F0;mso-fareast-language:DA"><a href="http://www.teknologisk.dk/specialister/22767"><span style="color:blue">http://www.teknologisk.dk/specialister/22767</span></a>
(Dansk)<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#5C5A52;mso-fareast-language:DA">__________________________________<o:p></o:p></span></b></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA">The contents of this e-mail are only for the confidential use of the intended addressees. If you are not such an addressee,
or have reason to believe your address should not have been included, you are hereby notified that you have received this communication in error and that copying it, or in any way disseminating its contents to any other person, is strictly prohibited. If you
have received this e-mail in error, please telephone or e-mail the sender immediately and destroy this copy.</span><span lang="EN-US" style="color:#1F497D;mso-fareast-language:DA"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
</body>
</html>