Re: [deal.II] Question about fe_value.divergence

2020-09-03 Thread Wolfgang Bangerth

On 9/3/20 4:50 PM, yuesu jin wrote:
   I read the step.20 again. It solves my question. I didn't understand what 
the non-primitive element talks about, now I know the necessity of that. Thank 
you!


Glad to hear!
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/e3574f42-2793-3f0e-e965-c2eac05ad244%40colostate.edu.


Re: [deal.II] Question about fe_value.divergence

2020-09-03 Thread yuesu jin
Dear Dr. Bangerth,
  I read the step.20 again. It solves my question. I didn't understand what
the non-primitive element talks about, now I know the necessity of that.
Thank you!
Best regards,
Yuesu


On Thu, Sep 3, 2020 at 5:38 PM yuesu jin  wrote:

> Dear Dr. Bangerth,
>   Thank you very much! I was confused about the shape function in the
> vector case.
>   In step.8 we use the FEValue::shape_grad(index of shape function,index
> of quadrature point) and get a vector as the gradient of shape function.
> However, in step.20 and step.22, when we take the gradient of 
> FESystem[vector_indices]::gradient(index
> of shape function, index of quadrature point) we get a rank-2 tensor. If
> the shape function is a vector, FEValue::shape_grad(index of shape
> function,index of quadrature point) should give a tensor as well. Does it
> mean that the shape_grad gives the gradient of the non-zero component in
> the vector shape function such that it is a vector?
>   Thank you again!
> Best regards,
>
> On Thu, Sep 3, 2020 at 3:11 PM Wolfgang Bangerth 
> wrote:
>
>> On 9/3/20 1:28 PM, yuesu jin wrote:
>> >I am working on vector value finite element modeling. I read the
>> pages
>> >
>> https://www.dealii.org/current/doxygen/deal.II/group__vector__valued.html
>> > <
>> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.dealii.org%2Fcurrent%2Fdoxygen%2Fdeal.II%2Fgroup__vector__valued.html&data=02%7C01%7CWolfgang.Bangerth%40colostate.edu%7Cb30f39009c8c49c8fc8108d8503f8631%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637347581059635256&sdata=w%2BABjRZ1fzUdFfCQvw49JwLF7Inl3iEG4XR78VwlgoA%3D&reserved=0>
>>  which
>>
>> > uses the fe_values.divergence and fe_value.grad, but I cannot find
>> these two
>> > member functions in the FEValues\FESystem\FEValueBase categories. Could
>> you
>> > give me the documentation page about these two functions?
>>
>> These functions only exist in FEValuesViews::Vector and
>> FEValuesViews::Tensor.
>> You get that if you have something like
>>
>>FEValuesExtractors::Vector velocities(0);
>>fe_values[velocities].divergence (...);
>>
>> step-22 shows how this works in practice.
>>
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/dealii/79b2e60e-86e5-b310-9b28-c5c96c3eb364%40colostate.edu
>> .
>>
>
>
> --
> Yuesu Jin,
> Ph.D student,
> University of Houston,
> College of Natural Sciences and Mathematics,
> Department of Earth and Atmospheric Sciences,
> Houston, Texas 77204-5008
> 346-404-2062
>
>

-- 
Yuesu Jin,
Ph.D student,
University of Houston,
College of Natural Sciences and Mathematics,
Department of Earth and Atmospheric Sciences,
Houston, Texas 77204-5008
346-404-2062

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CA%2B25a%3DKq%3Dxw4rd3TcN-kcrLm-9jFe3tYMt3Qq2j5FoGUhVjhhg%40mail.gmail.com.


Re: [deal.II] Question about fe_value.divergence

2020-09-03 Thread yuesu jin
Dear Dr. Bangerth,
  Thank you very much! I was confused about the shape function in the
