diff --git a/src/genericPatchFields/genericFaPatchField/genericFaPatchField.C b/src/genericPatchFields/genericFaPatchField/genericFaPatchField.C
index 1a7d060a67f6f23785ab0ddd78a4d29886cd4210..16fe9f6d658155faaa8867b4b736a9e4e0bf7c90 100644
--- a/src/genericPatchFields/genericFaPatchField/genericFaPatchField.C
+++ b/src/genericPatchFields/genericFaPatchField/genericFaPatchField.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           |
+    \\  /    A nd           | Copyright (C) 2019 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
                             | Copyright (C) 2011-2016 OpenFOAM Foundation
@@ -59,19 +59,20 @@ Foam::genericFaPatchField<Type>::genericFaPatchField
     actualTypeName_(dict.get<word>("type")),
     dict_(dict)
 {
+    const label patchSize = this->size();
+
     if (!dict.found("value"))
     {
         FatalIOErrorInFunction(dict)
-            << "\n    Cannot find 'value' entry"
+            << nl << "    Cannot find 'value' entry"
             << " on patch " << this->patch().name()
             << " of field " << this->internalField().name()
-            << " in file " << this->internalField().objectPath()
-            << nl
+            << " in file " << this->internalField().objectPath() << nl
             << "    which is required to set the"
                " values of the generic patch field." << nl
-            << "    (Actual type " << actualTypeName_ << ")" << nl
-            << "\n    Please add the 'value' entry to the write function "
-               "of the user-defined boundary-condition\n"
+            << "    (Actual type " << actualTypeName_ << ')' << nl << nl
+            << "    Please add the 'value' entry to the write function"
+               " of the user-defined boundary-condition" << nl
             << exit(FatalIOError);
     }
 
@@ -79,338 +80,329 @@ Foam::genericFaPatchField<Type>::genericFaPatchField
     {
         const keyType& key = dEntry.keyword();
 
-        if (key != "type" && key != "value")
+        if
+        (
+            key == "type"
+         || key == "value"
+         || !dEntry.isStream() || dEntry.stream().empty()
+        )
+        {
+            continue;
+        }
+
+
+        ITstream& is = dEntry.stream();
+
+        // Read first token
+        token firstToken(is);
+
+        if
+        (
+            firstToken.isWord()
+         && firstToken.wordToken() == "nonuniform"
+        )
         {
-            if
+            token fieldToken(is);
+
+            if (!fieldToken.isCompound())
+            {
+                if
+                (
+                    fieldToken.isLabel()
+                 && fieldToken.labelToken() == 0
+                )
+                {
+                    scalarFields_.insert(key, autoPtr<scalarField>::New());
+                }
+                else
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    token following 'nonuniform' "
+                           "is not a compound"
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+            }
+            else if
             (
-                dEntry.isStream()
-             && dEntry.stream().size()
+                fieldToken.compoundToken().type()
+             == token::Compound<List<scalar>>::typeName
             )
             {
-                ITstream& is = dEntry.stream();
+                auto fPtr = autoPtr<scalarField>::New();
 
-                // Read first token
-                token firstToken(is);
+                fPtr->transfer
+                (
+                    dynamicCast<token::Compound<List<scalar>>>
+                    (
+                        fieldToken.transferCompoundToken(is)
+                    )
+                );
 
-                if
+                if (fPtr->size() != patchSize)
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+
+                scalarFields_.insert(key, fPtr);
+            }
+            else if
+            (
+                fieldToken.compoundToken().type()
+             == token::Compound<List<vector>>::typeName
+            )
+            {
+                auto fPtr = autoPtr<vectorField>::New();
+
+                fPtr->transfer
                 (
-                    firstToken.isWord()
-                 && firstToken.wordToken() == "nonuniform"
-                )
+                    dynamicCast<token::Compound<List<vector>>>
+                    (
+                        fieldToken.transferCompoundToken(is)
+                    )
+                );
+
+                if (fPtr->size() != patchSize)
                 {
-                    token fieldToken(is);
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
 
-                    if (!fieldToken.isCompound())
-                    {
-                        if
-                        (
-                            fieldToken.isLabel()
-                         && fieldToken.labelToken() == 0
-                        )
-                        {
-                            scalarFields_.insert
-                            (
-                                key,
-                                autoPtr<scalarField>::New()
-                            );
-                        }
-                        else
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    token following 'nonuniform' "
-                                   "is not a compound"
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-                    }
-                    else if
+                vectorFields_.insert(key, fPtr);
+            }
+            else if
+            (
+                fieldToken.compoundToken().type()
+             == token::Compound<List<sphericalTensor>>::typeName
+            )
+            {
+                auto fPtr = autoPtr<sphericalTensorField>::New();
+
+                fPtr->transfer
+                (
+                    dynamicCast<token::Compound<List<sphericalTensor>>>
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<scalar>>::typeName
+                        fieldToken.transferCompoundToken(is)
                     )
-                    {
-                        auto fPtr = autoPtr<scalarField>::New();
+                );
 
-                        fPtr->transfer
-                        (
-                            dynamicCast<token::Compound<List<scalar>>>
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        scalarFields_.insert(key, fPtr);
-                    }
-                    else if
+                if (fPtr->size() != patchSize)
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+
+                sphTensorFields_.insert(key, fPtr);
+            }
+            else if
+            (
+                fieldToken.compoundToken().type()
+             == token::Compound<List<symmTensor>>::typeName
+            )
+            {
+                auto fPtr = autoPtr<symmTensorField>::New();
+
+                fPtr->transfer
+                (
+                    dynamicCast<token::Compound<List<symmTensor>>>
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<vector>>::typeName
+                        fieldToken.transferCompoundToken(is)
                     )
-                    {
-                        auto fPtr = autoPtr<vectorField>::New();
+                );
 
-                        fPtr->transfer
-                        (
-                            dynamicCast<token::Compound<List<vector>>>
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        vectorFields_.insert(key, fPtr);
-                    }
-                    else if
+                if (fPtr->size() != patchSize)
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+
+                symmTensorFields_.insert(key, fPtr);
+            }
+            else if
+            (
+                fieldToken.compoundToken().type()
+             == token::Compound<List<tensor>>::typeName
+            )
+            {
+                auto fPtr = autoPtr<tensorField>::New();
+
+                fPtr->transfer
+                (
+                    dynamicCast<token::Compound<List<tensor>>>
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<sphericalTensor>>::typeName
+                        fieldToken.transferCompoundToken(is)
                     )
-                    {
-                        auto fPtr = autoPtr<sphericalTensorField>::New();
+                );
 
-                        fPtr->transfer
-                        (
-                            dynamicCast
-                            <
-                                token::Compound<List<sphericalTensor>>
-                            >
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        sphTensorFields_.insert(key, fPtr);
-                    }
-                    else if
+                if (fPtr->size() != patchSize)
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+
+                tensorFields_.insert(key, fPtr);
+            }
+            else
+            {
+                FatalIOErrorInFunction(dict)
+                    << "\n    compound " << fieldToken.compoundToken()
+                    << " not supported"
+                    << "\n    on patch " << this->patch().name()
+                    << " of field "
+                    << this->internalField().name()
+                    << " in file "
+                    << this->internalField().objectPath() << nl
+                    << exit(FatalIOError);
+            }
+        }
+        else if
+        (
+            firstToken.isWord()
+         && firstToken.wordToken() == "uniform"
+        )
+        {
+            token fieldToken(is);
+
+            if (!fieldToken.isPunctuation())
+            {
+                scalarFields_.insert
+                (
+                    key,
+                    autoPtr<scalarField>::New
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<symmTensor>>::typeName
+                        patchSize,
+                        fieldToken.number()
                     )
-                    {
-                        auto fPtr = autoPtr<symmTensorField>::New();
+                );
+            }
+            else
+            {
+                // Read as scalarList.
+                is.putBack(fieldToken);
+
+                scalarList l(is);
+
+                if (l.size() == vector::nComponents)
+                {
+                    vector vs(l[0], l[1], l[2]);
 
-                        fPtr->transfer
+                    vectorFields_.insert
+                    (
+                        key,
+                        autoPtr<vectorField>::New
                         (
-                            dynamicCast
-                            <
-                                token::Compound<List<symmTensor>>
-                            >
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        symmTensorFields_.insert(key, fPtr);
-                    }
-                    else if
+                            patchSize,
+                            vs
+                        )
+                    );
+                }
+                else if (l.size() == sphericalTensor::nComponents)
+                {
+                    sphericalTensor vs(l[0]);
+
+                    sphTensorFields_.insert
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<tensor>>::typeName
-                    )
-                    {
-                        auto fPtr = autoPtr<tensorField>::New();
+                        key,
+                        autoPtr<sphericalTensorField>::New
+                        (
+                            patchSize,
+                            vs
+                        )
+                    );
+                }
+                else if (l.size() == symmTensor::nComponents)
+                {
+                    symmTensor vs(l[0], l[1], l[2], l[3], l[4], l[5]);
 
-                        fPtr->transfer
+                    symmTensorFields_.insert
+                    (
+                        key,
+                        autoPtr<symmTensorField>::New
                         (
-                            dynamicCast<token::Compound<List<tensor>>>
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        tensorFields_.insert(key, fPtr);
-                    }
-                    else
-                    {
-                        FatalIOErrorInFunction(dict)
-                            << "\n    compound " << fieldToken.compoundToken()
-                            << " not supported"
-                            << "\n    on patch " << this->patch().name()
-                            << " of field "
-                            << this->internalField().name()
-                            << " in file "
-                            << this->internalField().objectPath()
-                            << exit(FatalIOError);
-                    }
+                            patchSize,
+                            vs
+                        )
+                    );
                 }
-                else if
-                (
-                    firstToken.isWord()
-                 && firstToken.wordToken() == "uniform"
-                )
+                else if (l.size() == tensor::nComponents)
                 {
-                    token fieldToken(is);
+                    tensor vs
+                    (
+                        l[0], l[1], l[2],
+                        l[3], l[4], l[5],
+                        l[6], l[7], l[8]
+                    );
 
-                    if (!fieldToken.isPunctuation())
-                    {
-                        scalarFields_.insert
+                    tensorFields_.insert
+                    (
+                        key,
+                        autoPtr<tensorField>::New
                         (
-                            key,
-                            autoPtr<scalarField>::New
-                            (
-                                this->size(),
-                                fieldToken.number()
-                            )
-                        );
-                    }
-                    else
-                    {
-                        // Read as scalarList.
-                        is.putBack(fieldToken);
-
-                        scalarList l(is);
-
-                        if (l.size() == vector::nComponents)
-                        {
-                            vector vs(l[0], l[1], l[2]);
-
-                            vectorFields_.insert
-                            (
-                                key,
-                                autoPtr<vectorField>::New
-                                (
-                                    this->size(),
-                                    vs
-                                )
-                            );
-                        }
-                        else if (l.size() == sphericalTensor::nComponents)
-                        {
-                            sphericalTensor vs(l[0]);
-
-                            sphTensorFields_.insert
-                            (
-                                key,
-                                autoPtr<sphericalTensorField>::New
-                                (
-                                    this->size(),
-                                    vs
-                                )
-                            );
-                        }
-                        else if (l.size() == symmTensor::nComponents)
-                        {
-                            symmTensor vs(l[0], l[1], l[2], l[3], l[4], l[5]);
-
-                            symmTensorFields_.insert
-                            (
-                                key,
-                                autoPtr<symmTensorField>::New
-                                (
-                                    this->size(),
-                                    vs
-                                )
-                            );
-                        }
-                        else if (l.size() == tensor::nComponents)
-                        {
-                            tensor vs
-                            (
-                                l[0], l[1], l[2],
-                                l[3], l[4], l[5],
-                                l[6], l[7], l[8]
-                            );
-
-                            tensorFields_.insert
-                            (
-                                key,
-                                autoPtr<tensorField>::New
-                                (
-                                    this->size(),
-                                    vs
-                                )
-                            );
-                        }
-                        else
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    unrecognised native type " << l
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-                    }
+                            patchSize,
+                            vs
+                        )
+                    );
+                }
+                else
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    unrecognised native type " << l
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
                 }
             }
         }
