<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic passing additional parameters to RHS function of ODE solver in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/passing-additional-parameters-to-RHS-function-of-ODE-solver/m-p/1045530#M20935</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to use the Intel's ODE solver to solver a system of equations. Below is the how the RHS function is supposed to be defined (from manual):&lt;/P&gt;

&lt;P&gt;subroutine &amp;lt;name&amp;gt;(n, t, y, f)&lt;BR /&gt;
	integer n&lt;BR /&gt;
	double precision t, y(n), f(n)&lt;BR /&gt;
	..................&lt;BR /&gt;
	f(i) = .....&lt;BR /&gt;
	..................&lt;BR /&gt;
	return&lt;BR /&gt;
	end&lt;/P&gt;

&lt;P&gt;The problem is I need to pass additional parameters to the RHS function. Is there a way to do that?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;

&lt;P&gt;Bo&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Nov 2014 05:07:11 GMT</pubDate>
    <dc:creator>Bo_Q_</dc:creator>
    <dc:date>2014-11-04T05:07:11Z</dc:date>
    <item>
      <title>passing additional parameters to RHS function of ODE solver</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/passing-additional-parameters-to-RHS-function-of-ODE-solver/m-p/1045530#M20935</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to use the Intel's ODE solver to solver a system of equations. Below is the how the RHS function is supposed to be defined (from manual):&lt;/P&gt;

&lt;P&gt;subroutine &amp;lt;name&amp;gt;(n, t, y, f)&lt;BR /&gt;
	integer n&lt;BR /&gt;
	double precision t, y(n), f(n)&lt;BR /&gt;
	..................&lt;BR /&gt;
	f(i) = .....&lt;BR /&gt;
	..................&lt;BR /&gt;
	return&lt;BR /&gt;
	end&lt;/P&gt;

&lt;P&gt;The problem is I need to pass additional parameters to the RHS function. Is there a way to do that?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;

&lt;P&gt;Bo&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2014 05:07:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/passing-additional-parameters-to-RHS-function-of-ODE-solver/m-p/1045530#M20935</guid>
      <dc:creator>Bo_Q_</dc:creator>
      <dc:date>2014-11-04T05:07:11Z</dc:date>
    </item>
    <item>
      <title>Declare the additional</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/passing-additional-parameters-to-RHS-function-of-ODE-solver/m-p/1045531#M20936</link>
      <description>&lt;P&gt;Declare the additional parameters and variables in a module. USE that module in the main program, and read/assign values to the module variables as needed. In the subroutine that implements the specific ODE, USE the module and access the variables as needed.&lt;/P&gt;

&lt;P&gt;For example, you can modify the van der Pol example that is included with the Intel ODE solver to take a parameter K in place of 1.0d6 in the equation:&amp;nbsp;y” - K * [ ( 1 - y*y ) * y’ + K * y = 0. Then, the module contains:&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; MODULE PARS_MOD&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;double precision :: K&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; END MODULE&lt;/P&gt;

&lt;P&gt;Add "USE PARS_MOD" to all subprograms that need to set/get the value of K.&lt;/P&gt;

&lt;P&gt;In the main program, you can do:&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; WRITE(*,'(A)',advance='no')' Enter K : '&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; READ (*,*) K&lt;/P&gt;

&lt;P&gt;In subroutine rhs_v_d_p, change to&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;f(2)=K*((1.d0-y(1)*y(1))*y(2)-y(1))&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;and, in subroutine jacmat_v_d_p, change to&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;a(2,1)=-K*(1.d0+2.d0*y(1)*y(2))&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;a(2,2)= K*(1.d0-y(1)* y(1))&lt;/P&gt;

&lt;P&gt;You will probably need to deactivate all the result checks, since they use pre-computed results that are correct only for the specific case K = 1.0d6.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2014 17:18:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/passing-additional-parameters-to-RHS-function-of-ODE-solver/m-p/1045531#M20936</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2014-11-04T17:18:00Z</dc:date>
    </item>
  </channel>
</rss>

