'프로그램 사용'에 해당되는 글 2263건

  1. 2023.06.12 fftw 라이브러리 사용 테스트
  2. 2023.06.07 openFOAM + freecad + salome
  3. 2023.06.07 gnuplot 예제
  4. 2023.06.02 fft 잘못 사용하고 있었나?
  5. 2023.06.01 fft 라이브러리 목록
  6. 2023.05.30 ssh ecdsa 미지원(ubuntu 22.04)
  7. 2023.05.27 fftw 다차원 분석
  8. 2023.05.24 openFOAM tutorial with youtube
  9. 2023.05.24 openfoam on ubuntu
  10. 2023.05.24 openFOAM tutorial 4

fftw()에

1. 입력 범위는 크게 의미 없으나 0.0~1.0 사이로 1의 높이로 정규화 하는 것이 용이할 수도 있음

2. DC 성분은 fft_result[0]에 있으며 / Sample 을 하면 DC 성분의 높이를 알 수 있음

2. sine() 성분은 fft_result[1~1/N]에 있으며 / Sample 을 하면 sine() 성분의 높이를 알 수 있음. (+/- x로 해석?)

3. phase는 모르겠다 -ㅁ-

-----------------

입력 값 범위 테스트

그냥 정상적인 0~1 사이의 실수 범위 입력

  for ( i = 0; i < n; i++ )
    in[i] = ( double ) sin ( 360.0f * (double)i / n  * 3.1415927f / 180.0f);

 

입력 범위 확인

출력 결과

도대체.. 1Hz 에서 32는 무슨 의미냐..

샘플링 횟수로 나눌게 아니라 최대 주파수 로 나누어야 하는건가?

  Input Data:

    0,    0.000000
    1,    0.098017
    2,    0.195090

...

  Output FFT Coefficients:

    0,   -0.000000,    0.000000,    0.000000
    1,    0.000003,  -32.000000,   32.000000
    2,   -0.000000,    0.000001,    0.000001

 

걍 무지성으로 100,000 곱하기(0 다섯개)

  for ( i = 0; i < n; i++ )
    in[i] = ( double ) sin ( 360.0f * (double)i / n  * 3.1415927f / 180.0f) * 100000;

 

FFT 결과 자체는 동일하지만(?) 결과 자체는 곱해준 100,000 만큼 증가

  Input Data:

    0,    0.000000
    1, 9801.714305
    2,19509.032738

...

  Output FFT Coefficients:

    0,   -0.008742,    0.000000,    0.008742
    1,    0.271011,-3199999.955619,3200000.000000
    2,   -0.008742,    0.118444,    0.118767

 

위상(phase)

동일 값, 위치만 8 칸 미룸(8/64 = 1/8 phase)

phase는 atan(b/a) 로 계산한다는데 일단 하라는대로 하니, -1.5 대충 pi/2 정도 최대값으로 나오는 듯.

  Input Data:

    0,    0.000000
    1, 9801.714305
    2,19509.032738
    3,29028.468510
    4,38268.344246
    5,47139.674887
    6,55557.024665
    7,63439.329895
    8,70710.679664
    9,77301.046896
   10,83146.962748
   11,88192.127851
   12,92387.954506
   13,95694.034604
   14,98078.528786
   15,99518.473069
   16,100000.000000


  Output FFT Coefficients:

    0,   -0.008742,    0.000000,    0.008742,    3.141593
    1,    0.271011,-3199999.955619,3199999.955619,   -1.570796
    2,   -0.008742,    0.118444,    0.118767,    1.644472
  Input Data:

    0,70710.679664
    1,77301.046896
    2,83146.962748
    3,88192.127851
    4,92387.954506
    5,95694.034604
    6,98078.528786
    7,99518.473069
    8,100000.000000
    9,99518.472212
   10,98078.527081
   11,95694.032066
   12,92387.951160
   13,88192.123730
   14,83146.957891
   15,77301.041350
   16,70710.673482

  Output FFT Coefficients:

    0,    0.119650,    0.000000,    0.119650,    0.000000
    1,2262741.972266,-2262741.421146,3199999.995629,   -0.785398
    2,   -0.048261,    0.083753,    0.096663,    2.093553