@@ -707,46 +699,42 @@ void Foam::genericFaPatchField<Type>::write(Ostream& os) const
     {
         const keyType& key = dEntry.keyword();
 
-        if (key != "type" && key != "value")
+        if (key == "type" || key == "value")
         {
-            if
-            (
-                dEntry.isStream()
-             && dEntry.stream().size()
-             && dEntry.stream()[0].isWord()
-             && dEntry.stream()[0].wordToken() == "nonuniform"
-            )
+            continue;
+        }
+        else if
+        (
+            dEntry.isStream()
+         && dEntry.stream().size()
+         && dEntry.stream()[0].isWord()
+         && dEntry.stream()[0].wordToken() == "nonuniform"
+        )
+        {
+            if (scalarFields_.found(key))
             {
-                if (scalarFields_.found(key))
-                {
-                    scalarFields_.find(key)()
-                        ->writeEntry(key, os);
-                }
-                else if (vectorFields_.found(key))
-                {
-                    vectorFields_.find(key)()
-                        ->writeEntry(key, os);
-                }
-                else if (sphTensorFields_.found(key))
-                {
-                    sphTensorFields_.find(key)()
-                        ->writeEntry(key, os);
-                }
-                else if (symmTensorFields_.found(key))
-                {
-                    symmTensorFields_.find(key)()
-                        ->writeEntry(key, os);
-                }
-                else if (tensorFields_.found(key))
-                {
-                    tensorFields_.find(key)()
-                        ->writeEntry(key, os);
-                }
+                scalarFields_.cfind(key)()->writeEntry(key, os);
             }
-            else
+            else if (vectorFields_.found(key))
             {
-                dEntry.write(os);
+                vectorFields_.cfind(key)()->writeEntry(key, os);
             }
+            else if (sphTensorFields_.found(key))
+            {
+                sphTensorFields_.cfind(key)()->writeEntry(key, os);
+            }
+            else if (symmTensorFields_.found(key))
+            {
+                symmTensorFields_.cfind(key)()->writeEntry(key, os);
+            }
+            else if (tensorFields_.found(key))
+            {
+                tensorFields_.cfind(key)()->writeEntry(key, os);
+            }
+        }
+        else
+        {
+            dEntry.write(os);
         }
     }
 
