# Matrix coefficients from boundary conditions how

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

 January 12, 2007, 06:58 Hello, I am trying to under #1 Senior Member   Thomas Jung Join Date: Mar 2009 Posts: 100 Rep Power: 8 Hello, I am trying to understand implementation of boundary conditions... Simple question: Why is e.g. when using a fixedGradientFvPatchField gradient(internal/boundary)Coeffs called, but not value(Internal/Boundary)Coeffs ? If I want to implement an implicit b.c. (flux depending on current value), how can I make Foam to call valueInternalCoefficients? Deriving from a different FvPatchField? Thank you very much for any hint !

 August 5, 2007, 12:15 Dear Foamers, despites Hrvo #3 Member     Stefan Radl Join Date: Mar 2009 Location: Graz, Austria Posts: 82 Rep Power: 9 Dear Foamers, despites Hrvojes warning I've tried to implement my own boundary condition which shall represent convective heat transfer in the gas phase, i.e., a variable surface gradient of the temperature field in e.g. a solid. The gradient should be computed from dT/dx=-alpha/lambda*(T_surface-T_gas,bulk) with alpha, lambda, T_gas,bulk being constants and T_surface the temperature at the cell face of the boundary batch. Using the core of the mixed or fixedGradient boundary condition, this can be done quite easily. The remaining problem is to get the surface temperature (T_surface) out of the matrix for evaluating the gradient field in the "evaluate" member function. Ironically, this evaluate function should calculate the value at the patch boundary, so this might be trivial Can anybody give me a hint how to conveniently get this surface scalarField for the temperature? Has anybody ever implemented something similar? br Stefan Radl

 August 6, 2007, 04:55 Hi Stefan, I believe you sh #4 Senior Member   Thomas Jung Join Date: Mar 2009 Posts: 100 Rep Power: 8 Hi Stefan, I believe you should calculate your surface temperature, which is a result from your prescribed gradient, like this: scalarField::operator= ( (this->patchInternalField() + gradient()/this->patch().deltaCoeffs()) ); ... but this is just another noobs opinion regards, Thomas

 August 6, 2007, 16:05 Hi, thanks for your opinion #5 Member     Stefan Radl Join Date: Mar 2009 Location: Graz, Austria Posts: 82 Rep Power: 9 Hi, thanks for your opinion, but it does not work :-) I can get the patchInternalField, which should represent the temperature in the cell centers of the patch cells. However, this seems to be a tensor field (the compiler complains about that when I try to subtract it from a scalarField)!! Consequently, I'm unable to calculate the difference between T_gas,bulk and this patchInternalField, which is clearly to me. The question now is: how is this tensor interelated with the scalarField of the patch-temperature and how can I get it? Any suggestions? br Stefan Radl

 August 7, 2007, 05:50 Hmmm... I am calculating a gr #6 Senior Member   Thomas Jung Join Date: Mar 2009 Posts: 100 Rep Power: 8 Hmmm... I am calculating a gradient at the surface like this (in updateCoeffs(), for a radiation boundary condition. epslam is a factor containing thermal conductivity and emissivity. *this gives the field values at the surface. I think this is pretty much the same you want to do, for me it works. gradient() = 5.67051e-8*epslam_*(-(*this)*(*this)*(*this)*(*this)+TRef_*TRef_*TRef_* TRef_); in evaluate(), then, I do this, using underrelaxation: scalarField::operator= ( (1-relax_)*(*this)+relax_*(this->patchInternalField() + gradient()/this->patch().deltaCoeffs()) ); Works, and reults compare well with results from other programs. regards, Thomas

 August 7, 2007, 16:03 Dear Thomas, thanks for you #8 Member     Stefan Radl Join Date: Mar 2009 Location: Graz, Austria Posts: 82 Rep Power: 9 Dear Thomas, thanks for your explanation, with your guidance I did it!! A first test with a single cylindrical slab agrees with the analytical solution, so your/my implementation should be correct. The problem was that I declared the variable as "Field", i.e., valid also for matrices. Now everything is set to a scalarField and it works. I've not used the underrelaxation, the simulation is stable without it. br Stefan Radl

 August 26, 2009, 13:25 diagonal and source of cell? #9 New Member   Sam Lee Join Date: Mar 2009 Location: Shanghai, P.R.China Posts: 4 Rep Power: 8 Hi, Hrvoje Jasak and others I read your post concerning the boundary condition using following functions - valueInternalCoeffs - valueBoundaryCoeffs - gradientInternalCoeffs - gradientBoundaryCoeffs I understood that convection term is using value of the boundary while the diffusion term is using the gradient of the boundary. I think that is why those function names are used? but, I am confused about the concept of diagonal and source of cell which differentiates two functions in one group. would you please explain that a little bit? any hint will be appreciated. thanks all

December 11, 2010, 08:44
#10
Member

George Pichurov
Join Date: Jul 2010
Posts: 39
Rep Power: 7
Quote:
I have tried hard to instantiate an object of class fvPatchField without any success. It requires type, and I have tried anything from scalar and vector to volScalarField etc. Can you provide some real example of how to access the matrix coefficients of a scalar variable, named LMA?

Last edited by jorkolino; December 20, 2010 at 03:40.

 October 16, 2011, 18:26 instantiate a virtual class #11 Member     Nicolas Lussier Clément Join Date: Apr 2009 Location: Montréal, Qc, Canada Posts: 47 Rep Power: 8 Hi jorkolino, fvPatchField is a virtual class. Meaning that you cant instantiate it. To do so you will need to create a class from this one like all the other patch class. Wath you are tiring to do by instantiate fvPatchField is like tiring to create a object character in a RPG video game. The game as character object but you cant create a "character" you will need to choose which kind of character... fvPatchField is there to define what is a patch so every patch will be child of fvPatchField. Ther is a auto pointer class "autoPtr" that will aloud you to instantiate a virtual class. In some case it is useful but I'm guessing in your case it will be useless. For the question about LMA, I'm sorry to tel you that I don't understand the question and I probably don't know the answer. Hope you got the answer you wanted and that this helped you some. Regards Nicolas L.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post arkangel OpenFOAM Running, Solving & CFD 1 October 2, 2008 14:48 marziolettich OpenFOAM Running, Solving & CFD 2 February 19, 2008 06:04 olesen OpenFOAM Running, Solving & CFD 0 July 27, 2006 07:18 dominik Main CFD Forum 0 June 10, 2004 03:47 xueying Main CFD Forum 2 September 24, 2002 09:44

All times are GMT -4. The time now is 10:20.