Re: [deal.II] Using Sacado with example 15

2017-10-26 Thread Wolfgang Bangerth

On 10/26/2017 09:19 AM, 'Maxi Miller' via deal.II User Group wrote:

No, but including it removes the compilation errors, thanks!
How do I know for the future which includes I should use?


This one was difficult, but in general when you get a compiler error for 
a function that the compiler can't find, you have to look up where that 
function is declared. The manual pages online can help with that as they 
list the file in question for each function.


Best
 W.

--

Wolfgang Bangerth  email: bange...@colostate.edu
   www: http://www.math.colostate.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] Using Sacado with example 15

2017-10-26 Thread 'Maxi Miller' via deal.II User Group
No, but including it removes the compilation errors, thanks! 
How do I know for the future which includes I should use?

Am Donnerstag, 26. Oktober 2017 17:03:40 UTC+2 schrieb Wolfgang Bangerth:
>
> On 10/26/2017 07:27 AM, Wolfgang Bangerth wrote: 
> > 
> > This looks reasonable. The code does not compile because of this error: 
> > 
> > /opt/dealII/include/deal.II/base/template_constraints.h:388:40: error: 
> > no match for 'operator*' (operand types are 'Sacado::Fad::DFad' 
> > and 'dealii::Tensor<1, 2, double>') 
> >   typedef decltype(std::declval() * std::declval()) type; 
> >~~^~~ 
>
> By the way, did you try to include 
>#include  
> at the top of your code? 
>
> Best 
>   W. 
>
> -- 
>  
> Wolfgang Bangerth  email: bang...@colostate.edu 
>  
> www: http://www.math.colostate.edu/~bangerth/ 
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] Using Sacado with example 15

2017-10-26 Thread Wolfgang Bangerth

On 10/26/2017 07:27 AM, Wolfgang Bangerth wrote:


This looks reasonable. The code does not compile because of this error:

/opt/dealII/include/deal.II/base/template_constraints.h:388:40: error: 
no match for 'operator*' (operand types are 'Sacado::Fad::DFad' 
and 'dealii::Tensor<1, 2, double>')

  typedef decltype(std::declval() * std::declval()) type;
   ~~^~~


By the way, did you try to include
  #include 
at the top of your code?

Best
 W.

--

Wolfgang Bangerth  email: bange...@colostate.edu
   www: http://www.math.colostate.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] Using Sacado with example 15

2017-10-26 Thread Wolfgang Bangerth

On 10/26/2017 02:18 AM, 'Maxi Miller' via deal.II User Group wrote:
I added the errors I get while compiling in the log file. My code for 
producing it is:


|
std::vector>grad_N_AD(n_q_points);std::vectorlocal_dof_values_AD(cell->get_fe().dofs_per_cell);


for(unsignedinti=0;i')

 typedef decltype(std::declval() * std::declval()) type;
  ~~^~~

This should, in principle, be covered by the following operator in tensor.h:

template 
inline
Tensor::type>

operator * (const Number   ,
const Tensor )
{
  // simply forward to the operator above
  return t * factor;
}


with Number=DFad and OtherNumber=double. You need to investigate 
whether either the ProductType or EnableIfScalar is not defined for this pair 
of operands. If you can figure this out, you should be in business.


Best
 W.

--

Wolfgang Bangerth  email: bange...@colostate.edu
   www: http://www.math.colostate.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] Using Sacado with example 15

2017-10-17 Thread 'Maxi Miller' via deal.II User Group
How would I use the function get_function_gradients_from_local_dof_values 
with a vector_extractor? When trying to compile it with the vector shown 
above (including changing the first value) it fails with a rather long list 
of template errors.
Thanks!

Am Freitag, 25. August 2017 09:51:37 UTC+2 schrieb Jean-Paul Pelteret:
>
> I suspect that this can be written even more concisely with the current 
>> development version of deal.II. For example, I'm pretty sure you can 
>> write 
>>
>>std::vectorSacado::Fad::DFad> 
>>   grad_u (n_q_points); 
>>
>>fe_values.get_function_gradients (solution, grad_u); 
>>
>> or something similar in place of what you do in lines 199, 207-217. 
>>
>
> Yes, we now have the functions get_function_*_from_local_dof_values() 
> 
>  
> in the FEValuesView classes, which can definitely help in this scenario. 
> One would use them in the following way:
>
> std::vector local_dof_values(cell->get_fe().dofs_per_cell);
> cell->get_dof_values(solution, local_dof_values.begin(), local_dof_values.
> end());
> std::vector local_dof_values_AD(cell->get_fe().
> dofs_per_cell);
>
> // ... Setup local_dof_values_AD using local_dof_values, as is done in 
> step-33 ...
>
> std::vector> qp_gradients_AD (
> n_q_points_cell);
> fe_values[scalar_extractor].get_function_gradients_from_local_dof_values(
> local_dof_values_AD, qp_gradients_AD);
> // ... use qp_gradients_AD ...
>
>
> Regards,
> Jean-Paul
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] Using Sacado with example 15

