Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Does TSSetFromOptions(), SNESSetFromOptions() or KSPSetFromOptions() reset all the parameters I previously set or how come my TS/SNES/KSPSetXXX() does not seem to work?

parameters reset Snes TS
0
Posted

Does TSSetFromOptions(), SNESSetFromOptions() or KSPSetFromOptions() reset all the parameters I previously set or how come my TS/SNES/KSPSetXXX() does not seem to work?

0

If XXSetFromOptions() is used (with -xxx_type aaaa) to change the type of the object then all parameters associated with the previous type are removed. Otherwise it does not reset parameters. TS/SNES/KSPSetXXX() commands that set properties for a particular type of object (such as KSPGMRESSetRestart()) ONLY work if the object is ALREADY of that type. For example, with KSPCreate(PETSC_COMM_WORLD,&ksp); KSPGMRESSetRestart(ksp,10); the restart will be ignored since the type has not yet been set to GMRES. To have those values take effect you should do one of the following XXXCreate(..,&obj); XXXSetFromOptions(obj); allow setting the type from the command line, if it is not on the command line then the default type is automatically set XXXSetYYYYY(obj,…); if the obj is the appropriate type then the operation takes place XXXSetFromOptions(obj); allow user to overwrite options hardwired in code (optional) The other approach is to replace the first XXXSetFromOptions() to XXXSetType(obj,type)

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123