Drastic Change in "y" After Call to CVNlsNewton()

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

Drastic Change in "y" After Call to CVNlsNewton()

by bowens1 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

Thank you for the assistance on the previous problem, that issue has been resolved.

I am trying to make some headway implementing sundials into my FEA code. However, at the first requested time "tout", the solution is obviously incorrect. I have implemented this algorithm in MATLAB with success, and am seeing very different trends in the C++ implementation.

The drastic change in "y" appears to occur at the RHS function call on Line 2668 of covde.c in the CVNlsNewton() function. For example, I should expect values of y around [.79 .77 .75] but instead CVode is returning something like [101.78 100.2 100.2]. Definitely, a far cry from the values I expect from my validated MATLAB code.

If needed, here are my setting and initializations. These are the same settings I am using in my MATLAB implementation that has worked.

                        t0 = 0.0;
                        //y = N_VMake_Serial(totalNumDof,u_s);
                        y = N_VNew_Serial(totalNumDof);
                        abstol = N_VNew_Serial(totalNumDof);
                        ydot = N_VNew_Serial(totalNumDof);

                        reltol = 1e-4;

                        for (int i=0;i<totalNumDof;i++)
                        {
                                NV_Ith_S(y,i) = u_s[i];
                                NV_Ith_S(abstol,i) = reltol*100.0;
                        }

                        cvode_mem = CVodeCreate(CV_BDF,CV_NEWTON);
                        flag = CVodeInit(cvode_mem,RHSfunction, t0, y);
                        flag = CVodeSVtolerances(cvode_mem, reltol, abstol);
                        flag = CVDense(cvode_mem, totalNumDof);
                        flag = CVodeSetUserData(cvode_mem,this);


Thanks,
Brian


Parent Message unknown Re: Drastic Change in "y" After Call to CVNlsNewton()

by bowens1 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have determined this was a minor problem with a pointer being set in my
RHSfunction. Sorry about the additional post. I am finally starting to work
with the N_Vector type.




bowens1 wrote:
 >
 > Hello,
 >
 > Thank you for the assistance on the previous problem, that issue has been
 > resolved.
 >
 > I am trying to make some headway implementing sundials into my FEA code.
 > However, at the first requested time "tout", the solution is obviously
 > incorrect. I have implemented this algorithm in MATLAB with success, and
 > am seeing very different trends in the C++ implementation.
 >
 > The drastic change in "y" appears to occur at the RHS function call on
 > Line 2668 of covde.c in the CVNlsNewton() function. For example, I should
 > expect values of y around [.79 .77 .75] but instead CVode is returning
 > something like [101.78 100.2 100.2]. Definitely, a far cry from the values
 > I expect from my validated MATLAB code.
 >
 > If needed, here are my setting and initializations. These are the same
 > settings I am using in my MATLAB implementation that has worked.
 >
 >                       t0 = 0.0;
 >                       //y = N_VMake_Serial(totalNumDof,u_s);
 >                       y = N_VNew_Serial(totalNumDof);
 >                       abstol = N_VNew_Serial(totalNumDof);
 >                       ydot = N_VNew_Serial(totalNumDof);
 >
 >                       reltol = 1e-4;
 >
 >                       for (int i=0;i<totalNumDof;i++)
 >                       {
 >                               NV_Ith_S(y,i) = u_s[i];
 >                               NV_Ith_S(abstol,i) = reltol*100.0;
 >                       }
 >
 >                       cvode_mem =
CVodeCreate(CV_BDF,CV_NEWTON);
 >                       flag = CVodeInit(cvode_mem,RHSfunction, t0, y);
 >                       flag = CVodeSVtolerances(cvode_mem, reltol, abstol);
 >                       flag = CVDense(cvode_mem, totalNumDof);
 >                       flag = CVodeSetUserData(cvode_mem,this);
 >
 >
 > Thanks,
 > Brian
 >
 >
 >

--
View this message in context:
http://*www.*nabble.com/Drastic-Change-in-%22y%22-After-Call-to-CVNlsNewton%28%29-tp25879547p25896419.html
Sent from the Sundials - Users mailing list archive at Nabble.com.

----------------------------------------------------------------------------------------------------------------
Center for Applied Scientific Computing
Lawrence Livermore National Laboratory
P.O. Box 808, L-561
Livermore, CA  94551

(925) 424-6013  (Office)            cswoodward@...
(925) 423-2993  (Fax)               http://people.llnl.gov/woodward6 


Re: Drastic Change in "y" After Call to CVNlsNewton()

by bowens1 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have determined this was a minor problem with a pointer being set in my RHSfunction. Sorry about the additional post. I am finally starting to work with the N_Vector type.



bowens1 wrote:
Hello,

Thank you for the assistance on the previous problem, that issue has been resolved.

I am trying to make some headway implementing sundials into my FEA code. However, at the first requested time "tout", the solution is obviously incorrect. I have implemented this algorithm in MATLAB with success, and am seeing very different trends in the C++ implementation.

The drastic change in "y" appears to occur at the RHS function call on Line 2668 of covde.c in the CVNlsNewton() function. For example, I should expect values of y around [.79 .77 .75] but instead CVode is returning something like [101.78 100.2 100.2]. Definitely, a far cry from the values I expect from my validated MATLAB code.

If needed, here are my setting and initializations. These are the same settings I am using in my MATLAB implementation that has worked.

                        t0 = 0.0;
                        //y = N_VMake_Serial(totalNumDof,u_s);
                        y = N_VNew_Serial(totalNumDof);
                        abstol = N_VNew_Serial(totalNumDof);
                        ydot = N_VNew_Serial(totalNumDof);

                        reltol = 1e-4;

                        for (int i=0;i<totalNumDof;i++)
                        {
                                NV_Ith_S(y,i) = u_s[i];
                                NV_Ith_S(abstol,i) = reltol*100.0;
                        }

                        cvode_mem = CVodeCreate(CV_BDF,CV_NEWTON);
                        flag = CVodeInit(cvode_mem,RHSfunction, t0, y);
                        flag = CVodeSVtolerances(cvode_mem, reltol, abstol);
                        flag = CVDense(cvode_mem, totalNumDof);
                        flag = CVodeSetUserData(cvode_mem,this);


Thanks,
Brian