2017-08-25 Thread Jean-Paul Pelteret

>
> I suspect that this can be written even more concisely with the current 
> development version of deal.II. For example, I'm pretty sure you can write 
>
>std::vectorSacado::Fad::DFad> 
>   grad_u (n_q_points); 
>
>fe_values.get_function_gradients (solution, grad_u); 
>
> or something similar in place of what you do in lines 199, 207-217. 
>

Yes, we now have the functions get_function_*_from_local_dof_values() 

 
in the FEValuesView classes, which can definitely help in this scenario. 
One would use them in the following way:

std::vector local_dof_values(cell->get_fe().dofs_per_cell);
cell->get_dof_values(solution, local_dof_values.begin(), local_dof_values.
end());
std::vector local_dof_values_AD(cell->get_fe().
dofs_per_cell);

// ... Setup local_dof_values_AD using local_dof_values, as is done in 
step-33 ...

std::vector> qp_gradients_AD (
n_q_points_cell);
fe_values[scalar_extractor].get_function_gradients_from_local_dof_values(
local_dof_values_AD, qp_gradients_AD);
// ... use qp_gradients_AD ...


Regards,
Jean-Paul

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] Using Sacado with example 15

2017-08-24 Thread 'Maxi Miller' via deal.II User Group
Concerning the constraints: I was refering to this line:

In the first case, there is nothing we need to do: we are using a 
> continuous finite element, and face terms do not appear in the bilinear 
> form in this case. The second case usually does not lead to face terms 
> either if we enforce hanging node constraints strongly (as in all previous 
> tutorial programs so far whenever we used continuous finite elements – this 
> enforcement is done by the ConstraintMatrix 
>  
> class together with DoFTools::make_hanging_node_constraints 
> ).
>  
> In the current program, however, we opt to enforce continuity weakly at 
> faces between cells of different refinement level, for two reasons: (i) 
> because we can, and more importantly (ii) because we would have to thread 
> the automatic differentiation we use to compute the elements of the Newton 
> matrix from the residual through the operations of the ConstraintMatrix 
>  
> class. This would be possible, but is not trivial, and so we choose this 
> alternative approach.
>

I will take a look at the code from Praveen, and try it, but it looks as if 
it needs some work (some includes are missing or shifted). But thank you 
very much!


Am Donnerstag, 24. August 2017 16:56:43 UTC+2 schrieb Wolfgang Bangerth:
>
>
> > I would like to get a feeling in working with Sacado, and would like to 
> try it 
> > on example 15. According to my understanding I now have to treat the 
> boundary 
> > conditions on my own, and not by using the ConstraintMatrix. Is that 
> still 
> > true, or was there an update since 2008? 
>
> I suspect that you are referencing a particular comment in step-33, but 
> it's 
> been so long that I can't recall what that program does. Can you point out 
> what you have in mind? 
>
> In general, as long as you have Dirichlet boundary conditions, they can be 
> handled by ConstraintMatrix at the time when the local matrix is 
> distributed 
> into the global matrix, and that happens after all of the Sacado magic 
> happens 
> -- you get the local matrix out of Sacado and then copy it into the global 
> matrix. 
>
>
> > Furthermore, now the function F() is depending on the gradient of u, and 
> not 
> > as in example 33 depending on u, else it should look like exactly in 
> example 
> > 33 (in both examples we have \nabla F(u)). Is that correct? Nevertheless 
> I 
> > assume that I need the numerical flux function due to having to check 
> the 
> > dangling nodes. 
>
> You can also handle hanging nodes as is always done, via ConstraintMatrix. 
> step-33 does it differently not because that is necessary but because the 
> author decided that he could. 
>
> I think that using Sacado (or in general, automatic differentiation) 
> should be 
> relatively straightforward in step-15, in particular because the residual 
> is 
> already computed there. I'd just give it a try and see what is necessary. 
> You 
> may want to use the current developer version of deal.II -- there have 
> been 
> numerous changes in recent weeks to make AD easier to use in the FEValues 
> class, in particular through functions such as 
> FEValues::get_function_{values,gradients}. 
>
> Using AD in step-15 is an interesting project. If you make it work, would 
> you 
> mind sending the assembly function to the mailing list? I think it would 
> make 
> for a great section in the "Possibilities for extensions" section of 
> step-15! 
>
> Best 
>   W. 
>
> -- 
>  
> Wolfgang Bangerth  email: bang...@colostate.edu 
>  
> www: http://www.math.colostate.edu/~bangerth/ 
>
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] Using Sacado with example 15

2017-08-24 Thread Praveen C
I did this a while back, see here

