Just Launched: You can now import projects and releases from Google Code onto SourceForge

We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps.

libmesh-users

 [Libmesh-users] Set an Initial Guess of a Nonlinear System From: Dafang Wang - 2014-01-15 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/ ```
 Re: [Libmesh-users] Set an Initial Guess of a Nonlinear System From: Paul T. Bauman - 2014-01-16 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 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 > _______________________________________________ > Libmesh-users mailing list > Libmesh-users@... > https://lists.sourceforge.net/lists/listinfo/libmesh-users > ```
 Re: [Libmesh-users] Set an Initial Guess of a Nonlinear System From: Dafang Wang - 2014-01-16 02:44:18 ```Hi Paul, Thanks for your tips. I extracted the current_solution in the follow way, but I got an all-zero 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 all-zero 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 > 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 > _______________________________________________ > Libmesh-users mailing list > Libmesh-users@... > > https://lists.sourceforge.net/lists/listinfo/libmesh-users > > -- Dafang Wang, Ph.D Postdoctoral Fellow Institute of Computational Medicine Department of Biomedical Engineering Johns Hopkins University Hackerman Hall Room 218 Baltimore, MD, 21218 ```