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

Permeability filling of container outlet condition

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 28, 2008, 09:01
Default Can you attach your code?
  #21
Senior Member
 
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 17
billy is on a distinguished road
Can you attach your code?
billy is offline   Reply With Quote

Old   June 2, 2014, 12:21
Default selective outlet BC
  #22
New Member
 
Peter
Join Date: Apr 2014
Posts: 21
Rep Power: 12
John Degenkolb is on a distinguished road
Hi Foamers,

I'm trying to redo the boundary condition that Francesco created.
I copied and renamed the inletOutletFvPatchField boundary conditions to vapMembraneFvPatchField and tried costumize them.
My .C is:
Code:
#include "vapMembraneFvPatchField.H"

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

template<class Type>
Foam::vapMembraneFvPatchField<Type>::vapMembraneFvPatchField
( 
    const fvPatch& p,
    const DimensionedField<Type, volMesh>& iF,
    const volScalarField& alphaMatrix
)
:
    mixedFvPatchField<Type>(p, iF),
  // original: phiName_("phi")

    alphaMatrixName_("alphaMatrix")

{
    this->refValue() = pTraits<Type>::zero;
    this->refGrad() = pTraits<Type>::zero;
    this->valueFraction() = 0.0;
}

template<class Type>
Foam::vapMembraneFvPatchField<Type>::vapMembraneFvPatchField
(
    const vapMembraneFvPatchField<Type>& ptf,
    const fvPatch& p,
    const DimensionedField<Type, volMesh>& iF,
    const fvPatchFieldMapper& mapper
)
:
    mixedFvPatchField<Type>(ptf, p, iF, mapper),
    phiName_(ptf.phiName_)
{}


template<class Type>
Foam::vapMembraneFvPatchField<Type>::vapMembraneFvPatchField
(
    const fvPatch& p,
    const DimensionedField<Type, volMesh>& iF,
    const dictionary& dict
)
:
    mixedFvPatchField<Type>(p, iF),
    phiName_(dict.lookupOrDefault<word>("phi", "phi"))
{
    this->refValue() = Field<Type>("inletValue", dict, p.size());

    if (dict.found("value"))
    {
        fvPatchField<Type>::operator=
        (
            Field<Type>("value", dict, p.size())
        );
    }
    else
    {
        fvPatchField<Type>::operator=(this->refValue());
    }

    this->refGrad() = pTraits<Type>::zero;
    this->valueFraction() = 0.0;
}


template<class Type>
Foam::vapMembraneFvPatchField<Type>::vapMembraneFvPatchField
(
    const vapMembraneFvPatchField<Type>& ptf
)
:
    mixedFvPatchField<Type>(ptf),
    phiName_(ptf.phiName_)
{}


template<class Type>
Foam::vapMembraneFvPatchField<Type>::vapMembraneFvPatchField
(
    const vapMembraneFvPatchField<Type>& ptf,
    const DimensionedField<Type, volMesh>& iF
)
:
    mixedFvPatchField<Type>(ptf, iF),
    phiName_(ptf.phiName_)
{}


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

template<class Type>
void Foam::vapMembraneFvPatchField<Type>::updateCoeffs()
{
    if (this->updated())
    {
        return;
    }


    const Field<scalar>& alphaMatrix =
        this->patch().template lookupPatchField<surfaceScalarField, scalar>
        (
            alphaMatrixName_
        );

    this->valueFraction() = 1.0 - alphaMatrix();


    mixedFvPatchField<Type>::updateCoeffs();
}


template<class Type>
void Foam::vapMembraneFvPatchField<Type>::write(Ostream& os) const
{
    fvPatchField<Type>::write(os);
    if (phiName_ != "phi")
    {
        os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
    }
    this->refValue().writeEntry("inletValue", os);
    this->writeEntry("value", os);
}


// * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //

template<class Type>
void Foam::vapMembraneFvPatchField<Type>::operator=
(
    const fvPatchField<Type>& ptf
)
{
    fvPatchField<Type>::operator=
    (
        this->valueFraction()*this->refValue()
        + (1 - this->valueFraction())*ptf
    );
}


// ************************************************************************* //
And my .H file:
Code:
#ifndef vapMembraneFvPatchField_H
#define vapMembraneFvPatchField_H

#include "mixedFvPatchField.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{

/*---------------------------------------------------------------------------*\
                   Class vapMembraneFvPatchField Declaration
\*---------------------------------------------------------------------------*/

