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/)
-   -   MembraneFOAM RO BC warning (https://www.cfd-online.com/Forums/openfoam-programming-development/225388-membranefoam-ro-bc-warning.html)

JF.R.Piche March 25, 2020 11:17

MembraneFOAM RO BC warning
 
1 Attachment(s)
Hello everyone,

I'm trying to use the reverse osmosis boundary condition from MembraneFOAM, but I'm getting a warning when compiling.

I'm using OpenFOAM v1912, and I dl the branch OF5 from MembraneFOAM git, available here, as suggested in a previous thread. I already did some changes :
- syntax of writeIfDifferent function, which I copy-pasted from another BC (something like writeIfDifferent<word>( os , ... ) became os.writeIfDifferent<word>( ... ) )
- deleted the reference to the triSurface lib (because it's not in src anymore, I'll try with a dummy case see if it's a problem)
- deleted the fm_ attribute and the calcFaceMapping() function. This is because I would like to use it as a boundary, and not a baffle.

I essentially need the RO BC, so that's where we'll stick for now (except if something else is needed).

So I want to compile the RO BC (sources files are attached), and I get a warning related to each constructor, as following :

Code:

RO_BC/explicitROmembraneSolute/explicitROmembraneSoluteFvPatchScalarField.C:136:18:  warning:  ‘Foam::dimensioned<Type>::dimensioned(Foam::Istream&) [with  Type = double]’ is deprecated: Since 2018-11 [-Wdeprecated-declarations]
    GBC_(p.size())
                  ^
In file included from /home/leo/OpenFOAM/OpenFOAM-v1912/src/OpenFOAM/lnInclude/dimensionedType.H:565:0,
                from /home/leo/OpenFOAM/OpenFOAM-v1912/src/OpenFOAM/lnInclude/DimensionedField.H:46,
                from /home/leo/OpenFOAM/OpenFOAM-v1912/src/finiteVolume/lnInclude/fvPatchField.H:51,
                from RO_BC/explicitROmembraneSolute/explicitROmembraneSoluteFvPatchScalarField.H:65,
                from RO_BC/explicitROmembraneSolute/explicitROmembraneSoluteFvPatchScalarField.C:27:
/home/leo/OpenFOAM/OpenFOAM-v1912/src/OpenFOAM/lnInclude/dimensionedType.C:275:1: note: declared here
 Foam::dimensioned<Type>::dimensioned(Istream& is)
 ^~~~

Here GBC is defined as
Code:

        //- gradientBoundaryCoefficients
        Field<scalar> GBC_;

and the constructor involed is :
Code:

explicitROmembraneSoluteFvPatchScalarField::explicitROmembraneSoluteFvPatchScalarField
(
    const fvPatch& p,
    const DimensionedField<scalar, volMesh>& iF,
    const dictionary& dict
)
:
    fvPatchField<scalar>(p, iF),
    transProps_
    (
        IOobject
        (
            "transportProperties",
            this->db().time().constant(),
            this->db(),
            IOobject::MUST_READ,
            IOobject::NO_WRITE,
            true
        )
    ),
    UName_(dict.lookupOrDefault<word>("U", "U")),
    R_(readScalar(dict.lookup("R"))),
    D_AB_Min_(transProps_.lookup("D_AB_Min")),
    D_AB_Coeff_(transProps_.lookup("D_AB_Coeff")),
    D_AB_mACoeff_(transProps_.lookup("D_AB_mACoeff")),
    rho0_(transProps_.lookup("rho0")),
    rho_mACoeff_(transProps_.lookup("rho_mACoeff")),
    VIC_(p.size()),
    VBC_(p.size()),
    GIC_(p.size()),
    GBC_(p.size())
{
    if (dict.found("value"))
    {
        fvPatchField<scalar>::operator=
        (
            scalarField("value", dict, p.size())
        );
    }
    else
    {
        // initialise the field to 0.0 if no information is given
        fvPatchField<scalar>::operator=(pTraits<scalar>::zero);
    }
}

From what I understood so far, that mean that the dimensionedDouble class doesn't exist anymore. But I'm never calling one on them. However, I do call dimensionedScalar, and it could be that Scalar = Double (if think I read it somewhere in my researches).

Even if it's not a critical problem (I can compile) I would be interested to correct this, and my very basic knowledge of C++ doesn't allow me to do so.

Thank you in advance for your help!

Léo

alexeym March 26, 2020 04:23

Hi,

If fact the warning is about these lines:

Code:

    D_AB_Min_(transProps_.lookup("D_AB_Min")),
    D_AB_Coeff_(transProps_.lookup("D_AB_Coeff")),
    D_AB_mACoeff_(transProps_.lookup("D_AB_mACoeff")),
    rho0_(transProps_.lookup("rho0")),
    rho_mACoeff_(transProps_.lookup("rho_mACoeff")),

they should become:

Code:

    D_AB_Min_("D_AB_Min", transProps_),
    ...

You can find correct constructor here: https://openfoam.com/documentation/g...mensioned.html.

JF.R.Piche March 26, 2020 04:41

Indeed, it works!
Thank you very much for your help! ;)



For anyone passing by, I might commit these change to MembraneFoam in the future!


Léo


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