vector case.
  In step.8 we use the FEValue::shape_grad(index of shape function,index of
quadrature point) and get a vector as the gradient of shape function.
However, in step.20 and step.22, when we take the gradient of
FESystem[vector_indices]::gradient(index
of shape function, index of quadrature point) we get a rank-2 tensor. If
the shape function is a vector, FEValue::shape_grad(index of shape
function,index of quadrature point) should give a tensor as well. Does it
mean that the shape_grad gives the gradient of the non-zero component in
the vector shape function such that it is a vector?
  Thank you again!
Best regards,

On Thu, Sep 3, 2020 at 3:11 PM Wolfgang Bangerth 
wrote:

> On 9/3/20 1:28 PM, yuesu jin wrote:
> >I am working on vector value finite element modeling. I read the
> pages
> >
> https://www.dealii.org/current/doxygen/deal.II/group__vector__valued.html
> > <
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.dealii.org%2Fcurrent%2Fdoxygen%2Fdeal.II%2Fgroup__vector__valued.html&data=02%7C01%7CWolfgang.Bangerth%40colostate.edu%7Cb30f39009c8c49c8fc8108d8503f8631%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637347581059635256&sdata=w%2BABjRZ1fzUdFfCQvw49JwLF7Inl3iEG4XR78VwlgoA%3D&reserved=0>
>  which
>
> > uses the fe_values.divergence and fe_value.grad, but I cannot find these
> two
> > member functions in the FEValues\FESystem\FEValueBase categories. Could
> you
> > give me the documentation page about these two functions?
>
> These functions only exist in FEValuesViews::Vector and
> FEValuesViews::Tensor.
> You get that if you have something like
>
>FEValuesExtractors::Vector velocities(0);
>fe_values[velocities].divergence (...);
>
> step-22 shows how this works in practice.
>
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/79b2e60e-86e5-b310-9b28-c5c96c3eb364%40colostate.edu
> .
>


-- 
Yuesu Jin,
Ph.D student,
University of Houston,
College of Natural Sciences and Mathematics,
Department of Earth and Atmospheric Sciences,
Houston, Texas 77204-5008
346-404-2062

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CA%2B25a%3DK1nXsvYa0EZvL6eMrduqxx_rZHiSTHUFc-Gxr4KaJBzA%40mail.gmail.com.


Re: [deal.II] PETScWrappers::MPI::BlockVector with Direct Solver

2020-09-03 Thread Mauro Murer
Ok. Thanks a lot!

Il mer 2 set 2020, 17:29 Wolfgang Bangerth  ha
scritto:

> On 9/2/20 8:49 AM, mau@gmail.com wrote:
> >
> > I have read the documentation but I didn't find anything related to
> using
> > BlockVector from PETScWrappers with a Direct Solver, for instance
> > SolverPreOnly should work as a Direct Solver with
> PETScWrappers::PreconditionLU.
> >
> > In my serial code I used SparseDirectUMFPACK, but it is incompatible
> with a
> > PETScWrappers::MPI::BlockVector.
> >
> > Is there any way to use a Direct Solver with
> PETScWrappers::MPI::BlockVector ?
>
> No. You have to use non-blocked matrices and vectors if you want to use
> one of
> the PETSc direct solvers.
>
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/a58850e7-9651-e744-58d9-9ba88989bc3f%40colostate.edu
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAK3LiWezVUFumeJ_v%3DSa_b_03xWO_HZSFkW3mFkkHz9aVhR8%3Dg%40mail.gmail.com.


Re: [deal.II] Question about fe_value.divergence

2020-09-03 Thread Wolfgang Bangerth

On 9/3/20 1:28 PM, yuesu jin wrote:
   I am working on vector value finite element modeling. I read the pages 
https://www.dealii.org/current/doxygen/deal.II/group__vector__valued.html 
 which 
uses the fe_values.divergence and fe_value.grad, but I cannot find these two 
member functions in the FEValues\FESystem\FEValueBase categories. Could you 
give me the documentation page about these two functions?


These functions only exist in FEValuesViews::Vector and FEValuesViews::Tensor. 
You get that if you have something like


  FEValuesExtractors::Vector velocities(0);
  fe_values[velocities].divergence (...);

step-22 shows how this works in practice.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/79b2e60e-86e5-b310-9b28-c5c96c3eb364%40colostate.edu.


