forAll boundary
-
自定义了Sb,防止越界,对边界的值进行修正:
forAll(Sb.boundaryField(), patchI) { forAll (Sb.boundaryField()[patchI],facei) { if(Sb.boundaryField()[patchI][facei] < 0.001) { Sb.boundaryField()[patchI][facei] = 0.001; } } }
wmake失败:
error: assignment of read-only location ‘(&(& Sb.Foam::GeometricField<Type, PatchField, GeoMesh>::boundaryField<double, Foam::fvPatchField, Foam::volMesh>())->Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::Boundary::<anonymous>.Foam::FieldField<Foam::fvPatchField, double>::<anonymous>.Foam::PtrList<Foam::fvPatchField<double> >::<anonymous>.Foam::UPtrList<T>::operator[]<Foam::fvPatchField<double> >(patchI))->Foam::fvPatchField<double>::<anonymous>.Foam::Field<double>::<anonymous>.Foam::List<double>::<anonymous>.Foam::UList<T>::operator[]<double>(facei)’ Sb.boundaryField()[patchI][facei] = 0.001;
错在哪里啊?