From: Dafang Wang <dafang.wang@jh...>  20140115 00:03:33

Hi folks, Does anyone know how to set the initial guess solution of a nonlinear system from a known vector? My code is in the following manner: NonlinearImplicitSystem system. Vector v1 = system.current_solution(); //Step1 system.solve(); if the nonlinear solve diverges Reset system.current_solution by using v1; //Step 2 end I am not sure how to implement steps #1 and #2. My situation is: if the nonlinear solve fails to converge, the partial solution will be a bad starting point for me to solve the system again, because the system is unstable. As such, I would like to book keep the last good solution before doing a solve and, if the solve fails, I will be able to reset the system. Any suggestions will be greatly appreciated. Cheers, Dafang  Dafang Wang, Ph.D. Postdoctoral Fellow Institute of Computational Medicine Hackerman Hall, Room 218 Johns Hopkins University, Baltimore, 21218 http://lagniappe.icm.jhu.edu/~dwang/ 
From: Paul T. Bauman <ptbauman@gm...>  20140116 02:20:29

I've done something similar to this. You'll need to catch the error the solver throws (ConvergenceFailure, I think, double check), then reset the solution to your cached, good solution. This can be done by grabbing the solution vector from the system. Don't forget to close() the solution vector once you're done reseting. HTH, Paul On Tue, Jan 14, 2014 at 7:03 PM, Dafang Wang <dafang.wang@...> wrote: > Hi folks, > > Does anyone know how to set the initial guess solution of a nonlinear > system from a known vector? My code is in the following manner: > > NonlinearImplicitSystem system. > Vector v1 = system.current_solution(); //Step1 > system.solve(); > if the nonlinear solve diverges > Reset system.current_solution by using v1; //Step 2 > end > > I am not sure how to implement steps #1 and #2. > > My situation is: if the nonlinear solve fails to converge, the partial > solution will be a bad starting point for me to solve the system again, > because the system is unstable. As such, I would like to book keep the last > good solution before doing a solve and, if the solve fails, I will be able > to reset the system. > > Any suggestions will be greatly appreciated. > > Cheers, > Dafang >  > Dafang Wang, Ph.D. > Postdoctoral Fellow > Institute of Computational Medicine > Hackerman Hall, Room 218 > Johns Hopkins University, Baltimore, 21218 > http://lagniappe.icm.jhu.edu/~dwang/ > > >  > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > _______________________________________________ > Libmeshusers mailing list > Libmeshusers@... > https://lists.sourceforge.net/lists/listinfo/libmeshusers > 
From: Dafang Wang <dafang.wang@jh...>  20140116 02:44:18

Hi Paul, Thanks for your tips. I extracted the current_solution in the follow way, but I got an allzero result when running with multiple processors. Only the single processor yielded the right result. Do I miss something? NonlinearSystem system; PetscVector v; v.init( *(system.current_local_solution) ); v = *(system.current_local_solution); v.close(); v.print_global(ofstream); //I want to output the values of the entire vector globally I verified that the vector v was closed. But print_global() still generated an allzero vector. Thanks, Dafang On 01/15/2014 09:20 PM, Paul T. Bauman wrote: > I've done something similar to this. You'll need to catch the error > the solver throws (ConvergenceFailure, I think, double check), then > reset the solution to your cached, good solution. This can be done by > grabbing the solution vector from the system. Don't forget to close() > the solution vector once you're done reseting. > > HTH, > > Paul > > > On Tue, Jan 14, 2014 at 7:03 PM, Dafang Wang <dafang.wang@... > <mailto:dafang.wang@...>> wrote: > > Hi folks, > > Does anyone know how to set the initial guess solution of a > nonlinear system from a known vector? My code is in the following > manner: > > NonlinearImplicitSystem system. > Vector v1 = system.current_solution(); //Step1 > system.solve(); > if the nonlinear solve diverges > Reset system.current_solution by using v1; //Step 2 > end > > I am not sure how to implement steps #1 and #2. > > My situation is: if the nonlinear solve fails to converge, the > partial solution will be a bad starting point for me to solve the > system again, because the system is unstable. As such, I would > like to book keep the last good solution before doing a solve and, > if the solve fails, I will be able to reset the system. > > Any suggestions will be greatly appreciated. > > Cheers, > Dafang >  > Dafang Wang, Ph.D. > Postdoctoral Fellow > Institute of Computational Medicine > Hackerman Hall, Room 218 > Johns Hopkins University, Baltimore, 21218 > http://lagniappe.icm.jhu.edu/~dwang/ > <http://lagniappe.icm.jhu.edu/%7Edwang/>; > >  > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > _______________________________________________ > Libmeshusers mailing list > Libmeshusers@... > <mailto:Libmeshusers@...> > https://lists.sourceforge.net/lists/listinfo/libmeshusers > >  Dafang Wang, Ph.D Postdoctoral Fellow Institute of Computational Medicine Department of Biomedical Engineering Johns Hopkins University Hackerman Hall Room 218 Baltimore, MD, 21218 