View Issue Details

IDProjectCategoryView StatusLast Update
0003062OpenFOAMPatchpublic2018-08-31 17:05
ReportertniemiAssigned Tohenry 
PrioritylowSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Versiondev 
Fixed in Version6 
Summary0003062: Radiation BCs, missing autoMap and rmap
DescriptionSome of the radiation BCs inherit from both mixedFvPatchScalarField and radiationCoupledBase, but do not provide autoMap and rmap functions. Both mixedFvPatchScalarField and radiationCoupledBase have non-trivial autoMap and rmap and thus both should be called. At the moment only functions from mixedFvPatchScalarField function will be called and the emissivity field from radiationCoupledBase won't get treated correctly.

I have attached a patch which should fix this. The patch was made for 6, but should apply also for dev. The Marshak-BCs already have the autoMap and rmap.

BTW, a related observation, all the other BCs except the two Marshak ones reside within radiation namespace. Maybe Marshak should be moved there for consistency?
Steps To ReproduceHave a radiation model loaded in controlDict (eg. a custom absorption model), reconstruct a case with greyDiffusiveRadiationMixedFvPatchScalarField -> emissivity field can get corrupted preventing a restart from the reconstructed case.
TagsNo tags attached.

Activities

tniemi

2018-08-30 15:30

reporter  

radiation.patch (8,240 bytes)
diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C
index 3cdce0e..6e89bbc
--- a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C
+++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C
@@ -67,7 +67,8 @@ greyDiffusiveRadiationMixedFvPatchScalarField
     (
         p,
         ptf.emissivityMethod(),
-        ptf.emissivity_
+        ptf.emissivity_,
+        mapper
     ),
     TName_(ptf.TName_)
 {}
@@ -143,6 +144,27 @@ greyDiffusiveRadiationMixedFvPatchScalarField
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
+void Foam::radiation::greyDiffusiveRadiationMixedFvPatchScalarField::autoMap
+(
+    const fvPatchFieldMapper& m
+)
+{
+    mixedFvPatchScalarField::autoMap(m);
+    radiationCoupledBase::autoMap(m);
+}
+
+
+void Foam::radiation::greyDiffusiveRadiationMixedFvPatchScalarField::rmap
+(
+    const fvPatchScalarField& ptf,
+    const labelList& addr
+)
+{
+    mixedFvPatchScalarField::rmap(ptf, addr);
+    radiationCoupledBase::rmap(ptf, addr);
+}
+
+
 void Foam::radiation::greyDiffusiveRadiationMixedFvPatchScalarField::
 updateCoeffs()
 {
diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.H b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.H
index 81e7862..04d9717
--- a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.H
+++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.H
@@ -171,6 +171,21 @@ public:
                 return TName_;
             }
 
+        // Mapping functions
+
+            //- Map (and resize as needed) from self given a mapping object
+            virtual void autoMap
+            (
+                const fvPatchFieldMapper&
+            );
+
+            //- Reverse map the given fvPatchField onto this fvPatchField
+            virtual void rmap
+            (
+                const fvPatchScalarField&,
+                const labelList&
+            );
+
 
         // Evaluation functions
 
diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C
index 1642507..7058e96
--- a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C
+++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C
@@ -58,9 +58,10 @@ greyDiffusiveViewFactorFixedValueFvPatchScalarField
     (
         patch(),
         ptf.emissivityMethod(),
-        ptf.emissivity_
+        ptf.emissivity_,
+        mapper
     ),
-    qro_(ptf.qro_)
+    qro_(ptf.qro_, mapper)
 {}
 
 