diff --git a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C
index bdf7e0351acf58663770004a01cff4ac2dc9f01e..cecaaac1727a86afc1e9d87645d847bb01f9dfee 100644
--- a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C
+++ b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           |
+    \\  /    A nd           | Copyright (C) 2019 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
                             | Copyright (C) 2011-2016 OpenFOAM Foundation
@@ -56,22 +56,23 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
 )
 :
     calculatedFvPatchField<Type>(p, iF, dict),
-    actualTypeName_(dict.lookup("type")),
+    actualTypeName_(dict.get<word>("type")),
     dict_(dict)
 {
+    const label patchSize = this->size();
+
     if (!dict.found("value"))
     {
         FatalIOErrorInFunction(dict)
-            << "\n    Cannot find 'value' entry"
+            << nl << "    Cannot find 'value' entry"
             << " on patch " << this->patch().name()
             << " of field " << this->internalField().name()
-            << " in file " << this->internalField().objectPath()
-            << nl
+            << " in file " << this->internalField().objectPath() << nl
             << "    which is required to set the"
                " values of the generic patch field." << nl
-            << "    (Actual type " << actualTypeName_ << ")" << nl
-            << "\n    Please add the 'value' entry to the write function "
-               "of the user-defined boundary-condition\n"
+            << "    (Actual type " << actualTypeName_ << ')' << nl << nl
+            << "    Please add the 'value' entry to the write function"
+               " of the user-defined boundary-condition" << nl
             << exit(FatalIOError);
     }
 
@@ -79,338 +80,329 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
     {
         const keyType& key = dEntry.keyword();
 
-        if (key != "type" && key != "value")
+        if
+        (
+            key == "type"
+         || key == "value"
+         || !dEntry.isStream() || dEntry.stream().empty()
+        )
+        {
+            continue;
+        }
+
+
+        ITstream& is = dEntry.stream();
+
+        // Read first token
+        token firstToken(is);
+
+        if
+        (
+            firstToken.isWord()
+         && firstToken.wordToken() == "nonuniform"
+        )
         {
-            if
+            token fieldToken(is);
+
+            if (!fieldToken.isCompound())
+            {
+                if
+                (
+                    fieldToken.isLabel()
+                 && fieldToken.labelToken() == 0
+                )
+                {
+                    scalarFields_.insert(key, autoPtr<scalarField>::New());
+                }
+                else
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    token following 'nonuniform' "
+                           "is not a compound"
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+            }
+            else if
             (
-                dEntry.isStream()
-             && dEntry.stream().size()
+                fieldToken.compoundToken().type()
+             == token::Compound<List<scalar>>::typeName
             )
             {
-                ITstream& is = dEntry.stream();
+                auto fPtr = autoPtr<scalarField>::New();
 
-                // Read first token
-                token firstToken(is);
+                fPtr->transfer
+                (
+                    dynamicCast<token::Compound<List<scalar>>>
+                    (
+                        fieldToken.transferCompoundToken(is)
+                    )
+                );
 
-                if
+                if (fPtr->size() != patchSize)
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+
+                scalarFields_.insert(key, fPtr);
+            }
+            else if
+            (
+                fieldToken.compoundToken().type()
+             == token::Compound<List<vector>>::typeName
+            )
+            {
+                auto fPtr = autoPtr<vectorField>::New();
+
+                fPtr->transfer
                 (
-                    firstToken.isWord()
-                 && firstToken.wordToken() == "nonuniform"
-                )
+                    dynamicCast<token::Compound<List<vector>>>
+                    (
+                        fieldToken.transferCompoundToken(is)
+                    )
+                );
+
+                if (fPtr->size() != patchSize)
                 {
-                    token fieldToken(is);
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
 
-                    if (!fieldToken.isCompound())
-                    {
-                        if
-                        (
-                            fieldToken.isLabel()
-                         && fieldToken.labelToken() == 0
-                        )
-                        {
-                            scalarFields_.insert
-                            (
-                                dEntry.keyword(),
-                                autoPtr<scalarField>::New()
-                            );
-                        }
-                        else
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    token following 'nonuniform' "
-                                   "is not a compound"
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-                    }
-                    else if
+                vectorFields_.insert(key, fPtr);
+            }
+            else if
+            (
+                fieldToken.compoundToken().type()
+             == token::Compound<List<sphericalTensor>>::typeName
+            )
+            {
+                auto fPtr = autoPtr<sphericalTensorField>::New();
+
+                fPtr->transfer
+                (
+                    dynamicCast<token::Compound<List<sphericalTensor>>>
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<scalar>>::typeName
+                        fieldToken.transferCompoundToken(is)
                     )
-                    {
-                        auto fPtr = autoPtr<scalarField>::New();
+                );
 
-                        fPtr->transfer
-                        (
-                            dynamicCast<token::Compound<List<scalar>>>
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        scalarFields_.insert(key, fPtr);
-                    }
-                    else if
+                if (fPtr->size() != patchSize)
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+
+                sphTensorFields_.insert(key, fPtr);
+            }
+            else if
+            (
+                fieldToken.compoundToken().type()
+             == token::Compound<List<symmTensor>>::typeName
+            )
+            {
+                auto fPtr = autoPtr<symmTensorField>::New();
+
+                fPtr->transfer
+                (
+                    dynamicCast<token::Compound<List<symmTensor>>>
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<vector>>::typeName
+                        fieldToken.transferCompoundToken(is)
                     )
-                    {
-                        auto fPtr = autoPtr<vectorField>::New();
+                );
 
-                        fPtr->transfer
-                        (
-                            dynamicCast<token::Compound<List<vector>>>
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        vectorFields_.insert(key, fPtr);
-                    }
-                    else if
+                if (fPtr->size() != patchSize)
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+
+                symmTensorFields_.insert(key, fPtr);
+            }
+            else if
+            (
+                fieldToken.compoundToken().type()
+             == token::Compound<List<tensor>>::typeName
+            )
+            {
+                auto fPtr = autoPtr<tensorField>::New();
+
+                fPtr->transfer
+                (
+                    dynamicCast<token::Compound<List<tensor>>>
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<sphericalTensor>>::typeName
+                        fieldToken.transferCompoundToken(is)
                     )
-                    {
-                        auto fPtr = autoPtr<sphericalTensorField>::New();
+                );
 
-                        fPtr->transfer
-                        (
-                            dynamicCast
-                            <
-                                token::Compound<List<sphericalTensor>>
-                            >
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        sphTensorFields_.insert(key, fPtr);
-                    }
-                    else if
+                if (fPtr->size() != patchSize)
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+
+                tensorFields_.insert(key, fPtr);
+            }
+            else
+            {
+                FatalIOErrorInFunction(dict)
+                    << "\n    compound " << fieldToken.compoundToken()
+                    << " not supported"
+                    << "\n    on patch " << this->patch().name()
+                    << " of field "
+                    << this->internalField().name()
+                    << " in file "
+                    << this->internalField().objectPath() << nl
+                    << exit(FatalIOError);
+            }
+        }
+        else if
+        (
+            firstToken.isWord()
+         && firstToken.wordToken() == "uniform"
+        )
+        {
+            token fieldToken(is);
+
+            if (!fieldToken.isPunctuation())
+            {
+                scalarFields_.insert
+                (
+                    key,
+                    autoPtr<scalarField>::New
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<symmTensor>>::typeName
+                        patchSize,
+                        fieldToken.number()
                     )
-                    {
-                        auto fPtr = autoPtr<symmTensorField>::New();
+                );
+            }
+            else
+            {
+                // Read as scalarList.
+                is.putBack(fieldToken);
+
+                scalarList l(is);
+
+                if (l.size() == vector::nComponents)
+                {
+                    vector vs(l[0], l[1], l[2]);
 
-                        fPtr->transfer
+                    vectorFields_.insert
+                    (
+                        key,
+                        autoPtr<vectorField>::New
                         (
-                            dynamicCast
-                            <
-                                token::Compound<List<symmTensor>>
-                            >
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        symmTensorFields_.insert(key, fPtr);
-                    }
-                    else if
+                            patchSize,
+                            vs
+                        )
+                    );
+                }
+                else if (l.size() == sphericalTensor::nComponents)
+                {
+                    sphericalTensor vs(l[0]);
+
+                    sphTensorFields_.insert
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<tensor>>::typeName
-                    )
-                    {
-                        auto fPtr = autoPtr<tensorField>::New();
+                        key,
+                        autoPtr<sphericalTensorField>::New
+                        (
+                            patchSize,
+                            vs
+                        )
+                    );
+                }
+                else if (l.size() == symmTensor::nComponents)
+                {
+                    symmTensor vs(l[0], l[1], l[2], l[3], l[4], l[5]);
 
-                        fPtr->transfer
+                    symmTensorFields_.insert
+                    (
+                        key,
+                        autoPtr<symmTensorField>::New
                         (
-                            dynamicCast<token::Compound<List<tensor>>>
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        tensorFields_.insert(key, fPtr);
-                    }
-                    else
-                    {
-                        FatalIOErrorInFunction(dict)
-                            << "\n    compound " << fieldToken.compoundToken()
-                            << " not supported"
-                            << "\n    on patch " << this->patch().name()
-                            << " of field "
-                            << this->internalField().name()
-                            << " in file "
-                            << this->internalField().objectPath()
-                            << exit(FatalIOError);
-                    }
+                            patchSize,
+                            vs
+                        )
+                    );
                 }
-                else if
-                (
-                    firstToken.isWord()
-                 && firstToken.wordToken() == "uniform"
-                )
+                else if (l.size() == tensor::nComponents)
                 {
-                    token fieldToken(is);
+                    tensor vs
+                    (
+                        l[0], l[1], l[2],
+                        l[3], l[4], l[5],
+                        l[6], l[7], l[8]
+                    );
 
-                    if (!fieldToken.isPunctuation())
-                    {
-                        scalarFields_.insert
+                    tensorFields_.insert
+                    (
+                        key,
+                        autoPtr<tensorField>::New
                         (
-                            key,
-                            autoPtr<scalarField>::New
-                            (
-                                this->size(),
-                                fieldToken.number()
-                            )
-                        );
-                    }
-                    else
-                    {
-                        // Read as scalarList.
-                        is.putBack(fieldToken);
-
-                        scalarList l(is);
-
-                        if (l.size() == vector::nComponents)
-                        {
-                            vector vs(l[0], l[1], l[2]);
-
-                            vectorFields_.insert
-                            (
-                                key,
-                                autoPtr<vectorField>::New
-                                (
-                                    this->size(),
-                                    vs
-                                )
-                            );
-                        }
-                        else if (l.size() == sphericalTensor::nComponents)
-                        {
-                            sphericalTensor vs(l[0]);
-
-                            sphTensorFields_.insert
-                            (
-                                key,
-                                autoPtr<sphericalTensorField>::New
-                                (
-                                    this->size(),
-                                    vs
-                                )
-                            );
-                        }
-                        else if (l.size() == symmTensor::nComponents)
-                        {
-                            symmTensor vs(l[0], l[1], l[2], l[3], l[4], l[5]);
-
-                            symmTensorFields_.insert
-                            (
-                                key,
-                                autoPtr<symmTensorField>::New
-                                (
-                                    this->size(),
-                                    vs
-                                )
-                            );
-                        }
-                        else if (l.size() == tensor::nComponents)
-                        {
-                            tensor vs
-                            (
-                                l[0], l[1], l[2],
-                                l[3], l[4], l[5],
-                                l[6], l[7], l[8]
-                            );
-
-                            tensorFields_.insert
-                            (
-                                key,
-                                autoPtr<tensorField>::New
-                                (
-                                    this->size(),
-                                    vs
-                                )
-                            );
-                        }
-                        else
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    unrecognised native type " << l
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-                    }
+                            patchSize,
+                            vs
+                        )
+                    );
+                }
+                else
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    unrecognised native type " << l
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
                 }
             }
         }
