CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

How can I load other objects like U or alpha1 when making a new boundary condition?

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By Jung hoo

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 10, 2016, 14:48
Default How can I load other objects like U or alpha1 when making a new boundary condition?
  #1
Member
 
Lee Jung Hoo
Join Date: Dec 2015
Posts: 37
Rep Power: 10
Jung hoo is on a distinguished road
Hi, I'm trying to create my own boundary condition.

I'm modifying the Member Function from parabolicVelocityFvPatchVectorField.C(i.e, I chose parabolicVelocityFvPatchVectorField.C as the base)

When I tried to read field values like U or p on the boundary function, compiling was successfully done, but I get the error message as belows when I run "setFields" on an example case based on interFoam.

Quote:
--> FOAM Warning :
From function dlLibraryTableOpen(const fileName& functionLibName)
in file db/dlLibraryTable/dlLibraryTable.C at line 85
could not load /home/lee/foam/lee-3.1/lib/linux64GccDPOpt/libmyfunctionfinal2.so: undefined symbol: _ZTVN4Foam15twoPhaseMixtureE
And then, when I run application(interFoam), an error message is shown :

Quote:
Reading field T

--> FOAM FATAL ERROR:
request for volVectorField U from objectRegistry region0 failed
available objects of type volVectorField are
1
(
T
)

From function objectRegistry::lookupObject<Type>(const word&) const
in file /home/lee/foam/foam-extend-3.1/src/foam/lnInclude/objectRegistryTemplates.C at line 139.
FOAM aborting
Aborted (core dumped)
I used these commans for reading the field values(U, phi, alpha1)

Quote:
const volVectorField& U = db().lookupObject<volVectorField>("U");
const surfaceScalarField& phi = db().lookupObject<surfaceScalarField>("phi");
const volScalarField& alpha1 = db().lookupObject<volScalarField>("alpha1");
I'm beginner in programming, so I guess I'm missing a simple thing...

this is a part of Member Function:

Quote:
void cbVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
const fvMesh& mesh = dimensionedInternalField().mesh();
//const fvMesh& mesh = patch().boundaryMesh().mesh();
const word& patchName = this->patch().name();
const label patchID = mesh.boundaryMesh().findPatchID(patchName);
const volVectorField& U = db().lookupObject<volVectorField>("U");
const surfaceScalarField& phi = db().lookupObject<surfaceScalarField>("phi");
const volScalarField& alpha1 = db().lookupObject<volScalarField>(alphaName());
//volVectorField U("U", U);
//surfaceScalarField phi("phi", phi);
//volScalarField alpha1("alpha1", alpha1);
twoPhaseMixture twoPhaseProperties(U, phi, "alpha1");
autoPtr<incompressible::turbulenceModel> turbulence
(
incompressible::turbulenceModel::New(U, phi, twoPhaseProperties)
);
volSymmTensorField Reff(turbulence->devReff());

scalar rho = 1000;
scalar nu = 1e-06;
scalar mu = nu*rho;
scalar g = 9.81;
scalar s = 1.4;
scalar d = 0.005;
scalar shieldsc = 0.05;
scalar kappa = 0.8;
scalar c0 = 3;
//scalar Alpha1 = 0.8*mathematicalConstantPi;
scalar Alpha1 = 2;
scalarField wallShearStress = rho*mag((-mesh.Sf().boundaryField()[patchID]/mesh.magSf().boundaryField()[patchID]) & Reff.boundaryField()[patchID]);
scalarField shields = (wallShearStress)/(rho*(s-1)*g*d);
scalarField PEF = (pow((1+pow4((((1/6)*mathematicalConstantPi*mu)/(shields-shieldsc)))), -(1/4)));
scalarField linearC = sqrt(((sqr(kappa)*sqr(Alpha1))*(shields-shieldsc-((1/6)*mathematicalConstantPi*mu*PEF)))/(0.013*s*shields));
scalarField cb = c0/pow3((1+(1/linearC)));
vectorField n = patch().nf();
vectorFieldOperator=(-n*cb);
Any comments will help me a lot!
Thank you in advance!!
atulkjoy and Zhiheng Wang like this.

Last edited by Jung hoo; September 11, 2016 at 08:19.
Jung hoo 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
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 03:30
Problem in setting Boundary Condition Madhatter92 CFX 12 January 12, 2016 04:39
several fields modified by single boundary condition schröder OpenFOAM Programming & Development 3 April 21, 2015 05:09
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 06:28
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 13:59


All times are GMT -4. The time now is 21:07.