CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Boundary condition implementation (https://www.cfd-online.com/Forums/openfoam-programming-development/128842-boundary-condition-implementation.html)

louisgag January 22, 2014 11:06

Boundary condition implementation
 
2 Attachment(s)
Deal all,

I am trying to implement a new boundary condition which combines slip in the tangential direction to a movingWallVelocity in the normal direction. The purpose is to be have a slip condition that works for a moving mesh.

So far, I've modified the existing fixedNormalSlip condition, but I'm stuck with an error of incompatible field types which I can't resolve. I tried to guess many solutions and have not found anything so far.

The problem is that once I change
Code:

Field<Type>::operator=(nHat*(nHat & fixedValue_ ));
to
Code:

Field<Type>::operator=(nHat*(nHat & (Up + n*(Un - (n & Up))) ));
compiling gives me the following error,

Code:

Making dependency list for source file fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.C
SOURCE=fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/louis/OpenFOAM/OpenFOAM-2.2.x/src/triSurface/lnInclude -I/home/louis/OpenFOAM/OpenFOAM-2.2.x/src/meshTools/lnInclude  -IlnInclude -I. -I/home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude -I/home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/fixedNormalSlipFvPatchFields.o
In file included from fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.H:239:0,
                from fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.H:29,
                from fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.C:26:
fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C: In instantiation of ‘void Foam::fixedNormalSlipFvPatchField<Type>::evaluate(Foam::UPstream::commsTypes) [with Type = Foam::Tensor<double>]’:
lnInclude/fvPatchField.H:142:9:  recursively required from ‘static Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::adddictionaryConstructorToTable<fvPatchFieldType>::New(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with fvPatchFieldType = Foam::fixedNormalSlipFvPatchField<Foam::Tensor<double> >; Type = Foam::Tensor<double>]’
lnInclude/fvPatchField.H:142:9:  required from ‘Foam::fvPatchField<Type>::adddictionaryConstructorToTable<fvPatchFieldType>::adddictionaryConstructorToTable(const Foam::word&) [with fvPatchFieldType = Foam::fixedNormalSlipFvPatchField<Foam::Tensor<double> >; Type = Foam::Tensor<double>]’
fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.C:46:1:  required from here
fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C:186:17: error: no matching function for call to ‘Foam::fixedNormalSlipFvPatchField<Foam::Tensor<double> >::operator=(Foam::tmp<Foam::Field<Foam::Vector<double> > >)’
fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C:186:17: note: candidates are:
In file included from /home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.H:360:0,
                from /home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/labelField.H:39,
                from /home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/primitiveFields.H:37,
                from /home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/pointField.H:36,
                from /home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/edge.H:40,
                from /home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/edgeList.H:32,
                from /home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/PrimitivePatch.H:56,
                from /home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/primitivePatch.H:35,
                from /home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/polyPatch.H:43,
                from lnInclude/fvPatch.H:39,
                from lnInclude/fvPatchField.H:47,
                from lnInclude/transformFvPatchField.H:41,
                from fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.H:60,
                from fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.H:29,
                from fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.C:26:
/home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:625:6: note: void Foam::Field<Type>::operator=(const Foam::Field<Type>&) [with Type = Foam::Tensor<double>]
/home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:625:6: note:  no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::Field<Foam::Tensor<double> >&’
/home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:646:6: note: void Foam::Field<Type>::operator=(const Foam::UList<T>&) [with Type = Foam::Tensor<double>]
/home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:646:6: note:  no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::UList<Foam::Tensor<double> >&’
/home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:639:6: note: void Foam::Field<Type>::operator=(const Foam::SubField<Type>&) [with Type = Foam::Tensor<double>]
/home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:639:6: note:  no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::SubField<Foam::Tensor<double> >&’
/home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:653:6: note: void Foam::Field<Type>::operator=(const Foam::tmp<Foam::Field<Type> >&) [with Type = Foam::Tensor<double>]
/home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:653:6: note:  no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::tmp<Foam::Field<Foam::Tensor<double> > >&’
/home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:670:6: note: void Foam::Field<Type>::operator=(const Type&) [with Type = Foam::Tensor<double>]
/home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:670:6: note:  no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::Tensor<double>&’
In file included from /home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/labelField.H:39:0,
                from /home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/primitiveFields.H:37,
                from /home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/pointField.H:36,
                from /home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/edge.H:40,
                from /home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/edgeList.H:32,
                from /home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/PrimitivePatch.H:56,
                from /home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/primitivePatch.H:35,
                from /home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/polyPatch.H:43,
                from lnInclude/fvPatch.H:39,
                from lnInclude/fvPatchField.H:47,
                from lnInclude/transformFvPatchField.H:41,
                from fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.H:60,
                from fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.H:29,
                from fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.C:26:
/home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.H:320:14: note: template<class Form, class Cmpt, int nCmpt> void Foam::Field::operator=(const Foam::VectorSpace<Form, Cmpt, nCmpt>&) [with Form = Form; Cmpt = Cmpt; int nCmpt = nCmpt; Type = Foam::Tensor<double>]
/home/louis/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.H:320:14: note:  template argument deduction/substitution failed:
In file included from fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.H:239:0,
                from fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.H:29,
                from fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.C:26:
fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C:186:17: note:  ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ is not derived from ‘const Foam::VectorSpace<Form, Cmpt, nCmpt>’
make: *** [Make/linux64GccDPOpt/fixedNormalSlipFvPatchFields.o] Error 1

I'm hoping someone with a better knowledge of the code can hint me in the right direction.

I am attaching the full code for fixedNormalSlipFvPatchField.C and .H

Thanks,


-Louis

louisgag January 23, 2014 11:41

I found a workaround: start from movingWallVelocity boundary condition instead, this way the problem of Type is avoided and the condition can be applied only to the velocity field... Seems to work fine.


All times are GMT -4. The time now is 04:18.