Printing y's at specified t

View: New views
2 Messages — Rating Filter:   Alert me  

Printing y's at specified t

by by way of Carol Woodward <cswoodward@llnl.gov> :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Date: Mon, 7 Sep 2009 21:28:14 -0700 (PDT)
From: Gregory Mason <gregbrickmason@...>
Subject: Printing y's at specified t
To: sundials-users@...
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="0-489347937-1252384094=:7461"

--0-489347937-1252384094=:7461
Content-Type: text/plain; charset=us-ascii

Hello:
Two Questions
==========
1)    I am running CVode in normal step mode. If the time steps at
which I call CVode(.....) is the time at which I need to print the
values of solver variables Y, can I just print Ys (using NV_Ith())
after the CVode() calls. Or do i need to specifically use CVodeDky()
function to derive the value of Y at a specifie time step.
2)   If I want to print the Fluxes that are being calculated in f.c
at specified time steps, what is the most standard way to print it.
If I print Flux value that gets calculated in f.c after CVode() call,
then the value printed is one that is calculated at the last
evaluation of f.c rather than for Y's that are the obtained solution
at a specified time t (I presume so!). What I generally do is to
always use the solved (obtained) variables.....and then calculate the
fluxes again (using these variables) in a print function. If there is
a better way to do this, please let me know.

ciao
Greg




--0-489347937-1252384094=:7461
Content-Type: text/html; charset=us-ascii

Hello:
Two Questions
==========
1)    I am running CVode in normal step mode. If the time steps at
which I call CVode(.....) is the time at which I need to print the
values of solver variables Y, can I just print Ys (using NV_Ith())
after the CVode() calls. Or do i need to specifically use CVodeDky()
function to derive the value of Y at a specifie time step.
2)   If I want to print the Fluxes that are being calculated in f.c
at specified time steps, what is the most standard way to print it.
If I print Flux value that gets calculated in f.c after CVode() call,
then the value printed is one that is calculated at the last
evaluation of f.c rather than for Y's that are the obtained solution
at a specified time t (I presume so!). What I generally do is to
always use the solved (obtained) variables.....and then calculate the
fluxes again (using these variables) in a print function. If there is
a better way to do this, please let me know.

ciao
Greg

--0-489347937-1252384094=:7461--


Parent Message unknown Re: Printing y's at specified t

by by way of Carol Woodward <cswoodward@llnl.gov> :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Date: Wed, 9 Sep 2009 13:53:42 -0700 (PDT)
From: Alan Hindmarsh <alanh@...>
To: Gregory Mason <gregbrickmason@...>, sundials-users@...
cc: alanh@...
Subject: Re: Printing y's at specified t
In-Reply-To: <806j7o$1k3qph@...>
Message-ID: <Pine.LNX.4.58.0909091351510.9804@...>
References: <806j7o$1k3qph@...>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII



 >Date: Mon, 7 Sep 2009 21:28:14 -0700 (PDT)
 >From: Gregory Mason <gregbrickmason@...>
 >Subject: Printing y's at specified t
 >To: sundials-users@...
 >
 >Hello:
 >
 >Two Questions
 >
 >1)    I am running CVode in normal step mode. If the time steps at
 >which I call CVode(.....) is the time at which I need to print the
 >values of solver variables Y, can I just print Ys (using NV_Ith())
 >after the CVode() calls. Or do i need to specifically use CVodeDky()
 >function to derive the value of Y at a specifie time step.
 >
 >2)   If I want to print the Fluxes that are being calculated in f.c
 >at specified time steps, what is the most standard way to print it.
 >If I print Flux value that gets calculated in f.c after CVode() call,
 >then the value printed is one that is calculated at the last
 >evaluation of f.c rather than for Y's that are the obtained solution
 >at a specified time t (I presume so!). What I generally do is to
 >always use the solved (obtained) variables.....and then calculate the
 >fluxes again (using these variables) in a print function. If there is
 >a better way to do this, please let me know.
 >
 >ciao
 >Greg

Hi Greg-

1) Yes you can just print the y values that are returned by the call
to CVode.  They correspond to t=tout unless there was an error return.
Use CVodeGetDky only if you want y at other t values, or you want
derivatives of y.

2) You are correct.  Any derived quantities depending on y need to be
computed by your calling program after a return from CVode.  The values
that were last computed in the RHS routine f correspond to a different
t and to a value of y(t) that was not yet converged for the last step.

-Alan H