[링크 : https://blog.naver.com/lyb0684/221159899932]

 

atan과 atan2는 범위가 다르다고 한다. (범위가 달라지는 거지 radian을 degree로 계산하는게 달라지는건 아니니..)

atan
RETURN VALUE
       On success, these functions return the principal value of the arc  tan‐
       gent of x in radians; the return value is in the range [-pi/2, pi/2].

atan2
RETURN VALUE
       On  success, these functions return the principal value of the arc tan‐
       gent of y/x in radians; the return value is in the range [-pi, pi].

 

아무튼 귀찮으니 atan2의 radian 값 출력을 각도로 변환해서 출력해보면

  for ( i = 0; i < nc; i++ )
  {
      printf ( "  %3d,%12f,%12f,%12f,%12f,%12f\n", i, out[i][0], out[i][1],  
      sqrt(out[i][0] * out[i][0] +  out[i][1] * out[i][1]),
      atan2(out[i][1], out[i][0]) * 180 / PI,
      atan(out[i][1] / out[i][0]) * 180 / PI
  }

[링크 : https://spiralmoon.tistory.com/entry/프로그래밍-이론-두-점-사이의-절대각도를-재는-atan2]

 

뭔가 잘못 계산한 느낌이다?

+ 0      1,    0.000003,  -32.000000,   32.000000,  -89.999993,  -89.999993
+ 8     1,   22.627420,  -22.627414,   32.000000,  -44.999992,  -44.999992
+ 16     1,   32.000000,    0.000004,   32.000000,    0.000008,    0.000008
+ 32     1,   -0.000006,   32.000000,   32.000000,   90.000007,  -89.999988

 

 

+

DC성분

아래와 같이 1.0 값으로 64개를 만들어 fft를 돌리면

  for ( i = 0; i < n; i++ )
  { 
    in[i] = ( double )1.0f;
  }

 

64번 샘플링한게 1씩 있어서 합산하여 64가 나오나?

아무튼 실수부의 경우 -와 +의 차이가 있지만 abs()로 처리하면 부호가 사라지니 같은 값으로 보이게 된다.

  Output FFT Coefficients:

    0,   64.000000,    0.000000,   64.000000,    0.000000,    0.000000,    0.000000
  Output FFT Coefficients:

    0,  -64.000000,    0.000000,   64.000000,    3.141593,  179.999995,   -0.000000

 

0.5로 하면 32가 나온다. 도대체 이 DC는 어떻게 해석해야 할까?

  Output FFT Coefficients:

    0,   32.000000,    0.000000,   32.000000,    0.000000,    0.000000,    0.000000

 

sin() * 0.5는 DC 성분이 0으로 나오고 1Hz 에서는 16 으로 나온다(0.5로 봐야하나?)

  Output FFT Coefficients:

    0,   -0.000000,    0.000000,    0.000000,    3.141593,  179.999995,   -0.000000
    1,    0.000001,  -16.000000,   16.000000,   -1.570796,  -89.999993,  -89.999993
    2,   -0.000000,    0.000001,    0.000001,    1.644472,   94.221297,  -85.778698

 

sin() * 0.5 + 0.5(0.0~1.0=1.0) 하면 DC 32에 1Hz 16 (1 * 16?)

 

걍 맘편하게 주파수는 진폭, DC는 

  Output FFT Coefficients:

    0,   32.000000,    0.000000,   32.000000,    0.000000,    0.000000,    0.000000
    1,    0.000001,  -16.000000,   16.000000,   -1.570796,  -89.999993,  -89.999993
    2,   -0.000000,    0.000001,    0.000001,    1.644472,   94.221297,  -85.778698

 

sin() 은(-1.0~1.0=2.0 Height?) DC 0 1Hz 32 (2 * 16?)

 

  Output FFT Coefficients:

    0,   -0.000000,    0.000000,    0.000000,    3.141593,  179.999995,   -0.000000
    1,    0.000003,  -32.000000,   32.000000,   -1.570796,  -89.999993,  -89.999993

 

sin() * 0.5 + 0.5 (0.0~1.0=1.0) 에 절반의 파형만 줄 경우

1Hz에 18 

  Output FFT Coefficients:

    0,   26.177734,    0.000000,   26.177734,    0.000000,    0.000000,    0.000000
    1,    0.500000,  -18.177734,   18.184609,   -1.543297,  -88.424406,  -88.424406
    2,   -3.403504,   -0.000000,    3.403504,   -3.141593, -179.999990,    0.000005

 

sin(2x)

 

sin 주기가 늘어났다고 해서 16이 아니게 되는건 또 아니네?

그 와중에 0.5의 DC는 또 32.. 도대체 머냐고?!

0.5 * 64 = 32

sine 16/32 = 0.5. 혹시 +-0.5 라는건가?

  Output FFT Coefficients:

    0,   32.000000,    0.000000,   32.000000,    0.000000,    0.000000,    0.000000
    1,   -0.000000,   -0.000001,    0.000001,   -1.716660,  -98.357374,   81.642621
    2,    0.000003,  -16.000000,   16.000000,   -1.570796,  -89.999988,  -89.999988
    3,   -0.000000,    0.000001,    0.000001,    1.652756,   94.695926,  -85.304069
    4,   -0.000000,    0.000001,    0.000001,    1.718417,   98.458014,  -81.541981

 

혹시나 해서 sin(2x) * 0.1 + 0.9 해보는데

57.6

산술적으로는 64 * 0.9 = 57.6

3.2 / 32 = 0.1 이니.. DC랑 혼합될 때랑 단독일때랑 다르게 나오나?

(+- 0.1 로 해석하면 쉬울지도?)

  Output FFT Coefficients:

    0,   57.600000,    0.000000,   57.600000,    0.000000,    0.000000,    0.000000
    1,   -0.000000,   -0.000000,    0.000000,   -1.716660,  -98.357374,   81.642621
    2,    0.000001,   -3.200000,    3.200000,   -1.570796,  -89.999988,  -89.999988
    3,   -0.000000,    0.000000,    0.000000,    1.652756,   94.695926,  -85.304069

 

sin(2x)의 절반 파형만 도배!

고조파 처럼 나오네?

DC 52.3

4Hz 6.8, 8Hz 1.42, 12Hz 0.65, 16Hz 0.39, 20Hz 0.28, 24Hz 0.23, 28Hz0.20,  32Hz 0.19 (합계 10.251662)

  Output FFT Coefficients:

    0,   52.306340,    0.000000,   52.306340,    0.000000,    0.000000,    0.000000
    1,    0.000000,    0.000000,    0.000000,    0.000000,    0.000000,        -nan
    2,    0.000000,    0.000000,    0.000000,    0.000000,    0.000000,        -nan
    3,    0.000000,    0.000000,    0.000000,    0.000000,    0.000000,        -nan
    4,   -6.856612,   -0.000001,    6.856612,   -3.141593, -179.999990,    0.000005
    5,    0.000000,    0.000000,    0.000000,    0.000000,    0.000000,        -nan
    6,    0.000000,    0.000000,    0.000000,    0.000000,    0.000000,        -nan
    7,    0.000000,    0.000000,    0.000000,    0.000000,    0.000000,        -nan
    8,   -1.425690,   -0.000000,    1.425690,   -3.141592, -179.999986,    0.000009
    9,    0.000000,    0.000000,    0.000000,    0.000000,    0.000000,        -nan
   10,    0.000000,    0.000000,    0.000000,    0.000000,    0.000000,        -nan
   11,    0.000000,    0.000000,    0.000000,    0.000000,    0.000000,        -nan
   12,   -0.652365,   -0.000000,    0.652365,   -3.141592, -179.999983,    0.000012
   13,    0.000000,    0.000000,    0.000000,    0.000000,    0.000000,        -nan
   14,    0.000000,    0.000000,    0.000000,    0.000000,    0.000000,        -nan
   15,    0.000000,    0.000000,    0.000000,    0.000000,    0.000000,        -nan
   16,   -0.397825,   -0.000000,    0.397825,   -3.141592, -179.999982,    0.000013
   17,    0.000000,   -0.000000,    0.000000,   -0.000000,   -0.000000,        -nan
   18,    0.000000,   -0.000000,    0.000000,   -0.000000,   -0.000000,        -nan
   19,    0.000000,   -0.000000,    0.000000,   -0.000000,   -0.000000,        -nan
   20,   -0.286168,   -0.000000,    0.286168,   -3.141592, -179.999983,    0.000012
   21,    0.000000,   -0.000000,    0.000000,   -0.000000,   -0.000000,        -nan
   22,    0.000000,   -0.000000,    0.000000,   -0.000000,   -0.000000,        -nan
   23,    0.000000,   -0.000000,    0.000000,   -0.000000,   -0.000000,        -nan
   24,   -0.231164,   -0.000000,    0.231164,   -3.141592, -179.999986,    0.000009
   25,    0.000000,   -0.000000,    0.000000,   -0.000000,   -0.000000,        -nan
   26,    0.000000,   -0.000000,    0.000000,   -0.000000,   -0.000000,        -nan
   27,    0.000000,   -0.000000,    0.000000,   -0.000000,   -0.000000,        -nan
   28,   -0.204855,   -0.000000,    0.204855,   -3.141593, -179.999990,    0.000005
   29,    0.000000,   -0.000000,    0.000000,   -0.000000,   -0.000000,        -nan
   30,    0.000000,   -0.000000,    0.000000,   -0.000000,   -0.000000,        -nan
   31,    0.000000,   -0.000000,    0.000000,   -0.000000,   -0.000000,        -nan
   32,   -0.196983,    0.000000,    0.196983,    3.141593,  179.999995,   -0.000000

'프로그램 사용 > fft, fftw' 카테고리의 다른 글

overlap kissfft  (0) 2023.06.12
fft size overlap window size  (0) 2023.06.12
fft 잘못 사용하고 있었나?  (0) 2023.06.02
fft 라이브러리 목록  (0) 2023.06.01
fftw 다차원 분석  (0) 2023.05.27
Posted by 구차니

freecad로 fan 설계

[링크 : https://www.youtube.com/watch?v=fdikenPo4pE]

 

freecad로 설계한 도면을 salome를 이용하여 mesh(?)로 변환

[링크 : https://www.youtube.com/watch?v=FwseuCiSdiE]

[링크 : https://www.salome-platform.org/?page_id=15]

[링크 : https://www.salome-platform.org/]

 

openfoam + paraview

[링크 : https://www.youtube.com/watch?v=79-x2YQVE6Q]

[링크 : https://github.com/20jeka08/OpenFOAM_Propeller_simpleFoam] openfoam 설정(?) 파일

'프로그램 사용 > openFOAM' 카테고리의 다른 글

mpirun illegal instruction  (0) 2023.09.01
openFOAM tutorial with youtube  (0) 2023.05.24
openfoam on ubuntu  (0) 2023.05.24
openFOAM tutorial  (4) 2023.05.24
openfoam7 on ubuntu 18.04  (0) 2020.08.09
Posted by 구차니

gnuplot이 논문 등에서 그래프 그리는 용도로 많이 언급되는데 써보는건 첨인듯..

 

인터프리터(?)에서 아래와 같이 명령을 주면 된다고 한다.

gnuplot:> splot [2:-1] [-1:2] 3*x**2 + 2y**2

[링크 : https://namu.wiki/w/gnuplot]

 

혹시나 해서 gnuplot-qt를 깔았는데 저 gui가 qt 기반인건가?

$ gnuplot

G N U P L O T
Version 5.4 patchlevel 2    last modified 2021-06-01 

Copyright (C) 1986-1993, 1998, 2004, 2007-2021
Thomas Williams, Colin Kelley and many others

gnuplot home:     http://www.gnuplot.info
faq, bugs, etc:   type "help FAQ"
immediate help:   type "help"  (plot window: hit 'h')

Terminal type is now 'qt'
gnuplot> splot [2:-1] [-1:2] 3*x**2 + 2y**2
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.

gnuplot> splot [2:-1] [-1:2] 3*x**2 + 2y**2
                                       ^
         unexpected or unrecognized token: y

gnuplot> quit

 

아무튼 이쁘게 잘 그려준다.

 

csv 파일을 그리려면 ,를 구분자로 설정해주면 되고

set datafile separator ','
plot "test.csv" using 0:1 with lines

[링크 : https://raymii.org/s/tutorials/GNUplot_tips_for_nice_looking_charts_from_a_CSV_file.html]

[링크 : https://stackoverflow.com/questions/48885697/gnuplot-graph-csv]

 

using 뒤에 숫자는 X 축과 Y축에 대해서 설정하는 것이고, 기본적으로 1 열에 대해서만 그래프를 그려준다.

using 1:3 파일에 있는 1열(X축)과 3열(Y축)을 사용하겠음

[링크 : https://m.blog.naver.com/gfeel323/40201727680]

 

여러 열을 한 그래프에 그리고 싶으면 아래와 같이  , "" 하고 using 구문을 추가해도 되고, for 문을 이용해서 반복해도 된다.

> plot "tt.csv" using 0:1 with lines, "" using 0:2 with lines
> plot for [col=1:4] 'file' using 0:col with lines

[링크 : https://stackoverflow.com/questions/16073232/gnuplot-plotting-a-file-with-4-columns-all-on-y-axis]

[링크 : https://raymii.org/s/tutorials/GNUplot_tips_for_nice_looking_charts_from_a_CSV_file.html]

 

만약 csv 파일에 일련번호로 쓸 내용이 없다면(대개는 시간이 있긴 하지만)

아래의 명령을 이용하여 x 축에 pseudocolumns를 추가해줄 수 있다고 한다.

가장 편한건 x축 지정하지 않는 using n이 무난한 듯.

plot "file.dat" using (column(0)):3

You can even use plot "file.dat" using 0:3
Or, as pointed out in the other answer, even plot "file.dat" using 3

[링크 : https://stackoverflow.com/questions/9664472/having-automatic-x]

 

stackoverflow에 내용을 참조해서 도움말을 보니 column("컬럼명") 혹은 column("컬럼 번호") 로 쓰는데

인덱스는 0부터가 아니라 1부터 시작되는 듯

gnuplot> help plot datafile using
// 생략
 if the data file contains
       Height    Weight    Age
       val1      val1      val1
       ...       ...       ...
 then the following plot commands are all equivalent
       plot 'datafile' using 3:1, '' using 3:2
       plot 'datafile' using (column("Age")):(column(1)), \
                    '' using (column("Age")):(column(2))
       plot 'datafile' using "Age":"Height", '' using "Age":"Weight"

 

그렇기에 (column(0)) 을 해주면 되는데 column(0)에러 난다.(!)

gnuplot> help plot datafile using pseudocolumns
 Expressions in the `using` clause of a plot statement can refer to additional
 bookkeeping values in addition to the actual data values contained in the input
 file. These are contained in "pseudocolumns".
       column(0)   The sequential order of each point within a data set.
                   The counter starts at 0, increments on each non-blank,
                   non-comment line, and is reset by two sequential blank
                   records.  The shorthand form $0 is available.
       column(-1)  This counter starts at 0, increments on a single blank line,
                   and is reset by two sequential blank lines.
                   This corresponds to the data line in array or grid data.
                   It can also be used to distinguish separate line segments
                   or polygons within a data set.
       column(-2)  Starts at 0 and increments on two sequential blank lines.
                   This is the index number of the current data set within a
                   file that contains multiple data sets.  See `index`.
       column($#)  The special symbol $# evaluates to the total number of
                   columns available, so column($#) refers to the last
                   (rightmost) field in the current input line.
                   column($# - 1) would refer to the last-but-one column, etc.

 

터미널 변경은 set terminal을 쓰면 된다.

$ gnuplot

G N U P L O T
Version 5.4 patchlevel 2    last modified 2021-06-01 

Copyright (C) 1986-1993, 1998, 2004, 2007-2021
Thomas Williams, Colin Kelley and many others

gnuplot home:     http://www.gnuplot.info
faq, bugs, etc:   type "help FAQ"
immediate help:   type "help"  (plot window: hit 'h')

Terminal type is now 'qt'

gnuplot> set terminal dumb
Terminal type is now 'dumb'
Options are 'feed  size 79, 24 aspect 2, 1 mono'

[링크 : https://www.postgresql.kr/blog/gnuplot_dumb_terminal.html]

 

같은 그래프를 dump과

 

qt로 설정해서 출력한 모양

 

qt 에서 휠 드래그로 중심이동은 안되고

ctrl - wheel로 x축, y축 확대

ctrl - shift- wheel은 x 축 확대

shift - wheel 혹은 alt -wheel 로 x축 이동

wheel 로 y 축 이동이 기본 값으로 지정된다.

'프로그램 사용 > gnuplot' 카테고리의 다른 글

gnuplot  (0) 2022.06.13
Posted by 구차니

입력값을 정규화 하려고 했는데

fftw를 쓴다고 알려진 matlab의 예제를 보니

입력값 범위로 정규화하는게 아니라(입력 값이 8bit 라면 /256 으로 0~1 사이 값으로..)

입력 받는 샘플의 갯수로 정규화 해줘야 하는 건가?

 

아무튼 정규화 했다고 생각했는데 진폭이 이상하게 1이상의 값이 나왔는데

그거 탓이었나 싶기도 하고.. 다시 테스트 해봐야 할 듯

 

Fs = 1000;            % Sampling frequency                    
T = 1/Fs;             % Sampling period       
L = 1500;             % Length of signal
t = (0:L-1)*T;        % Time vector

푸리에 변환을 계산합니다.

Y = fft(X);
양방향 스펙트럼 P2를 계산합니다. 그런 다음, P2와 짝수 값 신호 길이 L을 기반으로 하여 단방향 스펙트럼 P1을 계산합니다.

P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);

[링크 : https://kr.mathworks.com/help/matlab/ref/fft.html]

 

fftw_plan fftw_plan_r2r_1d(int n, double *in, double *out,
                           fftw_r2r_kind kind, unsigned flags);
fftw_plan fftw_plan_r2r_2d(int n0, int n1, double *in, double *out,
                           fftw_r2r_kind kind0, fftw_r2r_kind kind1,
                           unsigned flags);
fftw_plan fftw_plan_r2r_3d(int n0, int n1, int n2,
                           double *in, double *out,
                           fftw_r2r_kind kind0,
                           fftw_r2r_kind kind1,
                           fftw_r2r_kind kind2,
                           unsigned flags);
fftw_plan fftw_plan_r2r(int rank, const int *n, double *in, double *out,
                        const fftw_r2r_kind *kind, unsigned flags);

[링크 : https://www.fftw.org/fftw3_doc/More-DFTs-of-Real-Data.html]

'프로그램 사용 > fft, fftw' 카테고리의 다른 글

fft size overlap window size  (0) 2023.06.12
fftw 라이브러리 사용 테스트  (0) 2023.06.12
fft 라이브러리 목록  (0) 2023.06.01
fftw 다차원 분석  (0) 2023.05.27
fft phase 연산  (0) 2023.04.07
Posted by 구차니

'프로그램 사용 > fft, fftw' 카테고리의 다른 글

fftw 라이브러리 사용 테스트  (0) 2023.06.12
fft 잘못 사용하고 있었나?  (0) 2023.06.02
fftw 다차원 분석  (0) 2023.05.27
fft phase 연산  (0) 2023.04.07
fftw input range?  (0) 2023.04.07
Posted by 구차니

ubuntu 22.04로 올렸더니 git에서 받으려고 시도했으나 실패해서

옆자리 동료에서 물어보니 ssh 보안관련 문제라고

 

그래서 추가로 검색해보니 SSL 에서 구버전 암호화 deprecate 시키듯이

SSH 에서도 ed25519 를 구버전 암호화로 사용을 막도록 기본값을 변경해서 생긴 문제인 듯.

The RSA SHA-1 hash algorithm is being quickly deprecated across operating systems and SSH clients because of various security vulnerabilities, with many of these technologies now outright denying the use of this algorithm.

It seems this has happened for the ssh client in Ubuntu 22.04. The RSA public-private key pair is considered not safe any more.

Solution
Use a more modern and secure type of key such as ed25519. Generate a new key pair in your Ubuntu 22.04 computer with this command:

ssh-keygen -t ed25519 -C "colin@colin-desktop"

[링크 : https://askubuntu.com/questions/1409105/ubuntu-22-04-ssh-the-rsa-key-isnt-working-since-upgrading-from-20-04]

[링크 : https://songs-family.tistory.com/entry/장애이슈-SSH-키-인증-방식-변경ssh-rsa-ecdsa-에-따른-서비스-장애]

 

EdDSA는 Edwards-curve 디지털 서영 알고리즘의 약자고

Ed25519는 SHA-512와 curve25519를 사용했다는데

Edwards-curve Digital Signature Algorithm (EdDSA)
Ed25519 is the EdDSA signature scheme using SHA-512 (SHA-2) and Curve25519[2] where

[링크 : https://en.wikipedia.org/wiki/EdDSA]

 

curve25519는 128bit 암호화를 제공해서 잘린건가?

In cryptography, Curve25519 is an elliptic curve used in elliptic-curve cryptography (ECC) offering 128 bits of security (256-bit key size) and designed for use with the elliptic curve Diffie–Hellman (ECDH) key agreement scheme. 

[링크 : https://en.wikipedia.org/wiki/Curve25519]

Posted by 구차니

libttfw 에서는 2차원 3차원 DFT를 지원하는데, 내가 생각하는 그 2차원 3차원이 맞나 모르겠다.

센서가 3축이면 3차원은 맞긴한데.. 희소행렬 형태로 삽입이 되어야 하나?

2.2 Complex Multi-Dimensional DFTs
Multi-dimensional transforms work much the same way as one-dimensional transforms: you allocate arrays of fftw_complex (preferably using fftw_malloc), create an fftw_plan, execute it as many times as you want with fftw_execute(plan), and clean up with fftw_destroy_plan(plan) (and fftw_free).

FFTW provides two routines for creating plans for 2d and 3d transforms, and one routine for creating plans of arbitrary dimensionality. The 2d and 3d routines have the following signature:

fftw_plan fftw_plan_dft_2d(int n0, int n1,
                           fftw_complex *in, fftw_complex *out,
                           int sign, unsigned flags);
fftw_plan fftw_plan_dft_3d(int n0, int n1, int n2,
                           fftw_complex *in, fftw_complex *out,
                           int sign, unsigned flags);

[링크 : https://www.fftw.org/fftw3_doc/Complex-Multi_002dDimensional-DFTs.html]

 

3.2.1 Row-major Format
The multi-dimensional arrays passed to fftw_plan_dft etcetera are expected to be stored as a single contiguous block in row-major order (sometimes called “C order”). Basically, this means that as you step through adjacent memory locations, the first dimension’s index varies most slowly and the last dimension’s index varies most quickly.

To be more explicit, let us consider an array of rank d whose dimensions are n0 × n1 × n2 × … × nd-1 . Now, we specify a location in the array by a sequence of d (zero-based) indices, one for each dimension: (i0, i1, i2,..., id-1). If the array is stored in row-major order, then this element is located at the position id-1 + nd-1 * (id-2 + nd-2 * (... + n1 * i0)).

Note that, for the ordinary complex DFT, each element of the array must be of type fftw_complex; i.e. a (real, imaginary) pair of (double-precision) numbers.

In the advanced FFTW interface, the physical dimensions n from which the indices are computed can be different from (larger than) the logical dimensions of the transform to be computed, in order to transform a subset of a larger array. Note also that, in the advanced interface, the expression above is multiplied by a stride to get the actual array index—this is useful in situations where each element of the multi-dimensional array is actually a data structure (or another array), and you just want to transform a single field. In the basic interface, however, the stride is 1.

[링크 : https://www.fftw.org/fftw3_doc/Row_002dmajor-Format.html]

 

A multi-dimensional array whose size is declared at compile time in C is already in row-major order. You don’t have to do anything special to transform it. For example:

{
     fftw_complex data[N0][N1][N2];
     fftw_plan plan;
     ...
     plan = fftw_plan_dft_3d(N0, N1, N2, &data[0][0][0], &data[0][0][0],
                             FFTW_FORWARD, FFTW_ESTIMATE);
     ...
}
This will plan a 3d in-place transform of size N0 x N1 x N2. Notice how we took the address of the zero-th element to pass to the planner (we could also have used a typecast).

[링크 : https://www.fftw.org/fftw3_doc/Fixed_002dsize-Arrays-in-C.html]

[링크 : https://www.fftw.org/fftw3_doc/Multi_002ddimensional-Array-Format.html]

 

+

에라이 모르겠다 ㅠㅠ

     switch (sz->rnk) {
 case 1:
      if (p->sign < 0) {
   if (verbose > 2) printf("using plan_dft_r2c_1d\n");
   return FFTW(plan_dft_r2c_1d)(sz->dims[0].n, 
(bench_real *) p->in, 
(bench_complex *) p->out,
flags);
      }
      else {
   if (verbose > 2) printf("using plan_dft_c2r_1d\n");
   return FFTW(plan_dft_c2r_1d)(sz->dims[0].n, 
(bench_complex *) p->in, 
(bench_real *) p->out,
flags);
      }
      break;
 case 2:
      if (p->sign < 0) {
   if (verbose > 2) printf("using plan_dft_r2c_2d\n");
   return FFTW(plan_dft_r2c_2d)(sz->dims[0].n, sz->dims[1].n,
(bench_real *) p->in, 
(bench_complex *) p->out,
flags);
      }
      else {
   if (verbose > 2) printf("using plan_dft_c2r_2d\n");
   return FFTW(plan_dft_c2r_2d)(sz->dims[0].n, sz->dims[1].n,
(bench_complex *) p->in, 
(bench_real *) p->out,
flags);
      }
      break;
 case 3:
      if (p->sign < 0) {
   if (verbose > 2) printf("using plan_dft_r2c_3d\n");
   return FFTW(plan_dft_r2c_3d)(
sz->dims[0].n, sz->dims[1].n, sz->dims[2].n,
(bench_real *) p->in, (bench_complex *) p->out,
flags);
      }
      else {
   if (verbose > 2) printf("using plan_dft_c2r_3d\n");
   return FFTW(plan_dft_c2r_3d)(
sz->dims[0].n, sz->dims[1].n, sz->dims[2].n,
(bench_complex *) p->in, (bench_real *) p->out,
flags);
      }
      break;
 default: {
      int *n = mkn(sz);
      if (p->sign < 0) {
   if (verbose > 2) printf("using plan_dft_r2c\n");
   pln = FFTW(plan_dft_r2c)(sz->rnk, n,
    (bench_real *) p->in, 
    (bench_complex *) p->out,
    flags);
      }
      else {
   if (verbose > 2) printf("using plan_dft_c2r\n");
   pln = FFTW(plan_dft_c2r)(sz->rnk, n,
    (bench_complex *) p->in, 
    (bench_real *) p->out,
    flags);
      }
      bench_free(n);
      return pln;
 }
     }

[링크 : https://github.com/FFTW/fftw3/blob/master/tests/bench.c]

 

+

mpi 예제도 있음.

그런데 3d로 한다고 하니 어마어마하게 데이터가 필요할 것 같은데

단순하게 3축 데이터라면 엄청 큰 공간에 딱 3줄 넣는 식이 될텐데 어떻게 해야 할까?

    data = (FFTW_COMPLEX *) FFTW_MALLOC(sizeof(FFTW_COMPLEX) * NX*NY*NZ*sizeof(FFTW_COMPLEX));
    
    /* create plan for forward DFT */
    gettimeofday(&tv_start, NULL);
    plan = FFTW_PLAN_DFT_3D(NX, NY, NZ, data, data,
    FFTW_FORWARD, FFTW_ESTIMATE);
    gettimeofday(&tv_stop, NULL);
    deltaT =  tv_stop.tv_sec  - tv_start.tv_sec +
      1e-6 * (tv_stop.tv_usec - tv_start.tv_usec);
    printf("Plan init time (c2c)  : %f sec\n", deltaT);
    
    /* initialize data */
    for (i = 0; i < NX; ++i) {
      for (j = 0; j < NY; ++j) {
        for (k = 0; k < NZ; ++k) {
          data[(i*NY + j)*NZ + k][0] = (i*NY + j)*NZ + k;
          data[(i*NY + j)*NZ + k][1] = 0;
        }
      }
    }

[링크 : https://github.com/pkestene/simpleFFTW/blob/master/c/fftw_test_3d_serial.c]

 

+

암만봐도 2d나 3d fft는 어떻게 써야 할지 감도 안와서 사용 시도 자체를 포기!

'프로그램 사용 > fft, fftw' 카테고리의 다른 글

fft 잘못 사용하고 있었나?  (0) 2023.06.02
fft 라이브러리 목록  (0) 2023.06.01
fft phase 연산  (0) 2023.04.07
fftw input range?  (0) 2023.04.07
fft 복소수(complex) - 실수, 허수부(real, imaginary)  (0) 2023.04.07
Posted by 구차니

아래 명령은 openfoam221 쉘안에서 하니 되긴한데

openfoam2212:~/src/OpenFOAMTeaching/JozsefNagy/
minimonk$ fluentMeshToFoam elbow_tri.msh 
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2212                                  |
|   \\  /    A nd           | Website:  www.openfoam.com |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _f8e05934-20230403 OPENFOAM=2212 patch=230110 version=2212
Arch   : "LSB;label=32;scalar=64"
Exec   : fluentMeshToFoam elbow_tri.msh
Date   : May 24 2023
Time   : 16:38:06
Host   : mini2760p
PID    : 23712
I/O    : uncollated
Case   : /home/minimonk/src/OpenFOAMTeaching/JozsefNagy
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time



--> FOAM FATAL ERROR: (openfoam-2212 patch=230110)
cannot find file "/home/minimonk/src/OpenFOAMTeaching/JozsefNagy/system/controlDict"

    From virtual Foam::autoPtr<Foam::ISstream> Foam::fileOperations::uncollatedFileOperation::readStream(Foam::regIOobject&, const Foam::fileName&, const Foam::word&, bool) const
    in file global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C at line 561.

FOAM exiting

openfoam2212:~/src/OpenFOAMTeaching/JozsefNagy/
minimonk$ 

[링크 : https://youtu.be/KznljrgWSvo?t=1129]

[링크 : https://www.youtube.com/watch?v=KznljrgWSvo]

[링크 : https://openfoamwiki.net/index.php/Fluent3DMeshToFoam]

[링크 : https://github.com/jnmlujnmlu/OpenFOAMTeaching/tree/master/JozsefNagy]

 

 

$ openfoam
openfoam = /usr/lib/openfoam/openfoam2212

 * Using:     OpenFOAM-v2212 (2212) - visit www.openfoam.com
 * Build:     _f8e05934-20230403 (patch=230110)
 * Arch:      label=32;scalar=64
 * Platform:  linux64GccDPInt32Opt (mpi=sys-openmpi)

OpenFOAM shell session - use 'exit' to quit

openfoam2212:~/src/tutorials/incompressible/icoFoam/elbow_tri/
minimonk$ fluentMeshToFoam elbow_tri.msh 
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2212                                  |
|   \\  /    A nd           | Website:  www.openfoam.com |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _f8e05934-20230403 OPENFOAM=2212 patch=230110 version=2212
Arch   : "LSB;label=32;scalar=64"
Exec   : fluentMeshToFoam elbow_tri.msh
Date   : May 24 2023
Time   : 17:15:20
Host   : mini2760p
PID    : 24479
I/O    : uncollated
Case   : /home/minimonk/src/tutorials/incompressible/icoFoam/elbow_tri
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Reading header: "TGrid 2D 2.4.1"
Reading header: "PreBFC V4.3"
Dimension of grid: 2
Embedded blocks in comment or unknown: (
Embedded blocks in comment or unknown:(
Found end of section in unknown:) 
Embedded blocks in comment or unknown:(
Found end of section in unknown:)
Found end of section in unknown:)
Embedded blocks in comment or unknown: (
Embedded blocks in comment or unknown:(
Found end of section in unknown:)
Embedded blocks in comment or unknown:
(
Found end of section in unknown:)
Found end of section in unknown:)
Embedded blocks in comment or unknown: (
Embedded blocks in comment or unknown:(
Found end of section in unknown:)
Found end of section in unknown:)
Number of points: 537

number of faces: 1454
Number of cells: 918
Reading points
Reading points
Reading uniform faces
Reading uniform faces
Reading uniform faces
Reading uniform faces
Reading uniform faces
Reading uniform faces
Tgrid syntax problem: 9 1 396 1
cellGroupZoneID:9
cellGroupStartIndex:1
cellGroupEndIndex:918
cellGroupType:1
Read zone1:3 name:internal-3 patchTypeID:interior
Reading zone data
Read zone1:4 name:wall-4 patchTypeID:wall
Reading zone data
Read zone1:5 name:velocity-inlet-5 patchTypeID:velocity-inlet
Reading zone data
Read zone1:6 name:velocity-inlet-6 patchTypeID:velocity-inlet
Reading zone data
Read zone1:7 name:pressure-outlet-7 patchTypeID:pressure-outlet
Reading zone data
Read zone1:8 name:wall-8 patchTypeID:wall
Reading zone data
Read zone1:9 name:fluid-9 patchTypeID:fluid
Reading zone data


FINISHED LEXING


dimension of grid: 2
Grid is 2-D. Extruding in z-direction by: 1.87548
Creating shapes for 2-D cells
Building patch-less mesh...--> FOAM Warning : 
    From Foam::polyMesh::polyMesh(const Foam::IOobject&, Foam::pointField&&, const cellShapeList&, const faceListList&, const wordList&, const wordList&, const Foam::word&, const Foam::word&, const wordList&, bool)
    in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 645
    Found 1990 undefined faces in mesh; adding to default patch defaultFaces
done.

Building boundary and internal patches.
Creating patch 0 for zone: 3 start: 155 end: 1454 type: interior name: internal-3
Creating patch 1 for zone: 4 start: 55 end: 154 type: wall name: wall-4
Creating patch 2 for zone: 5 start: 47 end: 54 type: velocity-inlet name: velocity-inlet-5
Creating patch 3 for zone: 6 start: 43 end: 46 type: velocity-inlet name: velocity-inlet-6
Creating patch 4 for zone: 7 start: 35 end: 42 type: pressure-outlet name: pressure-outlet-7
Creating patch 5 for zone: 8 start: 1 end: 34 type: wall name: wall-8
Creating patch for front and back planes

Patch internal-3 is internal to the mesh  and is not being added to the boundary.
Adding new patch wall-4 of type wall as patch 0
Adding new patch velocity-inlet-5 of type patch as patch 1
Adding new patch velocity-inlet-6 of type patch as patch 2
Adding new patch pressure-outlet-7 of type patch as patch 3
Adding new patch wall-8 of type wall as patch 4
Adding new patch frontAndBackPlanes of type empty as patch 5

Writing mesh... to "constant/polyMesh"  done.


End

openfoam2212:~/src/tutorials/incompressible/icoFoam/elbow_tri/

minimonk$ tree
.
├── 0
│   ├── U
│   └── p
├── 0.orig
│   ├── U
│   └── p
├── Allclean
├── Allrun
├── constant
│   ├── polyMesh
│   │   ├── boundary
│   │   ├── cellZones
│   │   ├── faceZones
│   │   ├── faces
│   │   ├── neighbour
│   │   ├── owner
│   │   ├── pointZones
│   │   └── points
│   ├── transportProperties
│   └── transportProperties.bak
├── elbow_quad.msh
├── elbow_tri.msh
└── system
    ├── controlDict
    ├── foamDataToFluentDict
    ├── fvSchemes
    └── fvSolution

5 directories, 22 files
openfoam2212:~/src/tutorials/incompressible/icoFoam/elbow_tri/

minimonk$ ico
ico                                 icoReactingMultiphaseInterFoam      icoUncoupledKinematicParcelFoam     iconv                               
icoFoam                             icoUncoupledKinematicParcelDyMFoam  icontopbm                           iconvconfig                         
openfoam2212:~/src/tutorials/incompressible/icoFoam/elbow_tri/
minimonk$ icoFoam
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2212                                  |
|   \\  /    A nd           | Website:  www.openfoam.com |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _f8e05934-20230403 OPENFOAM=2212 patch=230110 version=2212
Arch   : "LSB;label=32;scalar=64"
Exec   : icoFoam
Date   : May 24 2023
Time   : 17:19:48
Host   : mini2760p
PID    : 24543
I/O    : uncollated
Case   : /home/minimonk/src/tutorials/incompressible/icoFoam/elbow_tri
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


PISO: Operating solver in PISO mode

Reading transportProperties

Reading field p

Reading field U

Reading/calculating face flux field phi


Starting time loop

Time = 0.05

Courant Number mean: 0.000415941 max: 0.173205
smoothSolver:  Solving for Ux, Initial residual = 1, Final residual = 2.59879e-07, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 1, Final residual = 2.7558e-06, No Iterations 1
DICPCG:  Solving for p, Initial residual = 1, Final residual = 0.036127, No Iterations 62
DICPCG:  Solving for p, Initial residual = 0.0964781, Final residual = 0.00388218, No Iterations 3
DICPCG:  Solving for p, Initial residual = 0.00947597, Final residual = 0.000467612, No Iterations 44
time step continuity errors : sum local = 7.42259e-05, global = 1.62183e-06, cumulative = 1.62183e-06
DICPCG:  Solving for p, Initial residual = 0.00302872, Final residual = 0.000137611, No Iterations 9
DICPCG:  Solving for p, Initial residual = 0.00040051, Final residual = 1.89259e-05, No Iterations 11
DICPCG:  Solving for p, Initial residual = 7.55534e-05, Final residual = 7.72999e-07, No Iterations 55
time step continuity errors : sum local = 1.18435e-07, global = 2.9852e-09, cumulative = 1.62482e-06
ExecutionTime = 0.01 s  ClockTime = 0 s

Time = 0.1

Courant Number mean: 0.0788444 max: 0.397028
smoothSolver:  Solving for Ux, Initial residual = 0.41777, Final residual = 1.43339e-06, No Iterations 2
smoothSolver:  Solving for Uy, Initial residual = 0.415998, Final residual = 7.16337e-06, No Iterations 2
DICPCG:  Solving for p, Initial residual = 0.0174141, Final residual = 0.000701295, No Iterations 60
DICPCG:  Solving for p, Initial residual = 0.503317, Final residual = 0.0203323, No Iterations 3
DICPCG:  Solving for p, Initial residual = 0.0837591, Final residual = 0.00367981, No Iterations 45
time step continuity errors : sum local = 6.59525e-05, global = -1.04379e-06, cumulative = 5.81027e-07
DICPCG:  Solving for p, Initial residual = 0.104572, Final residual = 0.00332569, No Iterations 58
DICPCG:  Solving for p, Initial residual = 0.257662, Final residual = 0.0119158, No Iterations 6
DICPCG:  Solving for p, Initial residual = 0.0349453, Final residual = 6.69377e-07, No Iterations 73
time step continuity errors : sum local = 1.96408e-09, global = -3.1581e-11, cumulative = 5.80996e-07
ExecutionTime = 0.02 s  ClockTime = 0 s

...

Time = 74.95

Courant Number mean: 0.0810354 max: 0.50158
smoothSolver:  Solving for Ux, Initial residual = 1.22107e-05, Final residual = 3.41265e-08, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 9.0529e-06, Final residual = 9.0529e-06, No Iterations 0
DICPCG:  Solving for p, Initial residual = 0.000279752, Final residual = 1.15931e-05, No Iterations 5
DICPCG:  Solving for p, Initial residual = 4.33362e-05, Final residual = 1.84484e-06, No Iterations 20
DICPCG:  Solving for p, Initial residual = 1.21591e-05, Final residual = 9.52858e-07, No Iterations 6
time step continuity errors : sum local = 2.40141e-10, global = 4.53557e-11, cumulative = 5.99696e-07
DICPCG:  Solving for p, Initial residual = 9.88006e-05, Final residual = 4.91478e-06, No Iterations 4
DICPCG:  Solving for p, Initial residual = 1.34255e-05, Final residual = 9.18873e-07, No Iterations 18
DICPCG:  Solving for p, Initial residual = 5.38886e-06, Final residual = 9.52181e-07, No Iterations 1
time step continuity errors : sum local = 2.39966e-10, global = -3.02947e-12, cumulative = 5.99693e-07
ExecutionTime = 6.25 s  ClockTime = 7 s

Time = 75

Courant Number mean: 0.0810354 max: 0.501578
smoothSolver:  Solving for Ux, Initial residual = 1.29443e-05, Final residual = 3.26777e-08, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 8.86138e-06, Final residual = 8.86138e-06, No Iterations 0
DICPCG:  Solving for p, Initial residual = 0.000425003, Final residual = 1.9758e-05, No Iterations 3
DICPCG:  Solving for p, Initial residual = 3.72637e-05, Final residual = 1.5002e-06, No Iterations 47
DICPCG:  Solving for p, Initial residual = 1.25032e-05, Final residual = 9.53705e-07, No Iterations 4
time step continuity errors : sum local = 2.40409e-10, global = -2.83052e-12, cumulative = 5.9969e-07
DICPCG:  Solving for p, Initial residual = 8.65794e-05, Final residual = 4.13674e-06, No Iterations 8
DICPCG:  Solving for p, Initial residual = 1.40349e-05, Final residual = 8.71206e-07, No Iterations 15
DICPCG:  Solving for p, Initial residual = 4.26225e-06, Final residual = 7.88447e-07, No Iterations 1
time step continuity errors : sum local = 1.98748e-10, global = -4.50203e-11, cumulative = 5.99645e-07
ExecutionTime = 6.26 s  ClockTime = 7 s

End

openfoam2212:~/src/tutorials/incompressible/icoFoam/elbow_tri/
minimonk$ 

 

여기는 연산하는 거고

이제 보는건  paraview를 쓰면 된다.

1. 좌측 상단의 폴더 눌러서 파일 열기

 

2. elbow_tri/system 디렉토리에서 파일을 모든 유형으로 선택하고 controlDict를 연다.

 

3. OpenFoam 유형으로 연다.

 

4. apply를 누른다.

(처음 열어 보면 그냥 wireframe만 나오는데, icoFoam 까지 하고 나서 다시 열면 색상이 보인다)

 

5. 상단에 U로 바꾸어 주고 재생 버튼을 누르면 75초간 시뮬레이션 한 결과가 재생된다.

 

오.. 신기해라(영혼 없음)

'프로그램 사용 > openFOAM' 카테고리의 다른 글

mpirun illegal instruction  (0) 2023.09.01
openFOAM + freecad + salome  (0) 2023.06.07
openfoam on ubuntu  (0) 2023.05.24
openFOAM tutorial  (4) 2023.05.24
openfoam7 on ubuntu 18.04  (0) 2020.08.09
Posted by 구차니

예전에는 직접 빌드했던것 같은데 이제 빌드된 바이너리도 배포하고 좋아졌네

curl https://dl.openfoam.com/add-debian-repo.sh | sudo bash
sudo apt-get update
sudo apt-get install openfoam2212-default
openfoam2212

[링크 : https://develop.openfoam.com/Development/openfoam/-/wikis/precompiled/debian]

 

헉.. 용량이.. 

$ sudo apt-get install openfoam2212-default
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다       
상태 정보를 읽는 중입니다... 완료
다음의 추가 패키지가 설치될 것입니다 :
  flex gfortran gfortran-7 libcgal-dev libcgal13 libfl-dev libfl2 libgfortran-7-dev libgmp-dev libgmpxx4ldbl libhwloc-dev
  libibverbs-dev libmpfr-dev libnuma-dev libopenmpi-dev libptscotch-6.0 libptscotch-dev libreadline-dev libscotch-6.0 libscotch-dev
  libtinfo-dev mpi-default-bin mpi-default-dev openfoam-selector openfoam2212 openfoam2212-common openfoam2212-dev
  openfoam2212-source openfoam2212-tools openfoam2212-tutorials
제안하는 패키지:
  bison flex-doc gfortran-multilib gfortran-doc gfortran-7-multilib gfortran-7-doc libgfortran4-dbg libcoarrays-dev libmpfi-dev
  libntl-dev gmp-doc libgmp10-doc libmpfr-doc openmpi-doc readline-doc gnuplot
다음 새 패키지를 설치할 것입니다:
  flex gfortran gfortran-7 libcgal-dev libcgal13 libfl-dev libfl2 libgfortran-7-dev libgmp-dev libgmpxx4ldbl libhwloc-dev
  libibverbs-dev libmpfr-dev libnuma-dev libopenmpi-dev libptscotch-6.0 libptscotch-dev libreadline-dev libscotch-6.0 libscotch-dev
  libtinfo-dev mpi-default-bin mpi-default-dev openfoam-selector openfoam2212 openfoam2212-common openfoam2212-default
  openfoam2212-dev openfoam2212-source openfoam2212-tools openfoam2212-tutorials
0개 업그레이드, 31개 새로 설치, 0개 제거 및 0개 업그레이드 안 함.
131 M바이트 아카이브를 받아야 합니다.
이 작업 후 767 M바이트의 디스크 공간을 더 사용하게 됩니다.
 

 

흐음.. 멀 어떻게 해야하나 막막하네?

나가는 방법은 exit

$ openfoam2212
openfoam = /usr/lib/openfoam/openfoam2212

 * Using:     OpenFOAM-v2212 (2212) - visit www.openfoam.com
 * Build:     _f8e05934-20230403 (patch=230110)
 * Arch:      label=32;scalar=64
 * Platform:  linux64GccDPInt32Opt (mpi=sys-openmpi)

OpenFOAM shell session - use 'exit' to quit

openfoam2212:~/
minimonk$ help
GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
쉘 명령어는 내부적으로 정의되어 있습니다.  'help'를 입력하면 목록이 보입니다.
`name' 함수에 대해 더 많은 것을 알아보려면 `help name' 을 입력하십시오.
일반적인 쉘에 대해서 더 많은 것을 알아보려면 `info bash' 를 사용하십시오.
목록에 없는 명령어에 대해 더 많은 것을 알아보려면 `man -k' 또는 `info'를 사용하십시오.

별표(*)가 옆에 있는 명령어는 사용할 수 없음을 의미합니다.

 job_spec [&]                                                       history [-c] [-d offset] [n] or history -anrw [filename] or his>
 (( expression ))                                                   if COMMANDS; then COMMANDS; [ elif COMMANDS; then COMMANDS; ]..>
 . filename [arguments]                                             jobs [-lnprs] [jobspec ...] or jobs -x command [args]
 :                                                                  kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or k>
 [ arg... ]                                                         let arg [arg ...]
 [[ expression ]]                                                   local [option] name[=value] ...
 alias [-p] [name[=value] ... ]                                     logout [n]
 bg [job_spec ...]                                                  mapfile [-d delim] [-n count] [-O origin] [-s count] [-t] [-u f>
 bind [-lpsvPSVX] [-m keymap] [-f filename] [-q name] [-u name] [>  popd [-n] [+N | -N]
 break [n]                                                          printf [-v var] format [arguments]
 builtin [shell-builtin [arg ...]]                                  pushd [-n] [+N | -N | dir]
 caller [expr]                                                      pwd [-LP]
 case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]... esac         read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nch>
 cd [-L|[-P [-e]] [-@]] [dir]                                       readarray [-n count] [-O origin] [-s count] [-t] [-u fd] [-C ca>
 command [-pVv] command [arg ...]                                   readonly [-aAf] [name[=value] ...] or readonly -p
 compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat] [-W>  return [n]
 complete [-abcdefgjksuv] [-pr] [-DE] [-o option] [-A action] [-G>  select NAME [in WORDS ... ;] do COMMANDS; done
 compopt [-o|+o option] [-DE] [name ...]                            set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
 continue [n]                                                       shift [n]
 coproc [NAME] command [redirections]                               shopt [-pqsu] [-o] [optname ...]
 declare [-aAfFgilnrtux] [-p] [name[=value] ...]                    source filename [arguments]
 dirs [-clpv] [+N] [-N]                                             suspend [-f]
 disown [-h] [-ar] [jobspec ... | pid ...]                          test [expr]
 echo [-neE] [arg ...]                                              time [-p] pipeline
 enable [-a] [-dnps] [-f filename] [name ...]                       times
 eval [arg ...]                                                     trap [-lp] [[arg] signal_spec ...]
 exec [-cl] [-a name] [command [arguments ...]] [redirection ...>   true
 exit [n]                                                           type [-afptP] name [name ...]
 export [-fn] [name[=value] ...] or export -p                       typeset [-aAfFgilnrtux] [-p] name[=value] ...
 false                                                              ulimit [-SHabcdefiklmnpqrstuvxPT] [limit]
 fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command>   umask [-p] [-S] [mode]
 fg [job_spec]                                                      unalias [-a] name [name ...]
 for NAME [in WORDS ... ] ; do COMMANDS; done                       unset [-f] [-v] [-n] [name ...]
 for (( exp1; exp2; exp3 )); do COMMANDS; done                      until COMMANDS; do COMMANDS; done
 function name { COMMANDS ; } or name () { COMMANDS ; }             variables - Names and meanings of some shell variables
 getopts optstring name [arg]                                       wait [-n] [id ...]
 hash [-lr] [-p pathname] [-dt] [name ...]                          while COMMANDS; do COMMANDS; done
 help [-dms] [pattern ...]                                          { COMMANDS ; }
openfoam2212:~/
minimonk$ quit

Command 'quit' not found, but can be installed with:

sudo snap install quit

openfoam2212:~/
minimonk$ exit
exit

 

'프로그램 사용 > openFOAM' 카테고리의 다른 글

openFOAM + freecad + salome  (0) 2023.06.07
openFOAM tutorial with youtube  (0) 2023.05.24
openFOAM tutorial  (4) 2023.05.24
openfoam7 on ubuntu 18.04  (0) 2020.08.09
openFOAM tutorial  (0) 2020.07.19
Posted by 구차니

한참 시도하다가 실패했던 openFOAM 사용예를 찾아보려는데

chatGPT 시대니까 한번 시도!

실행 예제:
OpenFOAM을 실행해보기 위해 예제 중 하나를 실행해보겠습니다. tutorials 디렉토리에는 다양한 예제가 포함되어 있습니다. 예를 들어, heatTransfer/buoyantSimpleFoam 디렉토리로 이동한 후 다음 명령을 실행하여 해당 예제를 실행합니다.

shell
Copy code
$ cd $FOAM_TUTORIALS/heatTransfer/buoyantSimpleFoam
$ blockMesh  # 메쉬 생성
$ buoyantSimpleFoam  # 시뮬레이션 실행
이 예제는 열전달과 대류 역학을 시뮬레이션하는 것으로, blockMesh로 메쉬를 생성한 후 buoyantSimpleFoam으로 시뮬레이션을 실행합니다. 실행 결과는 해당 디렉토리 내에 저장됩니다.

 

일단은 heatTransfer / buoyantSimpleFoam 

라는 키워드를 얻었으니 이걸 기반으로 역으로 추적해보면..

 

머.. 검은 건 글씨고 흰건 종이라는 건 변함없다.. -_ㅠ

[링크 : https://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2016/VarunVenkatesh/Varun_report.pdf]

[링크 : https://www.openfoam.com/documentation/guides/latest/doc/guide-applications-solvers-heat-transfer-buoyantSimpleFoam.html]

[링크 : https://cpp.openfoam.org/v4/dir_90706e5b82a3613c0a5b601bc80a6bc4.html]

 

+

bard에게 물어보니

OpenFOAM 워크벤츠 프로그램을 엽니다 라고 해서 찾아보니..

뜬금없이(?) freecad에 plugin이 튀어나온다.. bard가 나에게 맞말을 해주는게 아닌 느낌?

[링크 : https://wiki.freecad.org/Cfd_Workbench]

 

+

$ sudo find / -name cavity
/usr/lib/openfoam/openfoam2212/applications/test/mapDistributePolyMesh/cavity
/usr/lib/openfoam/openfoam2212/applications/test/volField/cavity
/usr/lib/openfoam/openfoam2212/tutorials/mesh/parallel/cavity
/usr/lib/openfoam/openfoam2212/tutorials/compressible/rhoPimpleFoam/RAS/cavity
/usr/lib/openfoam/openfoam2212/tutorials/preProcessing/createZeroDirectory/cavity
/usr/lib/openfoam/openfoam2212/tutorials/incompressible/icoFoam/cavity
/usr/lib/openfoam/openfoam2212/tutorials/incompressible/icoFoam/cavity/cavity
/usr/lib/openfoam/openfoam2212/tutorials/incompressible/pisoFoam/RAS/cavity

 

파일 경로는 찾았는데 실행 방법을 모르겠다 ㅠㅠ

[링크 :https://www.openfoam.com/documentation/tutorial-guide/2-incompressible-flow/2.1-lid-driven-cavity-flow#x6-60002.1]

[링크 : https://www.openfoam.com/documentation/tutorial-guide]

 

+

paraView 혹은 paraFoam이 먼진 모르겠는데.. 이거 맞나?

$ apt-cache search paraview
libxdmf3 - eXtensible Data Model and Format library
paraview - Parallel Visualization Application
paraview-dev - Parallel Visualization Application. Development header files
paraview-doc - Parallel Visualization Application. Comprehensive documentation
paraview-python - Parallel Visualization Application. python-support
rheolef - efficient Finite Element environment

$ sudo apt-get install paraview
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다       
상태 정보를 읽는 중입니다... 완료
다음의 추가 패키지가 설치될 것입니다 :
  cython libcgns3.3 libqt4-help libqt5positioning5 libqt5sensors5 libqt5webchannel5 libqt5webkit5 libtcl8.5 libvtk6.3-qt paraview-doc
  paraview-python python-attr python-autobahn python-automat python-cbor python-click python-colorama python-concurrent.futures
  python-constantly python-hyperlink python-incremental python-lz4 python-mpi4py python-nacl python-pam python-pyasn1
  python-pyasn1-modules python-qrcode python-serial python-service-identity python-snappy python-trie python-trollius python-twisted
  python-twisted-bin python-twisted-core python-txaio python-u-msgpack python-ubjson python-vtk6 python-wsaccel python-zope.interface
  tcl8.5
제안하는 패키지:
  cython-doc hdf5-tools h5utils python-attr-doc python-nacl-doc python-pam-dbg python-trie-doc python-twisted-bin-dbg python-glade2
  python-qt3 python-txaio-doc mayavi2 vtk6-doc vtk6-examples tcl-tclreadline
다음 새 패키지를 설치할 것입니다:
  cython libcgns3.3 libqt4-help libqt5positioning5 libqt5sensors5 libqt5webchannel5 libqt5webkit5 libtcl8.5 libvtk6.3-qt paraview
  paraview-doc paraview-python python-attr python-autobahn python-automat python-cbor python-click python-colorama
  python-concurrent.futures python-constantly python-hyperlink python-incremental python-lz4 python-mpi4py python-nacl python-pam
  python-pyasn1 python-pyasn1-modules python-qrcode python-serial python-service-identity python-snappy python-trie python-trollius
  python-twisted python-twisted-bin python-twisted-core python-txaio python-u-msgpack python-ubjson python-vtk6 python-wsaccel
  python-zope.interface tcl8.5
0개 업그레이드, 44개 새로 설치, 0개 제거 및 0개 업그레이드 안 함.
61.2 M바이트 아카이브를 받아야 합니다.
이 작업 후 286 M바이트의 디스크 공간을 더 사용하게 됩니다.
계속 하시겠습니까? [Y/n] 

[링크 : https://www.openfoam.com/documentation/user-guide/7-post-processing/7.1-parafoam]

'프로그램 사용 > openFOAM' 카테고리의 다른 글

openFOAM tutorial with youtube  (0) 2023.05.24
openfoam on ubuntu  (0) 2023.05.24
openfoam7 on ubuntu 18.04  (0) 2020.08.09
openFOAM tutorial  (0) 2020.07.19
openFOAM 우분투 패키지  (0) 2020.07.18
Posted by 구차니