[deal.II] Question about fe_value.divergence

2020-09-03 Thread yuesu jin
Dear all,
  I am working on vector value finite element modeling. I read the pages
https://www.dealii.org/current/doxygen/deal.II/group__vector__valued.html which
uses the fe_values.divergence and fe_value.grad, but I cannot find these
two member functions in the FEValues\FESystem\FEValueBase categories. Could
you give me the documentation page about these two functions?
Best regards,


-- 
Yuesu Jin,
Ph.D student,
University of Houston,
College of Natural Sciences and Mathematics,
Department of Earth and Atmospheric Sciences,
Houston, Texas 77204-5008
346-404-2062

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CA%2B25a%3D%2Bbeee0oZ_go39Fn%2B2OL_ooGFhFR203gY05PoKo-uZYkg%40mail.gmail.com.


Re: [deal.II] extract_dofs() extremely slow in for single-thread run?

2020-09-03 Thread 'develo...@googlemail.com' via deal.II User Group
I'm following the discussion, and will retest my program as soon as the 
commit has been approved and merged. Thanks!

Martin Kronbichler schrieb am Donnerstag, 3. September 2020 um 13:55:40 
UTC+2:

> Indeed the other function was fast. I looked into the function already 
> and have a fix posted:
>
> https://github.com/dealii/dealii/pull/10883
>
> Best,
> Martin
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/2d5142e6-ede2-4b40-b3b9-34123ff3e635n%40googlegroups.com.


Re: [deal.II] extract_dofs() extremely slow in for single-thread run?

2020-09-03 Thread Martin Kronbichler
Indeed the other function was fast. I looked into the function already 
and have a fix posted:


https://github.com/dealii/dealii/pull/10883

Best,
Martin

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/377979f8-d10e-065e-f157-abecadebbe92%40gmail.com.


Re: [deal.II] extract_dofs() extremely slow in for single-thread run?

2020-09-03 Thread Wolfgang Bangerth

On 9/3/20 1:16 AM, 'Maxi Miller' via deal.II User Group wrote:


Again, extract_dofs takes most of the time here. Is there an alternative 
approach for that, too?


There is a variation of extract_dofs() that returns its results in the form of 
a std::vector (as one of the arguments) instead of an IndexSet. Could 
you try and see whether that is substantially faster?


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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/e4b9665c-7423-ff8c-10ec-951c18085c32%40colostate.edu.


Re: [deal.II] extract_dofs() extremely slow in for single-thread run?

2020-09-03 Thread 'Maxi Miller' via deal.II User Group
Another issue I have is for the following code piece, where I basically
have to rescale every part of the solution by a different factor (due to
using unitless variables in the calculation):
const ComponentMask surface_A_mask = fe.component_mask(surface_A);
const ComponentMask surface_B_mask = fe.component_mask(surface_B);
const ComponentMask surface_C_mask = fe.component_mask(surface_C);
const ComponentMask surface_D_mask = fe.component_mask(surface_D);

IndexSet A_value_mask = DoFTools::extract_dofs(dof_handler, surface_A_mask);
IndexSet B_value_mask = DoFTools::extract_dofs(dof_handler, surface_B_mask);
IndexSet C_value_mask = DoFTools::extract_dofs(dof_handler, surface_C_mask);
IndexSet D_value_mask = DoFTools::extract_dofs(dof_handler, surface_D_mask);

IndexSet locally_owned_elements = scaled_solution.locally_owned_elements();

A_value_mask.compress();
B_value_mask.compress();
C_value_mask.compress();
D_value_mask.compress();
locally_owned_elements.compress();

vector_t unified_test_vector(dof_handler.locally_owned_dofs(),
mpi_communicator);

