Re: Why some indices are out of range in the file output by sparsity_pattern.print_gnuplot(outfile)

41 views
Skip to first unread message

Wolfgang Bangerth

unread,
Jul 21, 2022, 12:29:31 PM7/21/22
to 王昆, dea...@googlegroups.com
On 7/21/22 03:34, 王昆 wrote:
>
>    I am a dealii amateur from China. Recently, I encouter a problem when
> programing with the dealii lib (version 9.2.0). When I output the sparsity
> pattern using method BlockSparsityPattern:: print_gnuplot(), it can
> successfully output a data file. But we found that some indices are out of the
> range allowed either for the row or column. I don't known why. I guess that
> this may be caused by the constraint arising from the periodic boundary
> condition applied. But I have no ideal how to fix it. Could you provide me
> some tips on how to solve this problem? Thank you very much.

K. Wang:
It's hard to tell what is going wrong because we don't know from your message
at what point during the program's execution you are outputting the sparsity
pattern, or which specific entries you are trying to write to but that you
can't. Can you create a small program that illustrates the issue you are facing?

Best
W.


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

Wolfgang Bangerth

unread,
Jan 13, 2023, 12:58:58 PM1/13/23
to 王昆, dea...@googlegroups.com
On 1/13/23 05:59, 王昆 wrote:
>
>   Happy new year! I am a DealII amateur from China and need your help!
> Recently, I want to perform the polar decomposition for a Tensor<2,dim> using
> DealII. I have searched all the methods provided in Tensor
> and Physics::Elasticity::Kinematics. But no method could directly perform such
> operation. It is known that the singular value decomposition could be used for
> such operation. However, I cannot find similar method for the Tensor, too.
> Could you give me some tips on how to solve this problem?

Dear K. Wang:
if I understand you right, for a given d x d tensor A, you want to find
factors U and P so that
A = UP
? That might indeed not be implemented so far, but it should not be very
difficult to do. You will need to write something like this:

// 1d case
std::pair<Tensor<2,1>,Tensor<2,1>>
polar_decomposition (const Tensor<2,1> &A) {
const Tensor<2,1> U = {{ (A[0][0]>0 ? 1 : -1) }};
const Tensor<2,1> P = {{ std::fabs(A[0][0]) }};
return {U,P};
}

// 2d case
std::pair<Tensor<2,2>,Tensor<2,2>>
polar_decomposition (const Tensor<2,2> &A) {
Tensor<2,2> U;
Tensor<2,2> P;
...compute U, P...
return {U,P};
}

// 3d case
std::pair<Tensor<2,3>,Tensor<2,3>>
polar_decomposition (const Tensor<2,3> &A) {
Tensor<2,3> U;
Tensor<2,3> P;
...compute U, P...
return {U,P};
}

I don't know what algorithms exist for the 2d and 3d cases, but I assume that
there is literature.

If you were interested in implementing these functions above, we would be very
happy to add them to the library!

Best
Wolfgang
Reply all
Reply to author
Forward
0 new messages