@@ -707,46 +699,42 @@ void Foam::genericFvPatchField<Type>::write(Ostream& os) const
     {
         const keyType& key = dEntry.keyword();
 
-        if (key != "type" && key != "value")
+        if (key == "type" || key == "value")
         {
-            if
-            (
-                dEntry.isStream()
-             && dEntry.stream().size()
-             && dEntry.stream()[0].isWord()
-             && dEntry.stream()[0].wordToken() == "nonuniform"
-            )
+            continue;
+        }
+        else if
+        (
+            dEntry.isStream()
+         && dEntry.stream().size()
+         && dEntry.stream()[0].isWord()
+         && dEntry.stream()[0].wordToken() == "nonuniform"
+        )
+        {
+            if (scalarFields_.found(key))
             {
-                if (scalarFields_.found(key))
-                {
-                    scalarFields_.find(key)()
-                        ->writeEntry(key, os);
-                }
-                else if (vectorFields_.found(key))
-                {
-                    vectorFields_.find(key)()
-                        ->writeEntry(key, os);
-                }
-                else if (sphTensorFields_.found(key))
-                {
-                    sphTensorFields_.find(key)()
-                        ->writeEntry(key, os);
-                }
-                else if (symmTensorFields_.found(key))
-                {
-                    symmTensorFields_.find(key)()
-                        ->writeEntry(key, os);
-                }
-                else if (tensorFields_.found(key))
-                {
-                    tensorFields_.find(key)()
-                        ->writeEntry(key, os);
-                }
+                scalarFields_.cfind(key)()->writeEntry(key, os);
             }
-            else
+            else if (vectorFields_.found(key))
             {
-                dEntry.write(os);
+                vectorFields_.cfind(key)()->writeEntry(key, os);
             }
+            else if (sphTensorFields_.found(key))
+            {
+                sphTensorFields_.cfind(key)()->writeEntry(key, os);
+            }
+            else if (symmTensorFields_.found(key))
+            {
+                symmTensorFields_.cfind(key)()->writeEntry(key, os);
+            }
+            else if (tensorFields_.found(key))
+            {
+                tensorFields_.cfind(key)()->writeEntry(key, os);
+            }
+        }
+        else
+        {
+            dEntry.write(os);
         }
     }
 
