<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr">
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<br>
</p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
Yes -- you will want a smooth forcing in space - unless the jump occurs at an element boundary.</p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<br>
</p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
If the forcing has a jump discontinuity across element boundaries it's usually easier to set a flag in (say) usrdat2() that identifies which elements are to have the source term and which are not. Then add something like the following to userq:</p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<br>
</p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
common /myflag/ qflag(lx1,ly1,lz1,lelt)</p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
integer qflag,e</p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<br>
</p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
qvol=0</p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
e=gllel(ieg)</p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
if (qflag(ix,iy,iz,e).eq.1) qvol=<span style="font-size: 13px;">ampli*sin(2.0*pi*frec*time) ! pi defined by nek</span></p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<span style="font-size: 13px;"><br>
</span></p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<span style="font-size: 13px;"> etc.</span></p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<span style="font-size: 13px;"><br>
</span></p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<span style="font-size: 13px;">In usrdat2(), use something like</span></p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<span style="font-size: 13px;"><br>
</span></p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
common /myflag/ qflag(lx1,ly1,lz1,lelt)</p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
integer qflag,e</p>
<div style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<br>
</div>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<span style="font-size: 13px;"> integer e</span></p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<span style="font-size: 13px;"> n = lx1*ly1*lz1*nelt</span></p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<span style="font-size: 13px;"> nxyz=lx1*ly1*lz1</span></p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<span style="font-size: 13px;"><br>
</span></p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<span style="font-size: 13px;"> call izero(qflag,n)</span></p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<span style="font-size: 13px;"> do e=1,nelt</span></p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<span style="font-size: 13px;"> xtest = xm1(2,2,1,e)</span></p>
<p style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<span style="font-size: 13px;"> ytest = ym1(2,2,1,e)</span></p>
<p><font size="2"> if ..... xtest and ytest in your bounds .... call ione(qtest(1,1,1,e),nxyz)</font></p>
<p><font size="2"> enddo</font></p>
<p><font size="2"><br>
</font></p>
<p><font size="2">hth,</font></p>
<p><font size="2">Paul</font></p>
<p><font size="2"><br>
</font></p>
<br>
<div style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 12pt;">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Nek5000-users <nek5000-users-bounces@lists.mcs.anl.gov> on behalf of nek5000-users@lists.mcs.anl.gov <nek5000-users@lists.mcs.anl.gov><br>
<b>Sent:</b> Friday, November 24, 2017 3:20 AM<br>
<b>To:</b> nek5000-users@lists.mcs.anl.gov<br>
<b>Subject:</b> Re: [Nek5000-users] Energy source term</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:10pt;">
<div class="PlainText">Hi,<br>
The lines appear fine, however I would not use a force that goes from <br>
zero to the final value within on grid point; this might lead to <br>
oscillations in the solution. Perhaps a smoothing might be a better <br>
solution.<br>
<br>
Philipp<br>
<br>
On 2017-11-24 05:07, nek5000-users@lists.mcs.anl.gov wrote:<br>
> Hi all,<br>
> <br>
> If I need to add an oscillating source term in the energy equation for a <br>
> small region in a 2D domain would it be fine to do it this way, with <br>
> these variables: ?<br>
> <br>
> c =============================<br>
> subroutine userq (ix,iy,iz,ieg)<br>
> include 'SIZE'<br>
> include 'TOTAL'<br>
> include 'NEKUSE'<br>
> <br>
> <br>
> real pii,frec,ampli<br>
> <br>
> pii=4.0*atan(1.0)<br>
> frec=0.005<br>
> ampli=1.0<br>
> <br>
> <br>
> if (x .ge. 0 .and. x .le. 0.02 .and.<br>
> $ y .ge. 0 .and. y .le. 0.02) then<br>
> <br>
> qvol = ampli*sin(2.0*pii*frec*time)<br>
> <br>
> else<br>
> <br>
> qvol = 0.0<br>
> <br>
> end if<br>
> <br>
> <br>
> source = 0.0<br>
> <br>
> return<br>
> end<br>
> c ==================================<br>
> <br>
> <br>
> Thanks in advance,<br>
> <br>
> JP.<br>
> <br>
> <br>
> _______________________________________________<br>
> Nek5000-users mailing list<br>
> Nek5000-users@lists.mcs.anl.gov<br>
> <a href="https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users" id="LPlnk15020" previewremoved="true">
https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users</a><br>
> <br>
_______________________________________________<br>
Nek5000-users mailing list<br>
Nek5000-users@lists.mcs.anl.gov<br>
<a href="https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users" id="LPlnk838699" previewremoved="true">https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users</a><br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>