CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Getting old values of psi internal

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

Like Tree1Likes
  • 1 Post By ffbof

Reply
 
LinkBack Thread Tools Display Modes
Old   August 27, 2008, 07:23
Default Hello i want to have the psi
  #1
New Member
 
Franz
Join Date: Mar 2009
Posts: 17
Rep Power: 8
ffbof is on a distinguished road
Hello
i want to have the psi internal values of a previous time step to access them in the updateInterfaceMatrix function of my fvPatchField.

The updateInterfaceMatrix has a parameter lduMatrix& which is the base class for the fvMatrix which has a function psi() to access the psi value.

But i cannot cast the lduMatrix into the fvMatrix so my question is how to downcast from the const lduMatrix& to fvMatrix& is that possible in OpenFOAM framework ?.
ffbof is offline   Reply With Quote

Old   August 27, 2008, 07:36
Default You have to be a bit careful,
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,758
Rep Power: 21
hjasak will become famous soon enough
You have to be a bit careful, depending where the cast is, eg. you should probably be in templated code. Otherwise, it's easy:

psi().oldTime().internalField()

Enjoy,

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   August 27, 2008, 09:25
Default Thank you very much for the fa
  #3
New Member
 
Franz
Join Date: Mar 2009
Posts: 17
Rep Power: 8
ffbof is on a distinguished road
Thank you very much for the fast answer Mr Jasak,

in my case it is about the following method of a coupledFvPatchField derived class.

initInterfaceMatrixUpdate
(
const scalarField& psiInternal,
scalarField&,
const lduMatrix& matrix,
const scalarField&,
const direction,
const bool bufferdTransfer
) const
{
// here i want to cast the lduMatrix down to the // fvMatrix i tried the following

const fvMatrix<type>& test =
dynamic_cast<const> >(matrix);
}
// const fvMatrix<type> in dynamic_cast braces
// had problem to display in forum preview
The compiler complains that :
cannot dynamic_cast const lduMatrix& to const fvMatrix<type>&
so i also tried to const_cast the lduMatrix reference with no improvement


So right now i don't know how to access the old psi field within that method.

The thing why i need that is because i am trying to implement a phase lag or direct storage method mentioned by Erdos, J. I. & Alzner, E. Computation of Unsteady Transonic Flows Through Rotating and Stationary Cascades
I - Method of Analysis Nasa Contract Report 2900, 1977, 2900

So what i want to do is to store the psi field of one previous time step the geometric handling is all done only the storage is the remaining problem

If you know a workaround for the template casting problem i would welcome that very much :-)
ffbof is offline   Reply With Quote

Old   August 27, 2008, 13:34
Default Hi Franz, The problem is that
  #4
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,758
Rep Power: 21
hjasak will become famous soon enough
Hi Franz, The problem is that you are trying to get this done at the wrong place. Explaining it in detail would be a lot of effort; in short, you need to go back to the (templated, coupled) boundary condition and do the work there.

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   August 27, 2008, 14:46
Default Sorry for that i think i hav
  #5
New Member
 
Franz
Join Date: Mar 2009
Posts: 17
Rep Power: 8
ffbof is on a distinguished road
Sorry for that i think
i have typed it wrong it seems you are thinking that i am in the global function

thats the header of my test class which is my boundary condition
header
{
template<class>
class test:
public testLduInterfaceField,
public coupledFvPatchField<type>
}
source
{
test::initInterfaceMatrixUpdate
}

Sorry for that strange notation
But i thought i am in the ,as you called it,
(templated, coupled) boundary condition
The code at August 27, 2008 - 07:25 am is implemented in the class test which is a template and derived from coupledFvPatchField.
Maybe i just misunderstood your words

But again thank you for reply
bme79 likes this.
ffbof is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ensight - node values -cell values leo FLUENT 1 May 12, 2010 08:47
TGridFluent mesh with internal by prism layer and internal face for diagnostic sponiar OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 2 March 30, 2009 15:02
how to get fluid internal internal energy vbk FLUENT 0 December 17, 2007 02:54
node values or cell values? aPpA FLUENT 0 November 10, 2006 09:56
Internal BC Saud Khashan FLUENT 0 July 3, 2001 08:58


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