diff --git a/src/genericPatchFields/genericFvsPatchField/genericFvsPatchField.C b/src/genericPatchFields/genericFvsPatchField/genericFvsPatchField.C
index a30745fa41423505dd7f2d29e1b501bf058c17a5..dbfaf0c591bfb5bd575819a7665953b3b0b37867 100644
--- a/src/genericPatchFields/genericFvsPatchField/genericFvsPatchField.C
+++ b/src/genericPatchFields/genericFvsPatchField/genericFvsPatchField.C
@@ -54,22 +54,23 @@ Foam::genericFvsPatchField<Type>::genericFvsPatchField
 )
 :
     calculatedFvsPatchField<Type>(p, iF, dict),
-    actualTypeName_(dict.lookup("type")),
+    actualTypeName_(dict.get<word>("type")),
     dict_(dict)
 {
+    const label patchSize = this->size();
+
     if (!dict.found("value"))
     {
         FatalIOErrorInFunction(dict)
-            << "\n    Cannot find 'value' entry"
+            << nl << "    Cannot find 'value' entry"
             << " on patch " << this->patch().name()
             << " of field " << this->internalField().name()
-            << " in file " << this->internalField().objectPath()
-            << nl
+            << " in file " << this->internalField().objectPath() << nl
             << "    which is required to set the"
                " values of the generic patch field." << nl
-            << "    (Actual type " << actualTypeName_ << ")" << nl
-            << "\n    Please add the 'value' entry to the write function "
-               "of the user-defined boundary-condition\n"
+            << "    (Actual type " << actualTypeName_ << ')' << nl << nl
+            << "    Please add the 'value' entry to the write function"
+               " of the user-defined boundary-condition" << nl
             << exit(FatalIOError);
     }
 
@@ -77,338 +78,329 @@ Foam::genericFvsPatchField<Type>::genericFvsPatchField
     {
         const keyType& key = dEntry.keyword();
 
-        if (key != "type" && key != "value")
+        if
+        (
+            key == "type"
+         || key == "value"
+         || !dEntry.isStream() || dEntry.stream().empty()
+        )
+        {
+            continue;
+        }
+
+
+        ITstream& is = dEntry.stream();
+
+        // Read first token
+        token firstToken(is);
+
+        if
+        (
+            firstToken.isWord()
+         && firstToken.wordToken() == "nonuniform"
+        )
         {
-            if
+            token fieldToken(is);
+
+            if (!fieldToken.isCompound())
+            {
+                if
+                (
+                    fieldToken.isLabel()
+                 && fieldToken.labelToken() == 0
+                )
+                {
+                    scalarFields_.insert(key, autoPtr<scalarField>::New());
+                }
+                else
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    token following 'nonuniform' "
+                           "is not a compound"
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+            }
+            else if
             (
-                dEntry.isStream()
-             && dEntry.stream().size()
+                fieldToken.compoundToken().type()
+             == token::Compound<List<scalar>>::typeName
             )
             {
-                ITstream& is = dEntry.stream();
+                auto fPtr = autoPtr<scalarField>::New();
 
-                // Read first token
-                token firstToken(is);
+                fPtr->transfer
+                (
+                    dynamicCast<token::Compound<List<scalar>>>
+                    (
+                        fieldToken.transferCompoundToken(is)
+                    )
+                );
 
-                if
+                if (fPtr->size() != patchSize)
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+
+                scalarFields_.insert(key, fPtr);
+            }
+            else if
+            (
+                fieldToken.compoundToken().type()
+             == token::Compound<List<vector>>::typeName
+            )
+            {
+                auto fPtr = autoPtr<vectorField>::New();
+
+                fPtr->transfer
                 (
-                    firstToken.isWord()
-                 && firstToken.wordToken() == "nonuniform"
-                )
+                    dynamicCast<token::Compound<List<vector>>>
+                    (
+                        fieldToken.transferCompoundToken(is)
+                    )
+                );
+
+                if (fPtr->size() != patchSize)
                 {
-                    token fieldToken(is);
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
 
-                    if (!fieldToken.isCompound())
-                    {
-                        if
-                        (
-                            fieldToken.isLabel()
-                         && fieldToken.labelToken() == 0
-                        )
-                        {
-                            scalarFields_.insert
-                            (
-                                dEntry.keyword(),
-                                autoPtr<scalarField>::New()
-                            );
-                        }
-                        else
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    token following 'nonuniform' "
-                                   "is not a compound"
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-                    }
-                    else if
+                vectorFields_.insert(key, fPtr);
+            }
+            else if
+            (
+                fieldToken.compoundToken().type()
+             == token::Compound<List<sphericalTensor>>::typeName
+            )
+            {
+                auto fPtr = autoPtr<sphericalTensorField>::New();
+
+                fPtr->transfer
+                (
+                    dynamicCast<token::Compound<List<sphericalTensor>>>
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<scalar>>::typeName
+                        fieldToken.transferCompoundToken(is)
                     )
-                    {
-                        auto fPtr = autoPtr<scalarField>::New();
+                );
 
-                        fPtr->transfer
-                        (
-                            dynamicCast<token::Compound<List<scalar>>>
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        scalarFields_.insert(key, fPtr);
-                    }
-                    else if
+                if (fPtr->size() != patchSize)
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+
+                sphTensorFields_.insert(key, fPtr);
+            }
+            else if
+            (
+                fieldToken.compoundToken().type()
+             == token::Compound<List<symmTensor>>::typeName
+            )
+            {
+                auto fPtr = autoPtr<symmTensorField>::New();
+
+                fPtr->transfer
+                (
+                    dynamicCast<token::Compound<List<symmTensor>>>
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<vector>>::typeName
+                        fieldToken.transferCompoundToken(is)
                     )
-                    {
-                        auto fPtr = autoPtr<vectorField>::New();
+                );
 
-                        fPtr->transfer
-                        (
-                            dynamicCast<token::Compound<List<vector>>>
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        vectorFields_.insert(key, fPtr);
-                    }
-                    else if
+                if (fPtr->size() != patchSize)
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+
+                symmTensorFields_.insert(key, fPtr);
+            }
+            else if
+            (
+                fieldToken.compoundToken().type()
+             == token::Compound<List<tensor>>::typeName
+            )
+            {
+                auto fPtr = autoPtr<tensorField>::New();
+
+                fPtr->transfer
+                (
+                    dynamicCast<token::Compound<List<tensor>>>
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<sphericalTensor>>::typeName
+                        fieldToken.transferCompoundToken(is)
                     )
-                    {
-                        auto fPtr = autoPtr<sphericalTensorField>::New();
+                );
 
-                        fPtr->transfer
-                        (
-                            dynamicCast
-                            <
-                                token::Compound<List<sphericalTensor>>
-                            >
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        sphTensorFields_.insert(key, fPtr);
-                    }
-                    else if
+                if (fPtr->size() != patchSize)
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+
+                tensorFields_.insert(key, fPtr);
+            }
+            else
+            {
+                FatalIOErrorInFunction(dict)
+                    << "\n    compound " << fieldToken.compoundToken()
+                    << " not supported"
+                    << "\n    on patch " << this->patch().name()
+                    << " of field "
+                    << this->internalField().name()
+                    << " in file "
+                    << this->internalField().objectPath() << nl
+                    << exit(FatalIOError);
+            }
+        }
+        else if
+        (
+            firstToken.isWord()
+         && firstToken.wordToken() == "uniform"
+        )
+        {
+            token fieldToken(is);
+
+            if (!fieldToken.isPunctuation())
+            {
+                scalarFields_.insert
+                (
+                    key,
+                    autoPtr<scalarField>::New
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<symmTensor>>::typeName
+                        patchSize,
+                        fieldToken.number()
                     )
-                    {
-                        auto fPtr = autoPtr<symmTensorField>::New();
+                );
+            }
+            else
+            {
+                // Read as scalarList.
+                is.putBack(fieldToken);
+
+                scalarList l(is);
+
+                if (l.size() == vector::nComponents)
+                {
+                    vector vs(l[0], l[1], l[2]);
 
-                        fPtr->transfer
+                    vectorFields_.insert
+                    (
+                        key,
+                        autoPtr<vectorField>::New
                         (
-                            dynamicCast
-                            <
-                                token::Compound<List<symmTensor>>
-                            >
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        symmTensorFields_.insert(key, fPtr);
-                    }
-                    else if
+                            patchSize,
+                            vs
+                        )
+                    );
+                }
+                else if (l.size() == sphericalTensor::nComponents)
+                {
+                    sphericalTensor vs(l[0]);
+
+                    sphTensorFields_.insert
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<tensor>>::typeName
-                    )
-                    {
-                        auto fPtr = autoPtr<tensorField>::New();
+                        key,
+                        autoPtr<sphericalTensorField>::New
+                        (
+                            patchSize,
+                            vs
+                        )
+                    );
+                }
+                else if (l.size() == symmTensor::nComponents)
+                {
+                    symmTensor vs(l[0], l[1], l[2], l[3], l[4], l[5]);
 
-                        fPtr->transfer
+                    symmTensorFields_.insert
+                    (
+                        key,
+                        autoPtr<symmTensorField>::New
                         (
-                            dynamicCast<token::Compound<List<tensor>>>
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        tensorFields_.insert(key, fPtr);
-                    }
-                    else
-                    {
-                        FatalIOErrorInFunction(dict)
-                            << "\n    compound " << fieldToken.compoundToken()
-                            << " not supported"
-                            << "\n    on patch " << this->patch().name()
-                            << " of field "
-                            << this->internalField().name()
-                            << " in file "
-                            << this->internalField().objectPath()
-                            << exit(FatalIOError);
-                    }
+                            patchSize,
+                            vs
+                        )
+                    );
                 }
-                else if
-                (
-                    firstToken.isWord()
-                 && firstToken.wordToken() == "uniform"
-                )
+                else if (l.size() == tensor::nComponents)
                 {
-                    token fieldToken(is);
+                    tensor vs
+                    (
+                        l[0], l[1], l[2],
+                        l[3], l[4], l[5],
+                        l[6], l[7], l[8]
+                    );
 
-                    if (!fieldToken.isPunctuation())
-                    {
-                        scalarFields_.insert
+                    tensorFields_.insert
+                    (
+                        key,
+                        autoPtr<tensorField>::New
                         (
-                            key,
-                            autoPtr<scalarField>::New
-                            (
-                                this->size(),
-                                fieldToken.number()
-                            )
-                        );
-                    }
-                    else
-                    {
-                        // Read as scalarList.
-                        is.putBack(fieldToken);
-
-                        scalarList l(is);
-
-                        if (l.size() == vector::nComponents)
-                        {
-                            vector vs(l[0], l[1], l[2]);
-
-                            vectorFields_.insert
-                            (
-                                key,
-                                autoPtr<vectorField>::New
-                                (
-                                    this->size(),
-                                    vs
-                                )
-                            );
-                        }
-                        else if (l.size() == sphericalTensor::nComponents)
-                        {
-                            sphericalTensor vs(l[0]);
-
-                            sphTensorFields_.insert
-                            (
-                                key,
-                                autoPtr<sphericalTensorField>::New
-                                (
-                                    this->size(),
-                                    vs
-                                )
-                            );
-                        }
-                        else if (l.size() == symmTensor::nComponents)
-                        {
-                            symmTensor vs(l[0], l[1], l[2], l[3], l[4], l[5]);
-
-                            symmTensorFields_.insert
-                            (
-                                key,
-                                autoPtr<symmTensorField>::New
-                                (
-                                    this->size(),
-                                    vs
-                                )
-                            );
-                        }
-                        else if (l.size() == tensor::nComponents)
-                        {
-                            tensor vs
-                            (
-                                l[0], l[1], l[2],
-                                l[3], l[4], l[5],
-                                l[6], l[7], l[8]
-                            );
-
-                            tensorFields_.insert
-                            (
-                                key,
-                                autoPtr<tensorField>::New
-                                (
-                                    this->size(),
-                                    vs
-                                )
-                            );
-                        }
-                        else
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    unrecognised native type " << l
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-                    }
+                            patchSize,
+                            vs
+                        )
+                    );
+                }
+                else
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    unrecognised native type " << l
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
                 }
             }
         }
