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

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

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   November 13, 2013, 22:49
Default Error In patch type 'genericPatch' not type 'directMappedPatchBase'
  #1
New Member
 
hua1015's Avatar
 
Hua
Join Date: May 2012
Posts: 25
Rep Power: 5
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

Thread Tools
Display Modes

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 On
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 108 June 9, 2015 08:13
second order schemes marine OpenFOAM 66 October 26, 2014 12:10
Fluent msh and cyclic boundary cfdengineering OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 48 January 25, 2013 04: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 03:34


All times are GMT -4. The time now is 08:55.