template<class Type>
class vapMembraneFvPatchField
:
    public mixedFvPatchField<Type>
{

protected:

    // Protected data

        //- Name of flux field
        word phiName_;
            
            //- Name of the volume fraction field
            word alphaMatrixName_;
/*
        // by me, to avoid " class doesn not have any diled name "gamma_"
        word gamma_;
*/

public:

    //- Runtime type information
    TypeName("vapMembrane");


    // Constructors

        //- Construct from patch and internal field
        vapMembraneFvPatchField
        (
            const fvPatch&,
            const DimensionedField<Type, volMesh>&,
            const volScalarField& alphaMatrix

        );

        //- Construct from patch, internal field and dictionary
        vapMembraneFvPatchField
        (
            const fvPatch&,
            const DimensionedField<Type, volMesh>&,
            const dictionary&
        );

        //- Construct by mapping given vapMembraneFvPatchField onto a new patch
        vapMembraneFvPatchField
        (
            const vapMembraneFvPatchField<Type>&,
            const fvPatch&,
            const DimensionedField<Type, volMesh>&,
            const fvPatchFieldMapper&
        );

        //- Construct as copy
        vapMembraneFvPatchField
        (
            const vapMembraneFvPatchField<Type>&
        );

        //- Construct and return a clone
        virtual tmp<fvPatchField<Type> > clone() const
        {
            return tmp<fvPatchField<Type> >
            (
                new vapMembraneFvPatchField<Type>(*this)
            );
        }

        //- Construct as copy setting internal field reference
        vapMembraneFvPatchField
        (
            const vapMembraneFvPatchField<Type>&,
            const DimensionedField<Type, volMesh>&
        );

        //- Construct and return a clone setting internal field reference
        virtual tmp<fvPatchField<Type> > clone
        (
            const DimensionedField<Type, volMesh>& iF
        ) const
        {
            return tmp<fvPatchField<Type> >
            (
                new vapMembraneFvPatchField<Type>(*this, iF)
            );
        }


    // Member functions

        //- Update the coefficients associated with the patch field
        virtual void updateCoeffs();

        //- Write
        virtual void write(Ostream&) const;


    // Member operators

        virtual void operator=(const fvPatchField<Type>& pvf);
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#ifdef NoRepository
#   include "vapMembraneFvPatchField.C"
#endif

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //
When I try to do wclean; wmake I get the following error:
Code:
peter@peter-HP-Compaq-nw8440-RZ646EC-ABD:~/OpenFOAM/peter-2.3.0/mySolvers/vapMembrane$ wclean; wmake
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file vapMembrane/vapMembraneFvPatchFields.C
SOURCE=vapMembrane/vapMembraneFvPatchFields.C ;  g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam230/src/triSurface/lnInclude -I/opt/openfoam230/src/meshTools/lnInclude -I/opt/openfoam230/src/transportModels/twoPhaseMixture/lnInclude -I/opt/openfoam230/src/transportModels/incompressible/lnInclude -I/opt/openfoam230/src/transportModels/interfaceProperties/lnInclude -I/opt/openfoam230/src/finiteVolume/lnInclude -I/opt/openfoam230/src/meshTools/lnInclude -I/opt/openfoam230/src/fvOptions/lnInclude -I/opt/openfoam230/src/sampling/lnInclude -IlnInclude -I. -I/opt/openfoam230/src/OpenFOAM/lnInclude -I/opt/openfoam230/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linuxGccDPOpt/vapMembraneFvPatchFields.o
In file included from vapMembrane/vapMembraneFvPatchField.H:195:0,
                 from vapMembrane/vapMembraneFvPatchFields.H:29,
                 from vapMembrane/vapMembraneFvPatchFields.C:28:
vapMembrane/vapMembraneFvPatchField.C: In member function ‘virtual void Foam::vapMembraneFvPatchField<Type>::updateCoeffs()’:
vapMembrane/vapMembraneFvPatchField.C:133:47: error: no match for call to ‘(const Foam::Field<double>) ()’
     this->valueFraction() = 1.0 - alphaMatrix();
                                               ^
In file included from /opt/openfoam230/src/OpenFOAM/lnInclude/token.H:49:0,
                 from /opt/openfoam230/src/OpenFOAM/lnInclude/UListIO.C:28,
                 from /opt/openfoam230/src/OpenFOAM/lnInclude/UList.C:239,
                 from /opt/openfoam230/src/OpenFOAM/lnInclude/UList.H:473,
                 from /opt/openfoam230/src/OpenFOAM/lnInclude/List.H:43,
                 from /opt/openfoam230/src/OpenFOAM/lnInclude/fileNameList.H:42,
                 from /opt/openfoam230/src/OpenFOAM/lnInclude/OSspecific.H:39,
                 from /opt/openfoam230/src/OpenFOAM/lnInclude/regIOobject.H:43,
                 from /opt/openfoam230/src/OpenFOAM/lnInclude/GeometricField.H:42,
                 from /opt/openfoam230/src/OpenFOAM/lnInclude/GeometricScalarField.H:38,
                 from /opt/openfoam230/src/OpenFOAM/lnInclude/GeometricFields.H:34,
                 from /opt/openfoam230/src/finiteVolume/lnInclude/volFields.H:37,
                 from vapMembrane/vapMembraneFvPatchFields.C:26:
/opt/openfoam230/src/finiteVolume/lnInclude/fvPatchField.H: In instantiation of ‘static Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::addpatchConstructorToTable<fvPatchFieldType>::New(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&) [with fvPatchFieldType = Foam::vapMembraneFvPatchField<double>; Type = double]’:
/opt/openfoam230/src/finiteVolume/lnInclude/fvPatchField.H:120:9:   required from ‘Foam::fvPatchField<Type>::addpatchConstructorToTable<fvPatchFieldType>::addpatchConstructorToTable(const Foam::word&) [with fvPatchFieldType = Foam::vapMembraneFvPatchField<double>; Type = double]’
vapMembrane/vapMembraneFvPatchFields.C:38:1:   required from here
/opt/openfoam230/src/OpenFOAM/lnInclude/runTimeSelectionTables.H:76:66: error: no matching function for call to ‘Foam::vapMembraneFvPatchField<double>::vapMembraneFvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<double, Foam::volMesh>&)’
             return autoPtr< baseType >(new baseType##Type parList);           \
                                                                  ^
/opt/openfoam230/src/finiteVolume/lnInclude/fvPatchField.H:120:9: note: in expansion of macro ‘declareRunTimeSelectionTable’
         declareRunTimeSelectionTable
         ^
/opt/openfoam230/src/OpenFOAM/lnInclude/runTimeSelectionTables.H:76:66: note: candidates are:
             return autoPtr< baseType >(new baseType##Type parList);           \
                                                                  ^
/opt/openfoam230/src/finiteVolume/lnInclude/fvPatchField.H:120:9: note: in expansion of macro ‘declareRunTimeSelectionTable’
         declareRunTimeSelectionTable
         ^
In file included from vapMembrane/vapMembraneFvPatchField.H:195:0,
                 from vapMembrane/vapMembraneFvPatchFields.H:29,
                 from vapMembrane/vapMembraneFvPatchFields.C:28:
vapMembrane/vapMembraneFvPatchField.C:105:1: note: Foam::vapMembraneFvPatchField<Type>::vapMembraneFvPatchField(const Foam::vapMembraneFvPatchField<Type>&, const Foam::DimensionedField<Type, Foam::volMesh>&) [with Type = double]
 Foam::vapMembraneFvPatchField<Type>::vapMembraneFvPatchField
 ^
vapMembrane/vapMembraneFvPatchField.C:105:1: note:   no known conversion for argument 1 from ‘const Foam::fvPatch’ to ‘const Foam::vapMembraneFvPatchField<double>&’
vapMembrane/vapMembraneFvPatchField.C:94:1: note: Foam::vapMembraneFvPatchField<Type>::vapMembraneFvPatchField(const Foam::vapMembraneFvPatchField<Type>&) [with Type = double]
 Foam::vapMembraneFvPatchField<Type>::vapMembraneFvPatchField
 ^
vapMembrane/vapMembraneFvPatchField.C:94:1: note:   candidate expects 1 argument, 2 provided
vapMembrane/vapMembraneFvPatchField.C:50:1: note: Foam::vapMembraneFvPatchField<Type>::vapMembraneFvPatchField(const Foam::vapMembraneFvPatchField<Type>&, const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::fvPatchFieldMapper&) [with Type = double]
 Foam::vapMembraneFvPatchField<Type>::vapMembraneFvPatchField
 ^
vapMembrane/vapMembraneFvPatchField.C:50:1: note:   candidate expects 4 arguments, 2 provided
vapMembrane/vapMembraneFvPatchField.C:64:1: note: Foam::vapMembraneFvPatchField<Type>::vapMembraneFvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with Type = double]
 Foam::vapMembraneFvPatchField<Type>::vapMembraneFvPatchField
 ^
vapMembrane/vapMembraneFvPatchField.C:64:1: note:   candidate expects 3 arguments, 2 provided
vapMembrane/vapMembraneFvPatchField.C:31:1: note: Foam::vapMembraneFvPatchField<Type>::vapMembraneFvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const volScalarField&) [with Type = double; Foam::volScalarField = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>]
 Foam::vapMembraneFvPatchField<Type>::vapMembraneFvPatchField
 ^
vapMembrane/vapMembraneFvPatchField.C:31:1: note:   candidate expects 3 arguments, 2 provided
I just pasted the first of the error message.
It seems that alphaMatrix, which should contain the volume fraction of liquid polymer, is not accessible. I'm running openfoam 2.3.0. Please find in attachment my alpha.matrix file which defines the volume fractions of liquid at t=0.

Thank you in advance for your help.
Peter
Attached Files
File Type: txt alpha.matrix.txt (1.5 KB, 8 views)
John Degenkolb 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
outlet boundary condition Arman FLUENT 2 September 22, 2007 13:08
how to set boundary condition for a tank filling w namrata FLUENT 6 May 2, 2007 10:23
VOF Outlet boundary condition in cfd - ace JM Main CFD Forum 0 December 15, 2006 08:07
outlet condition in SEM Anis Phoenics 0 May 5, 2006 09:38
outlet Boundary condition Tol na Deen CFX 2 July 23, 2002 08:49


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