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

setting a reference value using conjugateHeatFoam (or coupledFvScalarMatrix)

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

Like Tree2Likes
  • 2 Post By hjasak

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 23, 2010, 12:46
Default setting a reference value using conjugateHeatFoam (or coupledFvScalarMatrix)
  #1
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19
benk is on a distinguished road
Hi, I'm using a modified conjugateHeatFoam solver to solve my multi-region problem. One of my equations has zeroGradient boundary conditions on each end (it's a 1D problem) and so I need to set a reference value for the equation. Usually I'd just use:

equationName.setReference(position, value);

But when it comes to the coupledFvScalarMatrix used in conjugateHeatFoam, what is the eqationName? For example, coupledFvScalarMatrix is set up like this:

Code:
coupledFvScalarMatrix equations(9);

    equations.set
    (
        0,
        new fvScalarMatrix
        (
            eqn0...
        )
    );
    
    equations.set
    (
        1,
        new fvScalarMatrix
        (
           eqn1...
        )
    );
    
    equations.set
    (
        2,
        new fvScalarMatrix
        (
            eqn2...
        )
    );

etc...
I've tried something like:

equations[0].setReference(position, value);

but this doesn't compile and gives the error "class Foam::lduMatrix has no member named setReference"

Can anybody help me out with this?
benk is offline   Reply With Quote

Old   August 24, 2010, 15:59
Default
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
Yes, setReference will be in the fvMatrix. First, make the fvMatrix, then set the reference and finally insert it in. If this is inconvenient, you can refCast the equations[0] into fvMatrix and it will then let you set the reference.

The problem (well, advantage) is that coupledMatrix is a PtrList of lduMatrices, and fvMatrix is derived from lduMatrix.

Enjoy,

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

Old   August 24, 2010, 17:46
Default
  #3
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19
benk is on a distinguished road
Thanks for your help.

I went with your first suggestion and this seemed to work:

Code:
fvScalarMatrix Eqn0( fvm::laplacian(D1,c1) );

Eqn0.setReference(location, value);

coupledFvScalarMatrix Equations(3);

Equations.set( 0, new fvScalarMatrix(Eqn0) );

Equations.set(1,new fvScalarMatrix(fvm::laplacian(D2,c2)));

Equations.set(2,new fvScalarMatrix(fvm::laplacian(D3, c3)));
benk is offline   Reply With Quote

Old   August 25, 2010, 05:27
Default
  #4
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
Better. If you play with pointers a bit, you can avoid copies.

fvScalarMatrix* Eqn0Ptr = new fvScalarMatrix( fvm::laplacian(D1,c1) );
Eqn0Ptr->setReference(location, value);

coupledFvScalarMatrix Equations(3);
Equations.set(0, Eqn0Ptr);
...

Enjoy,

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

Old   September 9, 2010, 20:09
Default
  #5
hut
New Member
 
Anh Le
Join Date: Jul 2010
Posts: 5
Rep Power: 16
hut is on a distinguished road
I figured out my problem. Thanks

Last edited by hut; September 10, 2010 at 12:00.
hut 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
Error with Wmake skabilan OpenFOAM Installation 3 July 28, 2009 01:35
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 20:08
G95 + CGNS Bruno Main CFD Forum 1 January 30, 2007 01:34
Building OpenFoAm on SGI Altix 64bits anne OpenFOAM Installation 8 June 15, 2006 10:27
Windows Installation BugsComments on Petrbs patch brooksmoses OpenFOAM Installation 48 April 16, 2006 01:20


All times are GMT -4. The time now is 22:53.