Foam::tmp<GeoField> Foam::uniformInterpolate ( const IOobject& fieldIO, const word& fieldName, const wordList& times, const scalarField& weights, const objectRegistry& fieldsCache ) { // Look up the first field const objectRegistry& time0Fields = fieldsCache.lookupObject < const objectRegistry > ( times[0] ); const GeoField& field0 = time0Fields.lookupObject < const GeoField > ( fieldName ); // Interpolate tmp<GeoField> tfld(new GeoField(fieldIO, weights[0]*field0)); GeoField& fld = tfld.ref(); for (label i = 1; i < times.size(); ++i) { const objectRegistry& timeIFields = fieldsCache.lookupObject < const objectRegistry > ( times[i] ); const GeoField& fieldI = timeIFields.lookupObject < const GeoField > ( fieldName ); fld += weights[i]*fieldI; } return tfld; }
Foam::tmp<Foam::symmTensorField> Foam::STARCDCoordinateRotation:: transformVector ( const vectorField& st ) const { tmp<symmTensorField> tfld(new symmTensorField(st.size())); symmTensorField& fld = tfld.ref(); forAll(fld, i) { fld[i] = transformPrincipal(R_, st[i]); }
Foam::tmp<Foam::Field<Type> > Foam::pointToPointPlanarInterpolation::interpolate ( const Field<Type>& sourceFld ) const { tmp<Field<Type> > tfld(new Field<Type>(nearestVertex_.size())); Field<Type>& fld = tfld(); forAll(fld, i) { const FixedList<label, 3>& verts = nearestVertex_[i]; const FixedList<scalar, 3>& w = nearestVertexWeight_[i]; if (verts[2] == -1) { if (verts[1] == -1) { // Use vertex0 only fld[i] = sourceFld[verts[0]]; } else { // Use vertex 0,1 fld[i] = w[0]*sourceFld[verts[0]] + w[1]*sourceFld[verts[1]]; } } else { fld[i] = w[0]*sourceFld[verts[0]] + w[1]*sourceFld[verts[1]] + w[2]*sourceFld[verts[2]]; } } return tfld; }
volScalarField dynOneEqEddy::ce ( const volSymmTensorField& D, const volScalarField& KK ) const { const volScalarField ce ( simpleFilter_(nuEff()*(filter_(magSqr(D)) - magSqr(filter_(D)))) /simpleFilter_(pow(KK, 1.5)/(2.0*delta())) ); tmp<volScalarField> tfld = 0.5*(mag(ce) + ce); return tfld(); }
volScalarField dynamicKEqn<BasicTurbulenceModel>::Ce ( const volSymmTensorField& D, const volScalarField& KK ) const { const volScalarField Ce ( simpleFilter_(this->nuEff()*(filter_(magSqr(D)) - magSqr(filter_(D)))) /simpleFilter_(pow(KK, 1.5)/(2.0*this->delta())) ); tmp<volScalarField> tfld = 0.5*(mag(Ce) + Ce); return tfld(); }
bool Foam::volFieldStreamReconstructor<Type>::reconstruct ( const IOobject& io, const bool, Ostream& os ) const { typedef GeometricField<Type, unallocatedFvPatchField, unallocatedVolMesh> GeoField; // Retrieve from polyMesh const uFieldReconstructor& reconstructor = uFieldReconstructor::New(io.db()); const PtrList<unallocatedFvMesh>& procMeshes = reconstructor.procMeshes(); Info<< "Reconstructing " << io.objectPath() << endl; // Read field on proc meshes PtrList<GeoField> procFields(procMeshes.size()); forAll(procFields, proci) { const unallocatedFvMesh& procMesh = procMeshes[proci]; Pout<< incrIndent; procFields.set ( proci, new GeoField ( IOobject ( io.name(), io.instance(), io.local(), procMesh.thisDb(), IOobject::MUST_READ, IOobject::NO_WRITE, false ), procMesh ) ); Pout<< decrIndent; } // Fix filtering of empty nonuniform entries reconstructor.reconstructor().fixGenericNonuniform < GeoField, unallocatedGenericFvPatchField<Type> >(procFields); // Map local field onto baseMesh const unallocatedFvMesh& baseMesh = reconstructor.baseMesh(); tmp<GeoField> tfld ( reconstructor.reconstructor().reconstructFvVolumeField ( IOobject ( io.name(), io.instance(), io.local(), baseMesh.thisDb(), IOobject::NO_READ, IOobject::AUTO_WRITE, false ), procFields ) ); Pout<< incrIndent; os << tfld(); Pout<< decrIndent; return os.good(); }