@@ -705,46 +697,42 @@ void Foam::genericFvsPatchField<Type>::write(Ostream& os) const
     {
         const keyType& key = dEntry.keyword();
 
-        if (key != "type" && key != "value")
+        if (key == "type" || key == "value")
         {
-            if
-            (
-                dEntry.isStream()
-             && dEntry.stream().size()
-             && dEntry.stream()[0].isWord()
-             && dEntry.stream()[0].wordToken() == "nonuniform"
-            )
+            continue;
+        }
+        else if
+        (
+            dEntry.isStream()
+         && dEntry.stream().size()
+         && dEntry.stream()[0].isWord()
+         && dEntry.stream()[0].wordToken() == "nonuniform"
+        )
+        {
+            if (scalarFields_.found(key))
             {
-                if (scalarFields_.found(key))
-                {
-                    scalarFields_.find(key)()
-                        ->writeEntry(key, os);
-                }
-                else if (vectorFields_.found(key))
-                {
-                    vectorFields_.find(key)()
-                        ->writeEntry(key, os);
-                }
-                else if (sphTensorFields_.found(key))
-                {
-                    sphTensorFields_.find(key)()
-                        ->writeEntry(key, os);
-                }
-                else if (symmTensorFields_.found(key))
-                {
-                    symmTensorFields_.find(key)()
-                        ->writeEntry(key, os);
-                }
-                else if (tensorFields_.found(key))
-                {
-                    tensorFields_.find(key)()
-                        ->writeEntry(key, os);
-                }
+                scalarFields_.cfind(key)()->writeEntry(key, os);
             }
-            else
+            else if (vectorFields_.found(key))
             {
-                dEntry.write(os);
+                vectorFields_.cfind(key)()->writeEntry(key, os);
             }
+            else if (sphTensorFields_.found(key))
+            {
+                sphTensorFields_.cfind(key)()->writeEntry(key, os);
+            }
+            else if (symmTensorFields_.found(key))
+            {
+                symmTensorFields_.cfind(key)()->writeEntry(key, os);
+            }
+            else if (tensorFields_.found(key))
+            {
+                tensorFields_.cfind(key)()->writeEntry(key, os);
+            }
+        }
+        else
+        {
+            dEntry.write(os);
         }
     }
 
