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

massflowrateVelocity Coupled Boundary Condition in fireFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By charles4allme
  • 1 Post By Zhiheng Wang

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 1, 2015, 13:29
Default massflowrateVelocity Coupled Boundary Condition in fireFoam
  #1
Member
 
Mehtab
Join Date: Jan 2015
Posts: 41
Rep Power: 11
mehtab is on a distinguished road
Dear Foamers,

I am trying to implement a mass flow boundary condition from past few days. But I think I could not go further without any help.

Here is my code:

Code:
void Foam::customflowRateInletVelocityFvPatchVectorField::updateCoeffs()
{
    if (updated())
    {
        return;
    }

    const basicThermo& thermo =
        db().lookupObject<basicThermo>("thermophysicalProperties");

    const singleStepReactingMixture<gasHThermoPhysics>& singleMixture
    (
        dynamic_cast<const singleStepReactingMixture<gasHThermoPhysics>&>
        //refCast<const singleStepReactingMixture<gasThermoPhysics> >
        (thermo)
    );
    const label patchI = patch().index();

    const scalarField& Yfg = thermo.composition().Y(0).internalField();
    const compressible::LESModel& turbulence =
        db().lookupObject<compressible::LESModel>
        (
            "LESProperties"
        );

    const dictionary& transportProperties = db().lookupObject<IOdictionary>
    (
        "transportProperties"        
    );
    dictionary mySubDict
    (
        transportProperties.subDict("mySubDict")    
    );

    dimensionedScalar nu_(mySubDict.lookup("nu"));

  //  const fvMesh& mesh = patch().boundaryMesh().mesh();
    
    const volScalarField& Ts = db().lookupObject<volScalarField>("T");
    const volScalarField& P_ = db().lookupObject<volScalarField>("P");

    //heat of vaporization in J/kg
    scalar hv=510830.00; 
    //boiling temperature in K
    scalar Tb=111.67;
    //Molecular weight in kg/mol
    scalar Wf=0.016043;
    //universal gas constant J/mol.K
    scalar R=8.31444621;
 //   scalar nu=26.4e-6;
    scalar L=0.3;

  //  scalar alpha=38.3e-6;
    

    const fvPatchField<scalar>& rhop =
            patch().lookupPatchField<volScalarField, scalar>(rhoName_);

    scalarList phi =
        patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);

    const scalarField alphap =
        turbulence.alphaEff()().boundaryField()[patchI];

    const volVectorField& Up = db().lookupObject<volVectorField>("U");

    scalar ReL = mag(Up)*L /(nu_);

    scalar ScL = nu_ / (alphap);

    scalar ShL = 0.037*pow(ScL,1/3)*pow(ReL,4/5);

    scalar hm = ShL*alphap/L;
            

    //volume fraction of liquid fuel in gas phase

    double Yfl = exp(-hv*Wf*(1/R)*((1/Ts)-(1/Tb)));

    // convert to equivalent gaseous fuel
    phi = hm*P_*Wf/(R*Ts)*log((Yfg-1.)/(Yfl-1.));
  

    const surfaceScalarField& phiName =
        db().lookupObject<surfaceScalarField>(phiName_);
  
    scalarField U = -phi/patch().magSf();

    vectorField n = patch().nf();

//    const surfaceScalarField& phi =
//        db().lookupObject<surfaceScalarField>(phiName_);

    if (phiName.dimensions() == dimVelocity*dimArea)
    {
        // volumetric flow-rate
        operator==(n*U);
    }
    else if (phiName.dimensions() == dimDensity*dimVelocity*dimArea)
    {
        const fvPatchField<scalar>& rhop =
            patch().lookupPatchField<volScalarField, scalar>(rhoName_);

        // mass flow-rate
        operator==(n*U/rhop);

        if (debug)
        {
            scalar phi = gSum(rhop*(*this) & patch().Sf());
            Info<< patch().boundaryMesh().mesh().name() << ':'
                << patch().name() << ':'
                << this->dimensionedInternalField().name() << " <- "
//                << nbrMesh.name() << ':'
//                << nbrPatch.name() << ':'
                << this->dimensionedInternalField().name() << " :"
                << " mass flux[Kg/s]:" << -phi
                << endl;
        }
    }
and here is the error messgae:

