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

  1. 2023.05.30 ssh ecdsa 미지원(ubuntu 22.04)
  2. 2023.05.27 fftw 다차원 분석
  3. 2023.05.24 openFOAM tutorial with youtube
  4. 2023.05.24 openfoam on ubuntu
  5. 2023.05.24 openFOAM tutorial 4
  6. 2023.04.17 semgrep
  7. 2023.04.17 cppcheck 사용
  8. 2023.04.10 gstremaer videobox + videomixer
  9. 2023.04.07 fft phase 연산
  10. 2023.04.07 fftw input range?

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 구차니
프로그램 사용/clang2023. 4. 17. 12:09

c 외에 go 등을 정적분석해주는 툴을 찾아보는데 걸려 나온(?) 툴

python 패키지로 깔려서 apt로 지원하진 않는다.

$ pip3 install semgrep

[링크 : https://freernd.tistory.com/entry/Semgrep-CLI-설치-실행-방법]

 

Initial release February 6, 2020; 3 years ago[1]
Stable release 1.16.0 Edit this on Wikidata / March 31, 2023; 17 days ago [2]
Repository github.com/returntocorp/semgrep Edit this at Wikidata
Written in OCaml (core) and Python (CLI)

[링크 : https://en.wikipedia.org/wiki/Semgrep#Services]

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

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

cppcheck 사용  (0) 2023.04.17
clang 으로 컴파일  (0) 2015.08.03
clang on ubnutu  (0) 2015.08.03
llvm / clang / cppcheck  (0) 2015.02.21
Posted by 구차니
프로그램 사용/clang2023. 4. 17. 11:11

그냥 옵션주면 밋밋(?)한데

--enable=all 주면 조금 더 나오긴 한다.

 

$ cppcheck
Cppcheck - A tool for static C/C++ code analysis

Syntax:
    cppcheck [OPTIONS] [files or paths]

If a directory is given instead of a filename, *.cpp, *.cxx, *.cc, *.c++, *.c,
*.tpp, and *.txx files are checked recursively from the given directory.

Options:
/// 생략 ///

Example usage:
  # Recursively check the current folder. Print the progress on the screen and
  # write errors to a file:
  cppcheck . 2> err.txt

  # Recursively check ../myproject/ and don't print progress:
  cppcheck --quiet ../myproject/

  # Check test.cpp, enable all checks:
  cppcheck --enable=all --inconclusive --std=posix test.cpp

  # Check f.cpp and search include files from inc1/ and inc2/:
  cppcheck -I inc1/ -I inc2/ f.cpp

For more information:
    http://cppcheck.net/manual.pdf

[링크 : https://int-i.github.io/cpp/2023-01-07/cppcheck/]

 

여전히 좀 밋밋(?)한데 규칙을 지정해서 하는법 없나?

(information) Cppcheck cannot find all the include files (use --check-config for details)

 

misra 룰을 빼낼 법을 찾아야...

[링크 : https://ppiazi.tistory.com/entry/MISRA-C2012-를-위한-CppCheck-사용]

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

semgrep  (0) 2023.04.17
clang 으로 컴파일  (0) 2015.08.03
clang on ubnutu  (0) 2015.08.03
llvm / clang / cppcheck  (0) 2015.02.21
Posted by 구차니

videobox를 이용해서 어느정도는 원하는 위치로 옮길순 있는데 자유자재로 옮기긴 힘든 듯?

gst-launch-1.0 \
   videotestsrc pattern=1 ! \
   video/x-raw,format=AYUV,framerate=\(fraction\)10/1,width=100,height=100 ! \
   videobox border-alpha=0 top=-70 bottom=-70 right=-220 ! \
   videomixer name=mix sink_0::alpha=0.7 sink_1::alpha=0.5 ! \
   videoconvert ! xvimagesink \
   videotestsrc ! \
   video/x-raw,format=AYUV,framerate=\(fraction\)5/1,width=320,height=240 ! mix.

[링크 : https://gstreamer.freedesktop.org/documentation/videomixer/index.html?gi-language=c]

 

bottom 
“bottom” gint
Pixels to box at bottom (<0 = add a border)
Flags : Read / Write
Default value : 0

left 
“left” gint
Pixels to box at left (<0 = add a border)
Flags : Read / Write
Default value : 0

right 
“right” gint
Pixels to box at right (<0 = add a border)
Flags : Read / Write
Default value : 0

top 
“top” gint
Pixels to box at top (<0 = add a border)
Flags : Read / Write
Default value : 0

[링크 : https://gstreamer.freedesktop.org/documentation/videobox/index.html?gi-language=c]

 

ximagesink 에다가 sync=false 하니 프레임이 잘 나온다.

videomixer가 더 앞에 있으니 videomixer에 sync=false를 넣어야 할 줄 알았는데 의외네

$ gst-launch-1.0 v4l2src device=/dev/video2 ! jpegdec ! videomixer name=mix ! videoconvert ! ximagesink sync=false v4l2src device=/dev/video0 ! jpegdec ! mix.

[링크 : https://stackoverflow.com/questions/38392956/gstreamer-videomixer-very-low-framerate]

 

 

$ gst-launch-1.0 \
v4l2src device=/dev/video2 ! jpegdec ! \
videobox top=0 bottom=0 left=-960 ! \
videomixer name=mix sink_0::alpha=1 sink_1::alpha=1 ! \
videoconvert ! \
ximagesink window-width=1920 window-height=1080 sync=false \
v4l2src device=/dev/video0 ! jpegdec ! \
videobox top=0 bottom=0 ! mix.

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

nnstreamer  (0) 2023.12.20
gst-device-monitor-1.0  (0) 2023.12.06
gst-inspector.c  (0) 2023.04.06
gstreamer videomixer 반쪽 성공  (0) 2023.03.27
gstreamer videomixer ... 2?  (0) 2023.03.27
Posted by 구차니

x 축은 real(실수)

y 축은 imagenary(허수)

그래서 arctan(허수/실수) 하면 각도를 radian으로 구할수 있다.

 

javascript 기준으로는

Math.atan() * 180 / Math.PI 하면 각도로 전환가능

θ = tan- 1 (b/a)

[링크 : http://sites.music.columbia.edu/cmc/MusicAndComputers/popups/chapter3/xbit_3_3.php]

 

역시나 언제나 그렇듯 radian 값

[링크 : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan]

[링크 : https://velog.io/@davelee/arctan을-활용한-각도구하기]

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

fft 라이브러리 목록  (0) 2023.06.01
fftw 다차원 분석  (0) 2023.05.27
fftw input range?  (0) 2023.04.07
fft 복소수(complex) - 실수, 허수부(real, imaginary)  (0) 2023.04.07
fft 0 Hz  (2) 2023.04.05
Posted by 구차니

 

chatGPT는 아래와 같이 대답을 하는데 근거가 없어서 불안하고

The input float range for FFTW depends on the specific implementation and the configuration of the library. However, in general, the input float values should be within the range of -1.0 to 1.0, which represents the normalized range of the input signal.

 

stackoverflow는 과거 글이긴 한데.. 미묘..

Surprisingly there is no single agreed definition for the FFT and the IFFT, at least as far as scaling is concerned, but for most implementations (including FFTW) you need to scale by 1/N in the forward direction, and there is no scaling in the reverse direction.

Usually (for performance reasons) you will want to lump this scaling factor in with any other corrections, such as your A/D gain, window gain correction factor, etc, so that you just have one combined scale factor to apply to your FFT output bins. Alternatively if you are just generating, say, a power spectrum in dB then you can make the correction a single dB value that you subtract from your power spectrum bins.

[링크 : https://stackoverflow.com/questions/4855958/normalising-fft-data-fftw]

 

 

일단은 실험!

1. 원본 데이터 그대로

+-1V / 1.001Khz

-600,000 ~ +600,000 범위로 들어오는 값을 그대~~~로 FFT로 던지니 결과가 이상하게 나온다.

 

2. 원본 / 1000

범위를 벗어나진 않아서 그런가 정상적으로 그나마 주파수 분석이 되는 듯

3. 원본 / 100

/ 1000 이랑 비슷하긴 한데 비율 때문에 그런가 중심 주파수 주변에 좀 높게 나온다.

그냥 나누기 만큼의 억제효과가 나오는 듯?

 

4. 원본 / 838607 (0x7FFFFF 왜 이런 값을 했지.. 홀렸나..)

 

주파수 분석결과를 확대해보면 /1000 보단 깨끗하게 분석된다.

 

5. 원본 + 100mV

FFT 값에 2,147,483이 나와서 16진수로 바꾸어 보니 0x20C49B

무슨 의미를 지닌 분석이라고 보기 힘든데 그래도 1000 근처에 좀 비어있는거 보면 어떻게 해석해야 하나 싶다.

 

6. 원본 / 24bit(0xFFFFFF)

 

아 몰랑 걍 -1.0 ~ 1.0 사이로 정규화 할래!

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

fftw 다차원 분석  (0) 2023.05.27
fft phase 연산  (0) 2023.04.07
fft 복소수(complex) - 실수, 허수부(real, imaginary)  (0) 2023.04.07
fft 0 Hz  (2) 2023.04.05
partial fft  (0) 2023.04.04
Posted by 구차니