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

Problem with reading field values into a costomized noundary condition

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 14, 2016, 03:55
Default Problem with reading field values into a costomized noundary condition
  #1
Member
 
Lee Jung Hoo
Join Date: Dec 2015
Posts: 37
Rep Power: 10
Jung hoo is on a distinguished road
Hi, I have a trouble in reading field values.(like U or p, etc.)

I modified interFoam as below.

Quote:
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
# include "readPIMPLEControls.H"
# include "readTimeControls.H"
# include "CourantNo.H"
# include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
// Pressure-velocity corrector
int oCorr = 0;
do
{
twoPhaseProperties.correct();
# include "alphaEqnSubCycle.H"
# include "UEqn.H"
// --- PISO loop
for (int corr = 0; corr < nCorr; corr++)
{
# include "pEqn.H"
}
# include "continuityErrs.H"
p = pd + rho*gh;
if (pd.needReference())
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pdRefCell)
);
}
turbulence->correct();
//correction
Info<< "Time = " << runTime.timeName() << nl << endl;
# include "readSIMPLEControls.H"

volSymmTensorField Reff(turbulence->devReff());
volVectorField wallShearStress
(
IOobject
(
"wallShearStress",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedVector
(
"wallShearStress",
Reff.dimensions(),
vector::zero
)
);
forAll(wallShearStress.boundaryField(), patchi)
{
wallShearStress.boundaryField()[patchi] =
(
-mesh.Sf().boundaryField()[patchi]
/mesh.magSf().boundaryField()[patchi]
) & Reff.boundaryField()[patchi];
}
runTime.write();
It's quite similar with existing interFoam solver, but I added code to calculate 'wallShearStress' (bold writing).

This modified solver works well.

But when I tried to read the wallShearStress field into my new boundary condition using

Quote:
const volVectorField& wallShearStress = db().lookupObject<volVectorField>("wallShearStress ");
The compile is done with no trouble, but I get error message as below when I run application.

Quote:
--> FOAM FATAL ERROR:
request for volVectorField wallShearStress from objectRegistry region0 failed
available objects of type volVectorField are
3
(
U_0
U
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
I guess probably the 'wallShearStress' on my own solver does not be resisted properly in the 'objectRegistry'.

How can I make a new field resisted in 'objectRegistry' properly like U or p?

Any comments will help me a lot. Thanks!
Jung hoo is offline   Reply With Quote

Old   September 14, 2016, 07:58
Default
  #2
New Member
 
Ehsan Mahravan
Join Date: Dec 2014
Location: Tehran, Iran
Posts: 9
Rep Power: 11
EhsanMh is on a distinguished road
Hi,

substitute MUST_READ with NO_READ
EhsanMh is offline   Reply With Quote

Old   September 14, 2016, 22:15
Default
  #3
Member
 
Lee Jung Hoo
Join Date: Dec 2015
Posts: 37
Rep Power: 10
Jung hoo is on a distinguished road
Thank you for your fast reply Ehsan!

Actually, I already have tried that, but it didn't work.


With that code that I posted, the 'wallShearStress' files are made from the folder that is next time-step of 0 folder while other object files(like U or p) are made from 0 folder.


I think my problem can be solved if the 'wallShearStress' files can be made from 0 folder like U or p file.


Can you advise me about that please?
Jung hoo is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Cht tutorial in 15 braennstroem OpenFOAM Running, Solving & CFD 197 June 10, 2015 04:02
''unknown radialModelType type Gidaspow'' PROBLEM WITH THE BED TUTORIAL AndoniBM OpenFOAM Running, Solving & CFD 2 March 25, 2015 19:44
Coupling two unequal dimension meshes. RaghavendraRohith OpenFOAM Programming & Development 7 June 14, 2014 12:40
[Commercial meshers] fluentMeshToFoam multidomain mesh conversion problem Attesz OpenFOAM Meshing & Mesh Conversion 12 May 2, 2013 11:52
Reading field values and setting them as boundary conditions sega OpenFOAM Running, Solving & CFD 1 July 7, 2009 07:18


All times are GMT -4. The time now is 05:37.