<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Jun 26, 2019, at 4:17 PM, Manuel Valera via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">Hi PETSc,<br class="">
<div class=""><br class="">
</div>
<div class="">I am trying to implement the Time stepping routines in my model, i have a working runge-kutta time scheme that goes to the following steps:</div>
<div class=""><br class="">
</div>
<div class="">
<ul class="">
<li class="">Interpolate u,v,w to the time advancing variable position.</li><li class="">Calculate nonlinear coefficients and advect velocities with a forward-backward shock capturing scheme.</li><li class="">Calculate the variable laplacian </li><li class="">Sum terms to create RHS (nonlinear advected velocities + laplacian)</li><li class="">Finally, the runge kutta integration is done in a typical way that looks like:</li></ul>
<div class=""> newtemp(t+1) = prevtemp(t) + dt*RHS</div>
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">So my questions are:</div>
<div class="">
<ul class="">
<li class="">I think my problem is nonlinear, but is being made linearized by the advecting scheme, is this correct? this is to know if i should use the linear or nonlinear routines for TS.</li></ul>
</div>
</div>
</div>
</blockquote>
<span class="">TSComputeRHSFunctionLinear is just a convenience function for linear ODEs in the form udot=Au. Using it won’t buy you much. So for TS starters, it is fine to assume your problem is nonlinear and think of the form udot=f(t,u) where f is the RHS
function. </span><span class=""><br class="">
</span>
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<ul class="">
<li class="">How do i know what are the appropriate routines i should be using here? so far i think i should use the following:</li></ul>
<div class="">call TSCreate(PETSC_COMM_WORLD,ts,ierr)<br class="">
call TSSetProblemType(ts,TS_LINEAR,ierr)<br class="">
call TSSetTimeStep(ts,dt,ierr)<br class="">
<br class="">
call TSSetFromOptions(ts,ierr)<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">call TSSetRHSFunction(ts,NULL,TSComputeRHSFunctionLinear,NULL,ierr)<br class="">
call TSSolve(ts,loctemperature,ierr)<br class="">
<br class="">
</div>
</div>
<div class="">Should i use call TSSetRHSJacobian for the temperature jacobian in this case?</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>I would suggest to write your own RHSFunction and set it to TS with TSSetRHSFunction().</div>
<div><br class="">
</div>
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class=""> </div>
<div class=""><br class="">
</div>
<div class="">I am using <a href="https://www.mcs.anl.gov/petsc/petsc-current/src/ts/examples/tutorials/ex4.c.html" class="">https://www.mcs.anl.gov/petsc/petsc-current/src/ts/examples/tutorials/ex4.c.html</a> as a general guide, is there a more appropriate
example?</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
ex4 is a good example. In addition, ex9 uses finite volume method with slope limiters to solve a variety of problems such as advection equation, burgers equation and shallow water equation. It might be an overkill, but it seems to be close to the problem you
are trying to solve. Note that you might want to use the SSP methods (-ts_type ssp) instead of the classic Runge-Kutta methods for problems with shocks.</div>
<div><br class="">
</div>
<div>Hong (Mr.)</div>
<div><br class="">
</div>
<div>
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class=""><br class="">
</div>
<div class="">The dt value and total timesteps are controlled by the model,</div>
<div class=""><br class="">
</div>
<div class="">Thanks for your help,</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</body>
</html>