From c5e7f356c928f342cf21f8cd11aa735c713ead6b Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Tue, 7 Feb 2017 19:01:34 +0000
Subject: [PATCH] porosityModel::powerLaw: Added groupName to rho lookup to
 support multiphase

---
 .../general/porosityModel/powerLaw/powerLaw.C | 22 +++++++++++--------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.C b/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.C
index e49e2a410ac..280b0e4ba27 100644
--- a/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.C
+++ b/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012-2015 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2017 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -94,14 +94,16 @@ void Foam::porosityModels::powerLaw::correct
     fvVectorMatrix& UEqn
 ) const
 {
-    const vectorField& U = UEqn.psi();
+    const volVectorField& U = UEqn.psi();
     const scalarField& V = mesh_.V();
     scalarField& Udiag = UEqn.diag();
- 
+
     if (UEqn.dimensions() == dimForce)
     {
-        const volScalarField& rho =
-            mesh_.lookupObject<volScalarField>(rhoName_);
+        const volScalarField& rho = mesh_.lookupObject<volScalarField>
+        (
+            IOobject::groupName(rhoName_, U.group())
+        );
 
         apply(Udiag, V, rho, U);
     }
@@ -122,7 +124,7 @@ void Foam::porosityModels::powerLaw::correct
     const vectorField& U = UEqn.psi();
     const scalarField& V = mesh_.V();
     scalarField& Udiag = UEqn.diag();
- 
+
     apply(Udiag, V, rho, U);
 }
 
@@ -133,12 +135,14 @@ void Foam::porosityModels::powerLaw::correct
     volTensorField& AU
 ) const
 {
-    const vectorField& U = UEqn.psi();
+    const volVectorField& U = UEqn.psi();
 
     if (UEqn.dimensions() == dimForce)
     {
-        const volScalarField& rho =
-            mesh_.lookupObject<volScalarField>(rhoName_);
+        const volScalarField& rho = mesh_.lookupObject<volScalarField>
+        (
+            IOobject::groupName(rhoName_, U.group())
+        );
 
         apply(AU, rho, U);
     }
-- 
GitLab