void Foam::epsilonWallFunctionFvPatchScalarField::createAveragingWeights() { const volScalarField& epsilon = static_cast<const volScalarField&>(this->internalField()); const volScalarField::Boundary& bf = epsilon.boundaryField(); const fvMesh& mesh = epsilon.mesh(); if (initialised_ && !mesh.changing()) { return; } volScalarField weights ( IOobject ( "weights", mesh.time().timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE, false // do not register ), mesh, dimensionedScalar(dimless, 0) ); DynamicList<label> epsilonPatches(bf.size()); forAll(bf, patchi) { if (isA<epsilonWallFunctionFvPatchScalarField>(bf[patchi])) { epsilonPatches.append(patchi); const labelUList& faceCells = bf[patchi].patch().faceCells(); forAll(faceCells, i) { weights[faceCells[i]]++; } } } cornerWeights_.setSize(bf.size()); forAll(epsilonPatches, i) { label patchi = epsilonPatches[i]; const fvPatchScalarField& wf = weights.boundaryField()[patchi]; cornerWeights_[patchi] = 1.0/wf.patchInternalField(); }
void epsilonWallFunctionFvPatchScalarField::createAveragingWeights() { const volScalarField& epsilon = static_cast<const volScalarField&>(this->dimensionedInternalField()); const volScalarField::GeometricBoundaryField& bf = epsilon.boundaryField(); const fvMesh& mesh = epsilon.mesh(); if (initialised_ && !mesh.changing()) { return; } volScalarField weights ( IOobject ( "weights", mesh.time().timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE, false // do not register ), mesh, dimensionedScalar("zero", dimless, 0.0) ); DynamicList<label> epsilonPatches(bf.size()); forAll(bf, patchi) { if (isA<epsilonWallFunctionFvPatchScalarField>(bf[patchi])) { epsilonPatches.append(patchi); /* forAll(faceCells, i) { weights[faceCells[i]]++; } */ const labelgpuList& pcells = mesh.lduAddr().patchSortCells(patchi); const labelgpuList& losortStart = mesh.lduAddr().patchSortStartAddr(patchi); thrust::transform ( thrust::make_permutation_iterator ( weights.getField().begin(), pcells.begin() ), thrust::make_permutation_iterator ( weights.getField().begin(), pcells.end() ), thrust::make_transform_iterator ( thrust::make_zip_iterator(thrust::make_tuple ( losortStart.begin(), losortStart.begin()+1 )), epsilonWallFunctionFvPatchScalarFieldCreateWeightsFunctor() ), thrust::make_permutation_iterator ( weights.getField().begin(), pcells.begin() ), addOperatorFunctor<scalar,label,scalar>() ); } } cornerWeights_.setSize(bf.size()); forAll(epsilonPatches, i) { label patchi = epsilonPatches[i]; const fvPatchScalarField& wf = weights.boundaryField()[patchi]; cornerWeights_[patchi] = 1.0/wf.patchInternalField(); }