Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions applications/solvers/dfLowMachFoam/EEqn.H
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@
// prepare data on CPU
start1 = std::clock();
start2 = std::clock();
const tmp<volScalarField> alphaEff_tmp(turbulence->alphaEff());
const volScalarField& alphaEff = alphaEff_tmp();
// const tmp<volScalarField> alphaEff_tmp(thermo.alpha());
// const volScalarField& alphaEff = alphaEff_tmp();
double *alphaEff = nullptr; // tmp
end2 = std::clock();
int eeqn_offset = 0;
int patchNum = 0;
Expand All @@ -52,10 +53,10 @@
int patchSize = pw.size();

const scalarField& patchK = K.boundaryField()[patchi];
const scalarField& patchAlphaEff = alphaEff.boundaryField()[patchi];
// const scalarField& patchAlphaEff = alphaEff.boundaryField()[patchi];
const scalarField& patchGrad = he.boundaryField()[patchi].gradientBoundaryCoeffs(); // gradient_
memcpy(boundary_K + eeqn_offset, &patchK[0], patchSize*sizeof(double));
memcpy(boundary_alphaEff + eeqn_offset, &patchAlphaEff[0], patchSize*sizeof(double));
// memcpy(boundary_alphaEff + eeqn_offset, &patchAlphaEff[0], patchSize*sizeof(double));
memcpy(boundary_gradient + eeqn_offset, &patchGrad[0], patchSize*sizeof(double));

eeqn_offset += patchSize;
Expand All @@ -70,7 +71,7 @@

// prepare data on GPU
start1 = std::clock();
EEqn_GPU.prepare_data(&he.oldTime()[0], &K[0], &K.oldTime()[0], &alphaEff[0],
EEqn_GPU.prepare_data(&he.oldTime()[0], &K[0], &K.oldTime()[0], alphaEff,
&dpdt[0], boundary_K, boundary_alphaEff, boundary_gradient);
EEqn_GPU.sync();
end1 = std::clock();
Expand Down
21 changes: 10 additions & 11 deletions applications/solvers/dfLowMachFoam/YEqn.H
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,27 @@ time_monitor_YEqn_solve += double(end1 - start1) / double(CLOCKS_PER_SEC);
if (updateBoundaryFields)
{
cudaMallocHost(&boundary_Y[i], num_boundary_faces*sizeof(double));
Info << "here" << endl;
}
const volScalarField& haii = chemistry->hai(i);
const volScalarField& rhoDi = chemistry->rhoD(i);
hai[i] = &haii[0];
rhoD[i] = &rhoDi[0];
cudaMallocHost(&boundary_hai[i], num_boundary_faces*sizeof(double));
cudaMallocHost(&boundary_rhoD[i], num_boundary_faces*sizeof(double));
// const volScalarField& haii = chemistry->hai(i);
// const volScalarField& rhoDi = chemistry->rhoD(i);
// hai[i] = &haii[0];
// rhoD[i] = &rhoDi[0];
// cudaMallocHost(&boundary_hai[i], num_boundary_faces*sizeof(double));
// cudaMallocHost(&boundary_rhoD[i], num_boundary_faces*sizeof(double));
int offset = 0;
forAll(Yi.boundaryField(), patchi)
{
const scalarField& patchYi = Yi.boundaryField()[patchi];
const scalarField& patchHaii = haii.boundaryField()[patchi];
const scalarField& patchRhoDi = rhoDi.boundaryField()[patchi];
// const scalarField& patchHaii = haii.boundaryField()[patchi];
// const scalarField& patchRhoDi = rhoDi.boundaryField()[patchi];
int patchSize = patchYi.size();

if (updateBoundaryFields)
{
memcpy(boundary_Y[i] + offset, &patchYi[0], patchSize*sizeof(double));
}
memcpy(boundary_hai[i] + offset, &patchHaii[0], patchSize*sizeof(double));
memcpy(boundary_rhoD[i] + offset, &patchRhoDi[0], patchSize*sizeof(double));
// memcpy(boundary_hai[i] + offset, &patchHaii[0], patchSize*sizeof(double));
// memcpy(boundary_rhoD[i] + offset, &patchRhoDi[0], patchSize*sizeof(double));
offset += patchSize;
}
}
Expand Down
3 changes: 2 additions & 1 deletion applications/solvers/dfLowMachFoam/dfLowMachFoam.C
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Description
#include "upwind.H"

#define GPUSolver_
//#define CPUSolver_
// #define CPUSolver_

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Expand Down Expand Up @@ -287,6 +287,7 @@ int main(int argc, char *argv[])
Info<< "U Equations = " << time_monitor_U << " s" << endl;
Info<< "Y Equations = " << time_monitor_Y << " s" << endl;
Info<< "E Equations = " << time_monitor_E << " s" << endl;
Info<< "percentage of rho/U/Y/E = " << (time_monitor_E + time_monitor_Y + time_monitor_U + time_monitor_rho) / loop_time * 100 << " %" << endl;
Info<< "p Equations = " << time_monitor_p << " s" << endl;
Info<< "chemistry correctThermo = " << time_monitor_chemistry_correctThermo << " s" << endl;
Info<< "turbulence correct = " << time_monitor_turbulence_correct << " s" << endl;
Expand Down
Loading