customflowRateInletVelocityFvPatchVectorField/customflowRateInletVelocityFvPatchVectorField.C: In member function ‘virtual void Foam::customflowRateInletVelocityFvPatchVectorFiel d::updateCoeffs()’:
customflowRateInletVelocityFvPatchVectorField/customflowRateInletVelocityFvPatchVectorField.C:16 0:37: error: ‘const class Foam::basicThermo’ has no member named ‘composition’
const scalarField& Yfg = thermo.composition().Y(0).internalField();
^
customflowRateInletVelocityFvPatchVectorField/customflowRateInletVelocityFvPatchVectorField.C:21 2:33: error: cannot convert ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >’ to ‘Foam::scalar {aka double}’ in initialization
scalar ReL = mag(Up)*L /(nu_);
^
customflowRateInletVelocityFvPatchVectorField/customflowRateInletVelocityFvPatchVectorField.C:21 6:28: error: ‘ScL’ was not declared in this scope
scalar ShL = 0.037*pow(ScL,1/3)*pow(ReL,4/5);
^
customflowRateInletVelocityFvPatchVectorField/customflowRateInletVelocityFvPatchVectorField.C:21 8:28: error: cannot convert ‘Foam::tmp<Foam::Field<double> >’ to ‘Foam::scalar {aka double}’ in initialization
scalar hm = ShL*alphap/L;
^
customflowRateInletVelocityFvPatchVectorField/customflowRateInletVelocityFvPatchVectorField.C:22 3:50: error: cannot convert ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >’ to ‘double’ in initialization
double Yfl = exp(-hv*Wf*(1/R)*((1/Ts)-(1/Tb)));
^
customflowRateInletVelocityFvPatchVectorField/customflowRateInletVelocityFvPatchVectorField.C:15 2:57: warning: unused variable ‘singleMixture’ [-Wunused-variable]
const singleStepReactingMixture<gasHThermoPhysics>& singleMixture
^
customflowRateInletVelocityFvPatchVectorField/customflowRateInletVelocityFvPatchVectorField.C:20 1:33: warning: unused variable ‘rhop’ [-Wunused-variable]
const fvPatchField<scalar>& rhop =
^
customflowRateInletVelocityFvPatchVectorField/customflowRateInletVelocityFvPatchVectorField.dep: 697: recipe for target 'Make/linux64GccDPOpt/customflowRateInletVelocityFvPatchVectorField.o' failed
make: *** [Make/linux64GccDPOpt/customflowRateInletVelocityFvPatchVectorField.o] Error 1


1) I am trying to access fuel mass fraction Yfg from the solver. the error says basicthermo has no member named composition. I saw similar codes in other post for calculating fuel mass fraction and used it. How can I access fuel mass fraction inside boundary condition patch?
2) I want to make sure if code for accessing kinematic viscosity is correct or not. Please comment.
3) For calculating ReL,ScL and ShL, it shows similar like "error: cannot convert ‘Foam::tmp<Foam::Field<double> >’ to ‘Foam::scalar {aka double}’ in initialization". I know there is some problem in accessing nu and alpha as scalar while I am accessing them as fields. Please help me to sort out these errors.

Thanks in advance.....
mehtab is offline   Reply With Quote

Old   July 22, 2019, 06:39
Default
  #2
Member
 
Join Date: Feb 2018
Posts: 91
Rep Power: 8
charles4allme is on a distinguished road
Hey,

were you able to figure it out?

Regards,
Okorie
Zhiheng Wang likes this.
charles4allme is offline   Reply With Quote

Old   July 22, 2019, 10:38
Default
  #3
Member
 
Zhiheng Wang
Join Date: Mar 2016
Posts: 72
Rep Power: 10
Zhiheng Wang is on a distinguished road
please claify your objective what you want to add or achieve , I have corrected and written this boundary condition.

Regards
Zhiheng Wang is offline   Reply With Quote

Old   July 22, 2019, 10:42
Default
  #4
Member
 
Zhiheng Wang
Join Date: Mar 2016
Posts: 72
Rep Power: 10
Zhiheng Wang is on a distinguished road
If you are trying to put a liquid pool interface boundary condition you dont need to go to region-Models.


As your equation suggest you are trying for mass flux based on Clausius-Clapeyron equation and stefan flow velocity.


In such case see for my previous posts you will get exact boundary condition you can compile.


Regards
charles4allme likes this.
Zhiheng Wang is offline   Reply With Quote

Old   July 26, 2019, 06:46
Default
  #5
Member
 
Join Date: Feb 2018
Posts: 91
Rep Power: 8
charles4allme is on a distinguished road
Hi Zhiheng,

I have gone through your posts again and I came across a boundary condition that you attached. I have attached it also so if possible you can confirm if its the same one. I have gone through it and it seems that you made use of the Clausius-Clapeyron relation to get the volume fraction but I don't believe you made use of the Stefan diffusion for the velocity unless it has different formulas.
My problem is with using fireFoam, I can't get the volume fraction of the fuel vapor when implementing as a boundary condition. Is it possible to calculate it using the mass fraction of Oxygen and Nitrogen.
Attached Files
File Type: c my_boundary best.c (9.3 KB, 7 views)
charles4allme 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
several fields modified by single boundary condition schröder OpenFOAM Programming & Development 3 April 21, 2015 05:09
[swak4Foam] groovyBC for coupled boundary condition yeharav OpenFOAM Community Contributions 2 July 6, 2014 01:34
Velocity profile boundary condition Tuca FLOW-3D 1 April 23, 2013 12:02
CFX fails to calculate a diffuser pipe flow shenying0710 CFX 7 March 26, 2013 04:13
regarding coupled boundary condition VAIBHAV Main CFD Forum 0 November 9, 2007 19:40


All times are GMT -4. The time now is 23:54.