for(auto index : scaled_solution.locally_owned_elements()) {

if(A_value_mask.is_element(locally_owned_elements.index_within_set(index)))
  {
  unified_test_vector(index) =
unitless_recalculator.scale_A_solution(scaled_solution(index));
 }

if(B_value_mask.is_element(locally_owned_elements.index_within_set(index)))
 {
  unified_test_vector(index) =
unitless_recalculator.scale_B_solution(scaled_solution(index));
 }

if(C_value_mask.is_element(locally_owned_elements.index_within_set(index)))
 {
  unified_test_vector(index) =
unitless_recalculator.scale_C_solution(scaled_solution(index));
 }

if(D_value_mask.is_element(locally_owned_elements.index_within_set(index)))
 {
  unified_test_vector(index) =
unitless_recalculator.scale_D_solution(scaled_solution(index));
 }
}

Again, extract_dofs takes most of the time here. Is there an alternative
approach for that, too?

Am Do., 3. Sept. 2020 um 08:56 Uhr schrieb 'develo...@googlemail.com' via
deal.II User Group :

> Yes, that worked, thanks!
> Now, when comparing, it takes 132 seconds for my initial version, and 0.41
> seconds for the version you proposed. Why is my approach so much more
> expensive?
> Thanks!
>
> Jean-Paul Pelteret schrieb am Mittwoch, 2. September 2020 um 20:34:56
> UTC+2:
>
>> I was close — it’s
>> fe.get_unit_support_points() //
>> https://www.dealii.org/developer/doxygen/deal.II/classFiniteElement.html#a5b35a290aa7dd7562911a92a13b11fee
>>
>> Moreover, defining fe_values as const disables the reinit()-call, and I
>> have to call cell->is_locally_owned(), instead of cell->locally_owned().
>>
>>
>> Coding in an email client is unforgiving, so I’m glad that you were able
>> to work past these errors.
>>
>> Best,
>> Jean-Paul
>>
>> On 02 Sep 2020, at 14:11, 'develo...@googlemail.com' via deal.II User
>> Group  wrote:
>>
>> I'm using FESystem for defining fe, and therefore I get
>> "unit_support_points is protected within this context". Is there another
>> way to get access to those points?
>> Moreover, defining fe_values as const disables the reinit()-call, and I
>> have to call cell->is_locally_owned(), instead of cell->locally_owned().
>> Thanks!
>>
>> Jean-Paul Pelteret schrieb am Dienstag, 1. September 2020 um 20:28:18
>> UTC+2:
>>
>>> Hi,
>>>
>>> 30-40% of the runtime for this operation seems a bit excessive to me.
>>> Maybe you should try using the FEValuesExtractors in conjunction with
>>> FEValues in order to get the solution at the quadrature points. If you want
>>> the solution at the support points, then you can just create a quadrature
>>> rule that has the quadrature points at the support points and initialise
>>> your FEValues object with it.
>>>
>>> So this bit of pseudo-code illustrates roughly how it could be done:
>>>
>>> //
>>> https://dealii.org/current/doxygen/deal.II/classQuadrature.html#ac002803e6ec722da5a0de102574110c9
>>> //
>>> https://dealii.org/current/doxygen/deal.II/classFiniteElement.html#ab4f6e0c83686b918fbb92716ead92313
>>> const Quadrature q_cell_support_points (fe.unit_support_points());
>>> // Assumes that your FE has unit support points; could also use the unit
>>> cell vertex positions, something else...
>>> const FEValues fe_values(fe, q_cell_support_points, update_values);
>>> const FEValuesExtractors::Scalar surface_A(0);
>>>
>>> Vector solution_vector = …; // If this is an MPI vector, then
>>> still use the same basic approach
>>>
>>> double max_value = std::numeric_limits::min();
>>> for (auto cell : dof_handler.active_cell_iterators())
>>> {
>>>   if (!cell->locally_owned()) continue;
>>>
>>>   fe_values.reinit(cell);
>>>
>>>   //
>>> https://dealii.org/current/doxygen/deal.II/classFEValuesViews_1_1Scalar.html#a7aa6b0275facea985f23a64ad690d9b1
>>>   std::vector q_point_solution_values
>>> (fe_values.n_quadrature_points);
>>>   fe_values[surface_A].get_function_values(solution_vector ,
>>> q_point_