sundials icon indicating copy to clipboard operation
sundials copied to clipboard

Need of clarification about CVodeQuadSensInit

Open mottelet opened this issue 2 years ago • 5 comments

Hello, In the documentation of cvodes about CVodeQuadSensInit (5.4.1), it is said that If rhsQS is input as NULL, then cvodes uses an internal function that computes difference quotient approximations to the functions \bar q_i = q_ys_i+q{p_i}..._ But in the workflow of steps 1..24 there is nothing to define the integrand q itself. From what it is said above, I may understand that when rhsQS =NULL the quadrature variable is implicitely defined as the derivative w.r.t. parameter p of the "regular" quadrature variable not depending on sensitivity (is it the case ?). However, I still do not understand where to define the integrand rhs when rhsQS =NULL. Maybe CVodeQuadInit has to be called, but it is mentionned nowhere in the doc.

Thanks for your explanations !

mottelet avatar Mar 30 '22 12:03 mottelet

Yes, CVodeQuadInit should be called. See Step 16 in the usage skeleton:

  1. Initialize quadrature problem or problems for forward problems, using CVodeQuadInit and/or CVodeQuadSensInit.

balos1 avatar Mar 30 '22 16:03 balos1

Thanks, then is my affirmation

when rhsQS =NULL the quadrature variable is implicitely defined as the derivative w.r.t. parameter p of the "regular" quadrature variable not depending on sensitivity (hence defined by CVodeQuadInit)

also true ?

mottelet avatar Mar 30 '22 16:03 mottelet

Yes, that is right (see 5.2.6.4).

balos1 avatar Mar 30 '22 16:03 balos1

OK I have read 5.2.6.4 already. However, I do not want to start a dialectic discussion (not being a native english speaker), but it seemed (to me) the only possible explanation, altghouh the sentence about the nullity of rhsQS does not clearly stated it.

mottelet avatar Mar 30 '22 16:03 mottelet

However, I still do not understand where to define the integrand rhs when rhsQS =NULL. Maybe CVodeQuadInit has to be called, but it is mentionned nowhere in the doc.

Yes, CVodeQuadInit must be called to provide the quadrature function. See step 16 in the user skeleton. We will update the the skeleton and add a note to the documentation for CVodeQuadSensInit to make this requirement clearer.

gardner48 avatar Mar 30 '22 17:03 gardner48

This was fixed at some point. See https://sundials.readthedocs.io/en/latest/cvodes/Usage/FSA.html#c.CVodeQuadSensInit.

balos1 avatar Mar 22 '23 17:03 balos1

Thanks !

mottelet avatar Mar 22 '23 17:03 mottelet