|
[Sponsors] |
setting a reference value using conjugateHeatFoam (or coupledFvScalarMatrix) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 23, 2010, 12:46 |
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 |
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... 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? |
|
August 24, 2010, 15:59 |
|
#2 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33 |
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 |
|
August 24, 2010, 17:46 |
|
#3 |
Senior Member
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19 |
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))); |
|
August 25, 2010, 05:27 |
|
#4 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33 |
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 |
|
September 9, 2010, 20:09 |
|
#5 |
New Member
Anh Le
Join Date: Jul 2010
Posts: 5
Rep Power: 16 |
I figured out my problem. Thanks
Last edited by hut; September 10, 2010 at 12:00. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
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 |