CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Error In patch type 'genericPatch' not type 'directMappedPatchBase'

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 13, 2013, 21:49
Default Error In patch type 'genericPatch' not type 'directMappedPatchBase'
  #1
Member
 
hua1015's Avatar
 
Hua
Join Date: May 2012
Posts: 31
Rep Power: 13
hua1015 is on a distinguished road
Hi, foamers,
I want to create a 2D simulation just like the Openfoam-1.6-ext chtMultiRegionFoam using mixed coupled boundary condition.
After compiled successfully, but fail in my case.
here is the error:
--> FOAM FATAL ERROR:

patch type 'genericPatch' not type 'directMappedPatchBase'
for patch UP of field B in file "/home/junhuapan/OF_tutorials/i_c_mhd/0/fluid/B"

From function MixedBCoupledFvPatchScalarField::MixedBCoupledFvPa tchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)

in file coupledFvPatchFields/regionCoupleB/MixedBCoupledFvPatchScalarField.C at line 91.

here is my MixedBCoupledFvPatchScalar.C
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.

OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.

OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

\*---------------------------------------------------------------------------*/

#include "MixedBCoupledFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "directMappedPatchBase.H"


// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

Foam::MixedBCoupledFvPatchScalarField::
MixedBCoupledFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(p, iF),
neighbourFieldName_("undefined-neighbourFieldName")

{
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 1.0;
}


Foam::MixedBCoupledFvPatchScalarField::
MixedBCoupledFvPatchScalarField
(
const MixedBCoupledFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mixedFvPatchScalarField(ptf, p, iF, mapper),
neighbourFieldName_(ptf.neighbourFieldName_)

{}


Foam::MixedBCoupledFvPatchScalarField::
MixedBCoupledFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchScalarField(p, iF),
neighbourFieldName_(dict.lookup("neighbourFieldNam e"))

{
if (!isA<directMappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
"MixedBCoupledFvPatchScalarField::"
"MixedBCoupledFvPatchScalarField\n"
"(\n"
" const fvPatch& p,\n"
" const DimensionedField<scalar, volMesh>& iF,\n"
" const dictionary& dict\n"
")\n"
) << "\n patch type '" << p.type()
<< "' not type '" << directMappedPatchBase::typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << dimensionedInternalField().name()
<< " in file " << dimensionedInternalField().objectPath()
<< exit(FatalError);
}

fvPatchScalarField:perator=(scalarField("value", dict, p.size()));

if (dict.found("refValue"))
{
// Full restart
refValue() = scalarField("refValue", dict, p.size());
refGrad() = scalarField("refGradient", dict, p.size());
valueFraction() = scalarField("valueFraction", dict, p.size());
}
else
{
// Start from user entered data. Assume fixedValue.
refValue() = *this;
refGrad() = 0.0;
valueFraction() = 1.0;
}
}


Foam::MixedBCoupledFvPatchScalarField::
MixedBCoupledFvPatchScalarField
(
const MixedBCoupledFvPatchScalarField& wtcsf,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(wtcsf, iF),
neighbourFieldName_(wtcsf.neighbourFieldName_)

{}


// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //



void Foam::MixedBCoupledFvPatchScalarField::updateCoeff s()
{
if (updated())
{
return;
}

// Get the coupling information from the directMappedPatchBase
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
(
patch().patch()
);
const polyMesh& nbrMesh = mpp.sampleMesh();
const fvPatch& nbrPatch = refCast<const fvMesh>
(
nbrMesh
).boundary()[mpp.samplePolyPatch().index()];



// Force recalculation of mapping and schedule

const mapDistribute& distMap = mpp.map();

tmp<scalarField> intFld = patchInternalField();


const MixedBCoupledFvPatchScalarField& nbrField =
refCast<const MixedBCoupledFvPatchScalarField>
(
nbrPatch.lookupPatchField<volScalarField, scalar>
(
neighbourFieldName_
)
);

// Swap to obtain full local values of neighbour internal field
scalarField nbrIntFld = nbrField.patchInternalField();
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrIntFld
);

// Swap to obtain full local values of neighbour K*delta
const dictionary& transportProperties =
nbrField.db().lookupObject<IOdictionary>("transpor tProperties");

dimensionedScalar MuZegma1(transportProperties.lookup("MuZegma"));

scalarField nbrKDelta = MuZegma1.value()*nbrPatch.deltaCoeffs();



mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrKDelta
);

// const objectRegistry& db2=ownPatch.thisDb();
const dictionary& transportProperties1 =
db().lookupObject<IOdictionary>("transportProperti es");

dimensionedScalar MuZegma2(transportProperties1.lookup("MuZegma"));

tmp<scalarField> myKDelta = MuZegma2.value()*patch().deltaCoeffs();


// Both sides agree on
// - B : (myKDelta*fld + nbrKDelta*nbrFld)/(myKDelta+nbrKDelta)
// - gradient : (B-fld)*delta
// We've got a degree of freedom in how to implement this in a mixed bc.
// (what gradient, what fixedValue and mixing coefficient)
// Two reasonable choices:
// 1. specify above temperature on one side (preferentially the high side)
// and above gradient on the other. So this will switch between pure
// fixedvalue and pure fixedgradient
// 2. specify gradient and temperature such that the equations are the
// same on both sides. This leads to the choice of
// - refGradient = zero gradient
// - refValue = neighbour value
// - mixFraction = nbrKDelta / (nbrKDelta + myKDelta())


this->refValue() = nbrIntFld;

this->refGrad() = 0.0;

this->valueFraction() = nbrKDelta / (nbrKDelta + myKDelta());

mixedFvPatchScalarField::updateCoeffs();

}

here is my B in '0' of fluid domain:
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object B;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [1 0 -2 0 0 -1 0];

internalField uniform 5;

boundaryField
{
L
{
type fixedValue;
value uniform 0;
}

R
{
type fixedValue;
value uniform 0;
}

UP
{
type MixedBCoupled;
neighbourRegionName u_solid;
neighbourPatchName U_D;
neighbourFieldName B;
value $internalField;
}

D
{
type MixedBCoupled;
neighbourRegionName d_solid;
neighbourPatchName D_U;
neighbourFieldName B;
value $internalField;
}

frontAndBackPlanes
{
type empty;
}
}

Thanks for any suggestions.
hua1015 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
y+ and u+ values with low-Re RANS turbulence models: utility + testcase florian_krause OpenFOAM 114 August 23, 2023 05:37
second order schemes marine OpenFOAM 67 April 11, 2022 18:19
[Commercial meshers] Fluent msh and cyclic boundary cfdengineering OpenFOAM Meshing & Mesh Conversion 48 January 25, 2013 03:28
Cyclic Boundary Condition Luiz Eduardo Bittencourt Sampaio (Sampaio) OpenFOAM Running, Solving & CFD 36 July 2, 2012 12:23
CheckMeshbs errors ivanyao OpenFOAM Running, Solving & CFD 2 March 11, 2009 02:34


All times are GMT -4. The time now is 19:33.