Re: [deal.II] singularity error due to 1/0

2016-09-09 Thread Wolfgang Bangerth

On 09/08/2016 10:17 PM, hanks0...@gmail.com wrote:

Thanks for your answer. But, I still don't know how I can deal with this error.


Then you need to describe more clearly what you want to do. As I mentioned 
here...



> K_Inv[0][0]=2*r/(cos(theta)*cos(theta)),
> K_Inv[1][1]=2*r/(sin(theta)*sin(theta)), K_Inv[2][2]=r
>
> r is calculated by "r=sqrt(x^2+y^2) ", and theta is calculated by
"theta=x/y"
>
> But, as you can expect that ,on the points where |x|<0.001 or
> |y|<0.01,  cos(theta) or sin(theta) is almost zero. So, It seems
that It
> causes the singularity.
>
> So, At first I tried to change the above 2 element in K_Inv like this...
>
> K_Inv[0][0]=2*r/(cos(theta)*cos(theta)+del)
>  K_Inv[1][1]=2*r/(sin(theta)*sin(theta)+del),

Instead of this approach, you should use the following: if r>delta, use the
formula above. If r<=delta, use l'Hopital's rule to get an expression that
avoids the division by zero.

That said, you still have a problem for those values of x,y where theta is
close to zero or one, but r is not. For example, for x=0, y=1, you have
   r=1
   theta=pi/2
   cos(theta)=0
   K_inv[0,0] = 2/0
You need to think about what you want to do with this situation.


...your original formula for K_Inv[0][0] is so that it can lead to 1/0 for 
some values of x,y. There is simply nothing you can do about this -- it's not 
a question how you *compute* it, it's that that's what the *model* says. If 
you don't like it, you need to start thinking about whether that's the 
*correct model*!


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] singularity error due to 1/0

2016-09-09 Thread Daniel Arndt
Kyusik,

Can you summarize what you have tried and which errors/problems you got 
with these approaches?
What exactly do you mean with "csc(theta) or sec(theta) can't be used in 
cylindrical coord system"?

Best,
Daniel

Am Freitag, 9. September 2016 06:17:44 UTC+2 schrieb hank...@gmail.com:
>
> Thanks for your answer. But, I still don't know how I can deal with this 
> error.
>
> Anyway, Thank you very much.
>
> Kyusik. 
>
> 2016년 9월 5일 월요일 오후 9시 47분 21초 UTC+9, Wolfgang Bangerth 님의 말:
>>
>> On 09/05/2016 06:04 AM, hank...@gmail.com wrote: 
>> > 
>> > K_Inv[0][0]=2*r/(cos(theta)*cos(theta)), 
>> > K_Inv[1][1]=2*r/(sin(theta)*sin(theta)), K_Inv[2][2]=r 
>> > 
>> > r is calculated by "r=sqrt(x^2+y^2) ", and theta is calculated by 
>> "theta=x/y" 
>> > 
>> > But, as you can expect that ,on the points where |x|<0.001 or 
>> > |y|<0.01,  cos(theta) or sin(theta) is almost zero. So, It seems 
>> that It 
>> > causes the singularity. 
>> > 
>> > So, At first I tried to change the above 2 element in K_Inv like 
>> this... 
>> > 
>> > K_Inv[0][0]=2*r/(cos(theta)*cos(theta)+del) 
>> >  K_Inv[1][1]=2*r/(sin(theta)*sin(theta)+del), 
>>
>> Instead of this approach, you should use the following: if r>delta, use 
>> the 
>> formula above. If r<=delta, use l'Hopital's rule to get an expression 
>> that 
>> avoids the division by zero. 
>>
>> That said, you still have a problem for those values of x,y where theta 
>> is 
>> close to zero or one, but r is not. For example, for x=0, y=1, you have 
>>r=1 
>>theta=pi/2 
>>cos(theta)=0 
>>K_inv[0,0] = 2/0 
>> You need to think about what you want to do with this situation. 
>>
>> 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] singularity error due to 1/0

2016-09-08 Thread hanks0227
Thanks for your answer. But, I still don't know how I can deal with this 
error.

Anyway, Thank you very much.

Kyusik. 

2016년 9월 5일 월요일 오후 9시 47분 21초 UTC+9, Wolfgang Bangerth 님의 말:
>
> On 09/05/2016 06:04 AM, hank...@gmail.com  wrote: 
> > 
> > K_Inv[0][0]=2*r/(cos(theta)*cos(theta)), 
> > K_Inv[1][1]=2*r/(sin(theta)*sin(theta)), K_Inv[2][2]=r 
> > 
> > r is calculated by "r=sqrt(x^2+y^2) ", and theta is calculated by 
> "theta=x/y" 
> > 
> > But, as you can expect that ,on the points where |x|<0.001 or 
> > |y|<0.01,  cos(theta) or sin(theta) is almost zero. So, It seems 
> that It 
> > causes the singularity. 
> > 
> > So, At first I tried to change the above 2 element in K_Inv like this... 
> > 
> > K_Inv[0][0]=2*r/(cos(theta)*cos(theta)+del) 
> >  K_Inv[1][1]=2*r/(sin(theta)*sin(theta)+del), 
>
> Instead of this approach, you should use the following: if r>delta, use 
> the 
> formula above. If r<=delta, use l'Hopital's rule to get an expression that 
> avoids the division by zero. 
>
> That said, you still have a problem for those values of x,y where theta is 
> close to zero or one, but r is not. For example, for x=0, y=1, you have 
>r=1 
>theta=pi/2 
>cos(theta)=0 
>K_inv[0,0] = 2/0 
> You need to think about what you want to do with this situation. 
>
> 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] singularity error due to 1/0

2016-09-05 Thread Wolfgang Bangerth

On 09/05/2016 06:04 AM, hanks0...@gmail.com wrote:


K_Inv[0][0]=2*r/(cos(theta)*cos(theta)),
K_Inv[1][1]=2*r/(sin(theta)*sin(theta)), K_Inv[2][2]=r

r is calculated by "r=sqrt(x^2+y^2) ", and theta is calculated by "theta=x/y"

But, as you can expect that ,on the points where |x|<0.001 or
|y|<0.01,  cos(theta) or sin(theta) is almost zero. So, It seems that It
causes the singularity.

So, At first I tried to change the above 2 element in K_Inv like this...

K_Inv[0][0]=2*r/(cos(theta)*cos(theta)+del)
 K_Inv[1][1]=2*r/(sin(theta)*sin(theta)+del),


Instead of this approach, you should use the following: if r>delta, use the 
formula above. If r<=delta, use l'Hopital's rule to get an expression that 
avoids the division by zero.


That said, you still have a problem for those values of x,y where theta is 
close to zero or one, but r is not. For example, for x=0, y=1, you have

  r=1
  theta=pi/2
  cos(theta)=0
  K_inv[0,0] = 2/0
You need to think about what you want to do with this situation.

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.