https://bitbucket.org/cpraveen/deal_ii/src/865f1c963f1089a870054bebf7180c9712e93da8/step-15-sacado/?at=master

Best
praveen

On Thu, Aug 24, 2017 at 8:26 PM, Wolfgang Bangerth 
wrote:

>
> I would like to get a feeling in working with Sacado, and would like to
>> try it on example 15. According to my understanding I now have to treat the
>> boundary conditions on my own, and not by using the ConstraintMatrix. Is
>> that still true, or was there an update since 2008?
>>
>
> I suspect that you are referencing a particular comment in step-33, but
> it's been so long that I can't recall what that program does. Can you point
> out what you have in mind?
>
> In general, as long as you have Dirichlet boundary conditions, they can be
> handled by ConstraintMatrix at the time when the local matrix is
> distributed into the global matrix, and that happens after all of the
> Sacado magic happens -- you get the local matrix out of Sacado and then
> copy it into the global matrix.
>
>
> Furthermore, now the function F() is depending on the gradient of u, and
>> not as in example 33 depending on u, else it should look like exactly in
>> example 33 (in both examples we have \nabla F(u)). Is that correct?
>> Nevertheless I assume that I need the numerical flux function due to having
>> to check the dangling nodes.
>>
>
> You can also handle hanging nodes as is always done, via ConstraintMatrix.
> step-33 does it differently not because that is necessary but because the
> author decided that he could.
>
> I think that using Sacado (or in general, automatic differentiation)
> should be relatively straightforward in step-15, in particular because the
> residual is already computed there. I'd just give it a try and see what is
> necessary. You may want to use the current developer version of deal.II --
> there have been numerous changes in recent weeks to make AD easier to use
> in the FEValues class, in particular through functions such as
> FEValues::get_function_{values,gradients}.
>
> Using AD in step-15 is an interesting project. If you make it work, would
> you mind sending the assembly function to the mailing list? I think it
> would make for a great section in the "Possibilities for extensions"
> section of step-15!
>
> Best
>  W.
>
> --
> 
> Wolfgang Bangerth  email: bange...@colostate.edu
>www: http://www.math.colostate.edu/~bangerth/
>
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see https://groups.google.com/d/fo
> rum/dealii?hl=en
> --- You received this message because you are subscribed to the Google
> Groups "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to dealii+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] Using Sacado with example 15

2017-08-24 Thread Wolfgang Bangerth


I would like to get a feeling in working with Sacado, and would like to try it 
on example 15. According to my understanding I now have to treat the boundary 
conditions on my own, and not by using the ConstraintMatrix. Is that still 
true, or was there an update since 2008?


I suspect that you are referencing a particular comment in step-33, but it's 
been so long that I can't recall what that program does. Can you point out 
what you have in mind?


In general, as long as you have Dirichlet boundary conditions, they can be 
handled by ConstraintMatrix at the time when the local matrix is distributed 
into the global matrix, and that happens after all of the Sacado magic happens 
-- you get the local matrix out of Sacado and then copy it into the global matrix.



Furthermore, now the function F() is depending on the gradient of u, and not 
as in example 33 depending on u, else it should look like exactly in example 
33 (in both examples we have \nabla F(u)). Is that correct? Nevertheless I 
assume that I need the numerical flux function due to having to check the 
dangling nodes.


You can also handle hanging nodes as is always done, via ConstraintMatrix. 
step-33 does it differently not because that is necessary but because the 
author decided that he could.


I think that using Sacado (or in general, automatic differentiation) should be 
relatively straightforward in step-15, in particular because the residual is 
already computed there. I'd just give it a try and see what is necessary. You 
may want to use the current developer version of deal.II -- there have been 
numerous changes in recent weeks to make AD easier to use in the FEValues 
class, in particular through functions such as 
FEValues::get_function_{values,gradients}.


Using AD in step-15 is an interesting project. If you make it work, would you 
mind sending the assembly function to the mailing list? I think it would make 
for a great section in the "Possibilities for extensions" section of step-15!


Best
 W.

--

Wolfgang Bangerth  email: bange...@colostate.edu
   www: http://www.math.colostate.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[deal.II] Using Sacado with example 15

2017-08-24 Thread 'Maxi Miller' via deal.II User Group
I would like to get a feeling in working with Sacado, and would like to try 
it on example 15. According to my understanding I now have to treat the 
boundary conditions on my own, and not by using the ConstraintMatrix. Is 
that still true, or was there an update since 2008?

Furthermore, now the function F() is depending on the gradient of u, and 
not as in example 33 depending on u, else it should look like exactly in 
example 33 (in both examples we have \nabla F(u)). Is that correct? 
Nevertheless I assume that I need the numerical flux function due to having 
to check the dangling nodes.

Are those assumptions correct? I would like to have the theory first before 
starting to modify/write programs...
Thanks!

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.