[Trilinos-Users] evalModel, dfdp with several parameters

Bartlett, Roscoe A rabartl at sandia.gov
Thu May 27 10:22:04 MDT 2010


Nico,

> -----Original Message-----
> From: trilinos-users-bounces at software.sandia.gov [mailto:trilinos-
> users-bounces at software.sandia.gov] On Behalf Of Nico Schlömer
> Sent: Thursday, May 27, 2010 4:07 AM
> To: trilinos-users at software.sandia.gov
> Subject: [Trilinos-Users] evalModel, dfdp with several parameters
> 
> Hi all,
> 
> I'm playing around with that model evaluator here, and one thing about
> parameters is not quite clear to me.
> Suppose the model has 2 parameters, announced by
> 
> createInArgs() const
> {
>   [...]
>   inArgs.set_Np( 2 );
>   [...]
> }
> 
> and
> 
> createOutArgs() const
> {
>   [...]
>   outArgs.set_Np_Ng( 2, 0 );
>   outArgs.setSupports( OUT_ARG_DfDp, 0,
> DerivativeSupport(DERIV_MV_BY_COL) );
>   [...]
> }
> 
> (why are two declarations necessary?).

[Bartlett, Roscoe A] 

You have to tell the outArgs object how many sets of parameter and response vectors there are.  You also have to inform the outArgs specifically what derivatives are supported.

> Now, in evalModel I usually check if
> 
>    Teuchos::RCP<Epetra_MultiVector> dfdp_out =
> outArgs.get_DfDp(0).getMultiVector();
> 
> is non-null, and then try to fill it. I noticed that whenever dfdp_out
> is not null, then the multi-vector would always just contain one
> vector,
> corresponding to one of the parameters I suppose. I ran the code
> through
> several situations where I would expect the model to need dfdp0 and
> dfdfp1, but I can't seem to figure out how the ModelEvaluator tells me
> about which one it needs.

[Bartlett, Roscoe A] 

If you want support for both dfdp0 and dfdp1, you have set that up in:

createOutArgs() const
{
  ...  
  outArgs.set_Np_Ng( 2, 0 );
  outArgs.setSupports( OUT_ARG_DfDp, 0, DerivativeSupport(DERIV_MV_BY_COL) );
  outArgs.setSupports( OUT_ARG_DfDp, 1, DerivativeSupport(DERIV_MV_BY_COL) );
  ...
}


You then get at these with:

   RCP<Epetra_MultiVector> dfdp0_out = outArgs.get_DfDp(0).getMultiVector();  
   RCP<Epetra_MultiVector> dfdp1_out = outArgs.get_DfDp(1).getMultiVector();  

> Maybe I'm missing something in the setup of the {in,out}Args? I tried
> to
> copy-and-paste this kind of stuff as much as possible from test cases
> and examples as I couldn't find documentation on setting and working
> with the args.

[Bartlett, Roscoe A] 

The real documentation in for the Thyra::ModelEvalutor (check doxygen).

- Ross




More information about the Trilinos-Users mailing list