diff --git a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C
index 264bf187287ae4b861e6eec285097fd20b543da3..aee5b2337a65e11fa86688212a62b44401c25155 100644
--- a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C
+++ b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2016-2019 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
                             | Copyright (C) 2011-2016 OpenFOAM Foundation
@@ -55,242 +55,234 @@ Foam::genericPointPatchField<Type>::genericPointPatchField
     actualTypeName_(dict.get<word>("type")),
     dict_(dict)
 {
+    const label patchSize = this->size();
+
     for (const entry& dEntry : dict_)
     {
         const keyType& key = dEntry.keyword();
 
-        if (key != "type")
+        if
+        (
+            key == "type"
+         || !dEntry.isStream() || dEntry.stream().empty()
+        )
         {
-            if
-            (
-                dEntry.isStream()
-             && dEntry.stream().size()
-            )
-            {
-                ITstream& is = dEntry.stream();
+            continue;
+        }
 
-                // Read first token
-                token firstToken(is);
 
+        ITstream& is = dEntry.stream();
+
+        // Read first token
+        token firstToken(is);
+
+        if
+        (
+            firstToken.isWord()
+         && firstToken.wordToken() == "nonuniform"
+        )
+        {
+            token fieldToken(is);
+
+            if (!fieldToken.isCompound())
+            {
                 if
                 (
-                    firstToken.isWord()
-                 && firstToken.wordToken() == "nonuniform"
+                    fieldToken.isLabel()
+                 && fieldToken.labelToken() == 0
                 )
                 {
-                    token fieldToken(is);
-
-                    if (!fieldToken.isCompound())
-                    {
-                        if
-                        (
-                            fieldToken.isLabel()
-                         && fieldToken.labelToken() == 0
-                        )
-                        {
-                            scalarFields_.insert
-                            (
-                                key,
-                                autoPtr<scalarField>::New()
-                            );
-                        }
-                        else
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    token following 'nonuniform' "
-                                   "is not a compound"
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                            << exit(FatalIOError);
-                        }
-                    }
-                    else if
+                    scalarFields_.insert(key, autoPtr<scalarField>::New());
+                }
+                else
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    token following 'nonuniform' "
+                           "is not a compound"
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+            }
+            else if
+            (
+                fieldToken.compoundToken().type()
+             == token::Compound<List<scalar>>::typeName
+            )
+            {
+                auto fPtr = autoPtr<scalarField>::New();
+
+                fPtr->transfer
+                (
+                    dynamicCast<token::Compound<List<scalar>>>
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<scalar>>::typeName
+                        fieldToken.transferCompoundToken(is)
                     )
-                    {
-                        auto fPtr = autoPtr<scalarField>::New();
-
-                        fPtr->transfer
-                        (
-                            dynamicCast<token::Compound<List<scalar>>>
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        scalarFields_.insert(key, fPtr);
-                    }
-                    else if
+                );
+
+                if (fPtr->size() != patchSize)
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+
+                scalarFields_.insert(key, fPtr);
+            }
+            else if
+            (
+                fieldToken.compoundToken().type()
+             == token::Compound<List<vector>>::typeName
+            )
+            {
+                auto fPtr = autoPtr<vectorField>::New();
+
+                fPtr->transfer
+                (
+                    dynamicCast<token::Compound<List<vector>>>
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<vector>>::typeName
+                        fieldToken.transferCompoundToken(is)
                     )
-                    {
-                        auto fPtr = autoPtr<vectorField>::New();
-
-                        fPtr->transfer
-                        (
-                            dynamicCast<token::Compound<List<vector>>>
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        vectorFields_.insert(key, fPtr);
-                    }
-                    else if
+                );
+
+                if (fPtr->size() != patchSize)
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+
+                vectorFields_.insert(key, fPtr);
+            }
+            else if
+            (
+                fieldToken.compoundToken().type()
+             == token::Compound<List<sphericalTensor>>::typeName
+            )
+            {
+                auto fPtr = autoPtr<sphericalTensorField>::New();
+
+                fPtr->transfer
+                (
+                    dynamicCast<token::Compound<List<sphericalTensor>>>
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<sphericalTensor>>::typeName
+                        fieldToken.transferCompoundToken(is)
                     )
-                    {
-                        auto fPtr = autoPtr<sphericalTensorField>::New();
-
-                        fPtr->transfer
-                        (
-                            dynamicCast
-                            <
-                                token::Compound<List<sphericalTensor>>
-                            >
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        sphTensorFields_.insert(key, fPtr);
-                    }
-                    else if
+                );
+
+                if (fPtr->size() != patchSize)
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+
+                sphTensorFields_.insert(key, fPtr);
+            }
+            else if
+            (
+                fieldToken.compoundToken().type()
+             == token::Compound<List<symmTensor>>::typeName
+            )
+            {
+                auto fPtr = autoPtr<symmTensorField>::New();
+
+                fPtr->transfer
+                (
+                    dynamicCast<token::Compound<List<symmTensor>>>
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<symmTensor>>::typeName
+                        fieldToken.transferCompoundToken(is)
                     )
-                    {
-                        auto fPtr = autoPtr<symmTensorField>::New();
-
-                        fPtr->transfer
-                        (
-                            dynamicCast
-                            <
-                                token::Compound<List<symmTensor>>
-                            >
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        symmTensorFields_.insert(key, fPtr);
-                    }
-                    else if
+                );
+
+                if (fPtr->size() != patchSize)
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
+                }
+
+                symmTensorFields_.insert(key, fPtr);
+            }
+            else if
+            (
+                fieldToken.compoundToken().type()
+             == token::Compound<List<tensor>>::typeName
+            )
+            {
+                auto fPtr = autoPtr<tensorField>::New();
+
+                fPtr->transfer
+                (
+                    dynamicCast<token::Compound<List<tensor>>>
                     (
-                        fieldToken.compoundToken().type()
-                     == token::Compound<List<tensor>>::typeName
+                        fieldToken.transferCompoundToken(is)
                     )
-                    {
-                        auto fPtr = autoPtr<tensorField>::New();
-
-                        fPtr->transfer
-                        (
-                            dynamicCast<token::Compound<List<tensor>>>
-                            (
-                                fieldToken.transferCompoundToken(is)
-                            )
-                        );
-
-                        if (fPtr->size() != this->size())
-                        {
-                            FatalIOErrorInFunction(dict)
-                                << "\n    size of field " << key
-                                << " (" << fPtr->size() << ')'
-                                << " is not the same size as the patch ("
-                                << this->size() << ')'
-                                << "\n    on patch " << this->patch().name()
-                                << " of field "
-                                << this->internalField().name()
-                                << " in file "
-                                << this->internalField().objectPath()
-                                << exit(FatalIOError);
-                        }
-
-                        tensorFields_.insert(key, fPtr);
-                    }
-                    else
-                    {
-                        FatalIOErrorInFunction(dict)
-                            << "\n    compound " << fieldToken.compoundToken()
-                            << " not supported"
-                            << "\n    on patch " << this->patch().name()
-                            << " of field "
-                            << this->internalField().name()
-                            << " in file "
-                            << this->internalField().objectPath()
-                            << exit(FatalIOError);
-                    }
+                );
+
+                if (fPtr->size() != patchSize)
+                {
+                    FatalIOErrorInFunction(dict)
+                        << "\n    size of field " << key
+                        << " (" << fPtr->size() << ')'
+                        << " is not the same size as the patch ("
+                        << patchSize << ')'
+                        << "\n    on patch " << this->patch().name()
+                        << " of field "
+                        << this->internalField().name()
+                        << " in file "
+                        << this->internalField().objectPath() << nl
+                        << exit(FatalIOError);
                 }
+
+                tensorFields_.insert(key, fPtr);
+            }
+            else
+            {
+                FatalIOErrorInFunction(dict)
+                    << "\n    compound " << fieldToken.compoundToken()
+                    << " not supported"
+                    << "\n    on patch " << this->patch().name()
+                    << " of field "
+                    << this->internalField().name()
+                    << " in file "
+                    << this->internalField().objectPath() << nl
+                    << exit(FatalIOError);
             }
         }
     }