@@ -129,6 +130,32 @@ greyDiffusiveViewFactorFixedValueFvPatchScalarField
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 void Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
+autoMap
+(
+    const fvPatchFieldMapper& m
+)
+{
+    fixedValueFvPatchScalarField::autoMap(m);
+    radiationCoupledBase::autoMap(m);
+    qro_.autoMap(m);
+}
+
+
+void Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::rmap
+(
+    const fvPatchScalarField& ptf,
+    const labelList& addr
+)
+{
+    fixedValueFvPatchScalarField::rmap(ptf, addr);
+    radiationCoupledBase::rmap(ptf, addr);
+    const greyDiffusiveViewFactorFixedValueFvPatchScalarField& mrptf =
+        refCast<const greyDiffusiveViewFactorFixedValueFvPatchScalarField>(ptf);
+
+    qro_.rmap(mrptf.qro_, addr);
+}
+
+void Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
 updateCoeffs()
 {
     if (this->updated())
diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.H b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.H
index 69bad7b..ec6076a
--- a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.H
+++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.H
@@ -168,6 +168,20 @@ public:
             }
 
 
+            //- Map (and resize as needed) from self given a mapping object
+            virtual void autoMap
+            (
+                const fvPatchFieldMapper&
+            );
+
+            //- Reverse map the given fvPatchField onto this fvPatchField
+            virtual void rmap
+            (
+                const fvPatchScalarField&,
+                const labelList&
+            );
+
+
         // Evaluation functions
 
             //- Update the coefficients associated with the patch field
diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C
index 52bb9e6..92f2950
--- a/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C
+++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C
@@ -68,7 +68,8 @@ wideBandDiffusiveRadiationMixedFvPatchScalarField
     (
         p,
         ptf.emissivityMethod(),
-        ptf.emissivity_
+        ptf.emissivity_,
+        mapper
     ),
     TName_(ptf.TName_)
 {}
@@ -148,6 +149,27 @@ wideBandDiffusiveRadiationMixedFvPatchScalarField
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 void Foam::radiation::wideBandDiffusiveRadiationMixedFvPatchScalarField::
+autoMap
+(
+    const fvPatchFieldMapper& m
+)
+{
+    mixedFvPatchScalarField::autoMap(m);
+    radiationCoupledBase::autoMap(m);
+}
+
+
+void Foam::radiation::wideBandDiffusiveRadiationMixedFvPatchScalarField::rmap
+(
+    const fvPatchScalarField& ptf,
+    const labelList& addr
+)
+{
+    mixedFvPatchScalarField::rmap(ptf, addr);
+    radiationCoupledBase::rmap(ptf, addr);
+}
+
+void Foam::radiation::wideBandDiffusiveRadiationMixedFvPatchScalarField::
 updateCoeffs()
 {
     if (this->updated())
diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.H b/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.H
index 987bc7d..b9ea5af
--- a/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.H
+++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.H
@@ -165,6 +165,20 @@ public:
             }
 
 
+            //- Map (and resize as needed) from self given a mapping object
+            virtual void autoMap
+            (
+                const fvPatchFieldMapper&
+            );
+
+            //- Reverse map the given fvPatchField onto this fvPatchField
+            virtual void rmap
+            (
+                const fvPatchScalarField&,
+                const labelList&
+            );
+
+
         // Evaluation functions
 
             //- Update the coefficients associated with the patch field
radiation.patch (8,240 bytes)

henry

2018-08-31 16:15

manager   ~0010018

Thanks Timo.

Resolved in OpenFOAM-6 by 37207f3279cbf78845041d7290bd5d6dae23c7b6
Resolved in OpenFOAM-dev by bef34e6b05433bcd02f83a4d242e1b53e0ae47b7

henry

2018-08-31 17:05

manager   ~0010021

commit 187557eb4a7b59e7aea30891897dcb685af8e30e

    radiation/derivedFvPatchFields: Rationalised namespace of the BCs

Issue History

Date Modified Username Field Change
2018-08-30 15:30 tniemi New Issue
2018-08-30 15:30 tniemi File Added: radiation.patch
2018-08-31 15:18 wyldckat Assigned To => henry
2018-08-31 15:18 wyldckat Status new => assigned
2018-08-31 16:15 henry Status assigned => resolved
2018-08-31 16:15 henry Resolution open => fixed
2018-08-31 16:15 henry Fixed in Version => 6
2018-08-31 16:15 henry Note Added: 0010018
2018-08-31 17:05 henry Note Added: 0010021