Skip to content

Commit

Permalink
Post: cleanup fortran
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit128 committed Oct 23, 2024
1 parent 2196679 commit 0a6ef16
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 140 deletions.
56 changes: 0 additions & 56 deletions Cassiopee/Post/Post/Fortran/ComputePressureF.for

This file was deleted.

55 changes: 0 additions & 55 deletions Cassiopee/Post/Post/Fortran/ComputeVelocityF.for

This file was deleted.

8 changes: 1 addition & 7 deletions Cassiopee/Post/Post/Stream/stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,7 @@ extern "C"
void k6compmeanlengthoftetracell_(E_Int& npts, E_Int& indA, E_Int& indB,
E_Int& indC, E_Int& indD,
E_Float* xt, E_Float* yt, E_Float* zt,
E_Float& meanl);

void k6computevelocity_(const E_Int& npts, const E_Int& neq,
const E_Int& posro,
const E_Int& posrou, const E_Int& posrov,
const E_Int& posrow,
const E_Float* field, E_Float* velo);
E_Float& meanl);
}

//=============================================================================
Expand Down
64 changes: 44 additions & 20 deletions Cassiopee/Post/Post/computeVariables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,46 @@
using namespace K_FLD;
using namespace std;

extern "C"
//=============================================================================
void computeVelocity__(E_Int npts,
const E_Float* ro, const E_Float* rou, const E_Float* rov, const E_Float* row,
E_Float* vx, E_Float* vy, E_Float* vz)
{
#pragma omp parallel
{
E_Float roi;
#pragma omp for
for (E_Int i = 0; i < npts; i++)
{
roi = 1. / ro[i];
vx[i] = rou[i] * roi;
vy[i] = rov[i] * roi;
vz[i] = row[i] * roi;
}
}
}

//=============================================================================
void computePressure__(E_Int npts, E_Float gamma,
const E_Float* vx, const E_Float* vy, const E_Float* vz,
const E_Float* ro, const E_Float* roe,
E_Float* p)
{
void k6computevelocity_(const E_Int& npts, const E_Int& neq,
const E_Int& posro,
const E_Int& posrou, const E_Int& posrov,
const E_Int& posrow,
const E_Float* field,
E_Float* velo);

void k6computepressure_(const E_Int& cellt,const E_Float& gamma,
const E_Float* velo,
const E_Float* ro, const E_Float* roe,
E_Float* p);
E_Float gam1 = gamma - 1.;
E_Float ONEHALF = 0.5;

#pragma omp parallel
{
E_Float vx2, vy2, vz2;
#pragma omp for
for (E_Int i = 0; i < npts; i++)
{
vx2 = vx[i] * vx[i];
vy2 = vy[i] * vy[i];
vz2 = vz[i] * vz[i];
p[i] = gam1 * (roe[i]-ONEHALF*ro[i]*(vx2 + vy2 + vz2));
}
}
}

//=============================================================================
Expand Down Expand Up @@ -693,7 +720,7 @@ E_Int K_POST::computeCompVariables2(const FldArrayF& f, const E_Int posro,
GAM6;
#pragma omp parallel
{
E_Float ro, vx, vy, vz, p, t, h;
E_Float ro, p, t, vx, vy, vz, h;
#pragma omp for
for (E_Int i = 0; i < npts; i++)
{
Expand Down Expand Up @@ -803,12 +830,10 @@ void K_POST::computeVelocity(const FldArrayF& f,
{
if (velo.getSize() != 0) return; // deja calcule
E_Int npts = f.getSize();
E_Int nfld = f.getNfld();

velo.malloc(npts, 3);
k6computevelocity_(npts, nfld,
posro, posrou, posrov, posrow,
f.begin(), velo.begin());
computeVelocity__(npts, f.begin(posro), f.begin(posrou), f.begin(posrov), f.begin(posrow),
velo.begin(1), velo.begin(2), velo.begin(3));
}

//=============================================================================
Expand All @@ -832,9 +857,8 @@ void K_POST::computePressure(const FldArrayF& f,
computeVelocity(f, posro, posrou, posrov, posrow, velo);

// calcul de p = gam1 * roe, e energie interne
k6computepressure_(npts, gamma, velo.begin(),
f.begin(posro), f.begin(posroe),
press.begin());
computePressure__(npts, gamma, velo.begin(1), velo.begin(2), velo.begin(3),
f.begin(posro), f.begin(posroe), press.begin());
}

//=============================================================================
Expand Down
2 changes: 0 additions & 2 deletions Cassiopee/Post/srcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@
'Post/Fortran/IntegMomentNormUnstrF.for',
'Post/Fortran/IntegMomentStructF.for',
'Post/Fortran/IntegMomentUnstrF.for',
'Post/Fortran/ComputeVelocityF.for',
'Post/Fortran/ComputePressureF.for',
'Post/Fortran/CompMeanCurlOfStructCellF.for',
'Post/Fortran/CompMeanCurlOfTetraCellF.for',
'Post/Fortran/CompInterfaceFieldF.for',
Expand Down

0 comments on commit 0a6ef16

Please sign in to comment.