@@ -488,41 +480,42 @@ void Foam::genericPointPatchField<Type>::write(Ostream& os) const
     {
         const keyType& key = dEntry.keyword();
 
-        if (key != "type")
+        if (key == "type" || key == "value")
         {
-            if
-            (
-                dEntry.isStream()
-             && dEntry.stream().size()
-             && dEntry.stream()[0].isWord()
-             && dEntry.stream()[0].wordToken() == "nonuniform"
-            )
+            continue;
+        }
+        else if
+        (
+            dEntry.isStream()
+         && dEntry.stream().size()
+         && dEntry.stream()[0].isWord()
+         && dEntry.stream()[0].wordToken() == "nonuniform"
+        )
+        {
+            if (scalarFields_.found(key))
             {
-                if (scalarFields_.found(key))
-                {
-                    scalarFields_.find(key)()->writeEntry(key, os);
-                }
-                else if (vectorFields_.found(key))
-                {
-                    vectorFields_.find(key)()->writeEntry(key, os);
-                }
-                else if (sphTensorFields_.found(key))
-                {
-                    sphTensorFields_.find(key)()->writeEntry(key, os);
-                }
-                else if (symmTensorFields_.found(key))
-                {
-                    symmTensorFields_.find(key)()->writeEntry(key, os);
-                }
-                else if (tensorFields_.found(key))
-                {
-                    tensorFields_.find(key)()->writeEntry(key, os);
-                }
+                scalarFields_.cfind(key)()->writeEntry(key, os);
             }
-            else
+            else if (vectorFields_.found(key))
             {
-                dEntry.write(os);
+                vectorFields_.cfind(key)()->writeEntry(key, os);
             }
+            else if (sphTensorFields_.found(key))
+            {
+                sphTensorFields_.cfind(key)()->writeEntry(key, os);
+            }
+            else if (symmTensorFields_.found(key))
+            {
+                symmTensorFields_.cfind(key)()->writeEntry(key, os);
+            }
+            else if (tensorFields_.found(key))
+            {
+                tensorFields_.cfind(key)()->writeEntry(key, os);
+            }
+        }
+        else
+        {
+            dEntry.write(os);
         }
     }
 }