CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

How to call mDot used in different header file?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 27, 2022, 03:06
Default How to call mDot used in different header file?
  #1
Member
 
hari charan
Join Date: Sep 2021
Location: India,hyderabad
Posts: 97
Rep Power: 5
saicharan662000@gmail.com is on a distinguished road
I need to call mDot used in twophasemixtureThermo.H and twophasemixtureThermo.C file in PEqn.H file. I ran the twoPhaseMixtureThermo . it didnt give any error.But when I ran solver I got above error.I am attaching the files below. Can anyone help me?



-lm -o /home/hari/OpenFOAM/hari-8/platforms/linux64GccDPInt32Opt/bin/myCompressibleInterFoam /usr/bin/ld.bfd: Make/linux64GccDPInt32Opt/myCompressibleInterFoam.o: in function `main': myCompressibleInterFoam.C.text.startup+0x1396): undefined reference to `Foam::twoPhaseMixtureThermo::mDot() const' /usr/bin/ld.bfd: myCompressibleInterFoam.C.text.startup+0x3728): undefined reference to `Foam::twoPhaseMixtureThermo::mDot() const' /usr/bin/ld.bfd: myCompressibleInterFoam.C.text.startup+0xb4cf): undefined reference to `Foam::twoPhaseMixtureThermo::mDot() const' collect2: error: ld returned 1 exit status make: *** [/opt/openfoam8/wmake/makefiles/general:142: /home/hari/OpenFOAM/hari-8/platforms/linux64GccDPInt32Opt/bin/myCompressibleInterFoam] Error 1


twoPhaseMixtureThermo.H

class twoPhaseMixtureThermo
:
public psiThermo,
public twoPhaseMixture,
public interfaceProperties
{
public:
// Private Data

//- Thermo-package of phase 1
autoPtr<rhoThermo> thermo1_;

//- Thermo-package of phase 2
autoPtr<rhoThermo> thermo2_;
//ADDED

dimensionedScalar lambdaF_; // thermal conductivity [kg*m/s3/K]
dimensionedScalar Tsat_; // saturation temp [K]
dimensionedScalar Tinf_; // bulk temperature of the water [K]
dimensionedScalar ifg_; // latent heat for for fluid [m2/s2]
dimensionedScalar charLength_; //characteristic length
dimensionedScalar g_; // gravity

dimensionedScalar mcCoeff_; // mass condensation coefficient for better view

// interface area function
tmp<volScalarField>interfaceArea() const; // interfacial area [m2]
// heat transfer coefficient
tmp<volScalarField> hCoeff() const; // heat transfer coefficient missing division by (Tsat_-Tinf)^(1/5)

tmp<volScalarField> mDot() const;

twoPhaseMixtureThermo.C

#include "twoPhaseMixtureThermo.H"
#include "gradientEnergyFvPatchScalarField.H"
#include "mixedEnergyFvPatchScalarField.H"
#include "collatedFileOperation.H"

// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

namespace Foam
{
defineTypeNameAndDebug(twoPhaseMixtureThermo, 0);
}


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

Foam::twoPhaseMixtureThermo::twoPhaseMixtureThermo
(
const volVectorField& U,
const surfaceScalarField& phi
)
:
psiThermo(U.mesh(), word::null),
twoPhaseMixture(U.mesh(), *this),
interfaceProperties(alpha1(), U, *this),
thermo1_(nullptr),
thermo2_(nullptr),

lambdaF_("lambdaF", dimMass*dimLength/(dimTime*dimTime*dimTime*dimTemperature) , lookup("lambdaF")),
Tsat_("Tsat",dimTemperature, lookup("Tsat")),
Tinf_("Tinf",dimTemperature, lookup("Tinf")),
ifg_("ifg", dimLength*dimLength/(dimTime*dimTime),lookup("ifg")),
charLength_("charLength", dimLength, lookup("charLength")),
g_("gravity", dimLength/(dimTime*dimTime) ,lookup("gravity")),
mcCoeff_( (Tsat_-Tinf_) / ifg_ )
{
{
volScalarField T1
(
IOobject
(
IOobject::groupName("T", phase1Name()),
U.mesh().time().timeName(),
U.mesh()
),
T_,
calculatedFvPatchScalarField::typeName
);
T1.write();
}

{
volScalarField T2
(
IOobject
(
IOobject::groupName("T", phase2Name()),
U.mesh().time().timeName(),
U.mesh()
),
T_,
calculatedFvPatchScalarField::typeName
);
T2.write();
}

// Note: we're writing files to be read in immediately afterwards.
// Avoid any thread-writing problems.
fileHandler().flush();

thermo1_ = rhoThermo::New(U.mesh(), phase1Name());
thermo2_ = rhoThermo::New(U.mesh(), phase2Name());

// thermo1_->validate(phase1Name(), "e");
// thermo2_->validate(phase2Name(), "e");

correct();
}


// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

Foam::twoPhaseMixtureThermo::~twoPhaseMixtureTherm o()
{}


// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::twoPhaseMixtureThermo::interfaceArea() const
{
// return the interfacial area based on model for interfacial area
// returns dimensions Area

// model based on regular volume cells, taking the largest cut area
// as maximum for area, linear increase and decrease with alpha
const volScalarField& cellVolume =
alpha1().db().lookupObject<volScalarField>("cellVo lu");
volScalarField limitedAlpha1 = min(max(alpha1(), scalar(0)), scalar(1));

const dimensionedScalar
areaFactor("areaFactor",dimensionSet(0,2,0,0,0,0,0 ), 0.0);

volScalarField interfaceArea = alpha1() * areaFactor;
volScalarField maxArea = alpha1() * areaFactor;

maxArea = sqrt(3.0)*pow(cellVolume,(2.0/3.0));
return tmp<volScalarField>
(
(neg(limitedAlpha1-0.5)*maxArea*2.0*limitedAlpha1) +
(pos(limitedAlpha1-0.5)*maxArea*(-2.0*( limitedAlpha1 - 1.0)))
);

}
//ADDED
Foam::tmp<Foam::volScalarField>
Foam::twoPhaseMixtureThermo::hCoeff() const
{
// from [Bejan, Convection heat transfer, 1995]

return
(
1.079 * (lambdaF_ / charLength_ ) * pow(
(pow3(charLength_) * ifg_ * g_ * (thermo1_->rho()-thermo2_->rho()) ) /
(lambdaF_ * nu() * (Tsat_ - Tinf_) ) , 0.2 )
);
}
//ADDED
Foam::tmp<Foam::volScalarField>
Foam::twoPhaseMixtureThermo::mDotAlphal() const
{
// return dimensions [kg/m3/s]
// return condensation divided by (1-alpha)


volScalarField interfaceArea = this->interfaceArea();
volScalarField hCoeff = this->hCoeff();

Info << "Max interFaceArea: " << max(interfaceArea).value() << " m2" <<endl;
Info << "Max Heat transfer coefficient: " << max(hCoeff).value() << " W/m2/K" << endl;

return tmp<volScalarField>
(

(hCoeff * mcCoeff_ * interfaceArea)

);
}

//ADDED
Foam::tmp<Foam::volScalarField>
Foam::twoPhaseMixtureThermo::mDot() const
{

const dimensionedScalar
zeroFactor("zeroFactor",dimensionSet(0,0,0,0,0,0,0 ), 0.0);

volScalarField mDot = mDotAlphal() * zeroFactor;
return tmp<volScalarField>
(
mDotAlphal() * 1
);
}

PEqn.H
// Cache p_rgh prior to solve for density update
volScalarField p_rgh_0(p_rgh);
//ADDED
const volScalarField& mDot = mixture.mDot();
//
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix p_rghEqnIncomp
(
fvc::div(phiHbyA)
- fvm::laplacian(rAUf, p_rgh)
- (mDot/rho1)
+ (mDot/rho2) //mDot here should be computed from twoPhaseMixtureThermo
);

solve
(
p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp
);

saicharan662000@gmail.com is offline   Reply With Quote

Reply

Tags
compressibleinterfoam, interfoam, openfoam, openfoam 8


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
[swak4Foam] swak4foam for OpenFOAM 4.0 mnikku OpenFOAM Community Contributions 80 May 17, 2022 09:06
[swak4Foam] Installation Problem with OF 6 version Aurel OpenFOAM Community Contributions 14 November 18, 2020 17:18
centOS 5.6 : paraFoam not working yossi OpenFOAM Installation 2 October 9, 2013 02:41
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 14:59
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 20:08


All times are GMT -4. The time now is 16:11.