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

implicit div(k*grad(a*u))

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

Reply
 
LinkBack Thread Tools Display Modes
Old   August 8, 2011, 13:45
Default implicit div(k*grad(a*u))
  #1
New Member
 
Join Date: Aug 2011
Posts: 6
Rep Power: 6
gunnar2 is on a distinguished road
Hello,
I have asked in "Running / Solving / CFD (modify laplacian: div(k*grad(a*u)))" before, but now this seems to be a programming question.

How can I treat \nabla\cdot k \nabla \alpha u implicitly?

k - scalar field (known diffusivity)
\alpha - scalar field (known mass fraction)
u - scalar field (unknown)

fvm::laplacian(k,alpha*u) generates a compiler error.

I think a possible solution is to right-multiply the fvMatrix fvm::laplacian(k,u) with a diagonal matrix D_\alpha made up of the values of \alpha on it's diagonal.

But how do I write this in C++?

Thank you
Gunnar
gunnar2 is offline   Reply With Quote

Old   August 9, 2011, 14:22
Default
  #2
New Member
 
Join Date: Aug 2011
Posts: 6
Rep Power: 6
gunnar2 is on a distinguished road
Is it really not possible to build a diagonal matrix?

Another possibility can be first to construct

fvMatrix M=fvm::laplacian(k,u)

In the next step I would have to multiply each row i of the matrix M with alpha[i]. However I don't understand the storage format of fvMatrix. May I ask if somebody would share a few lines of code, how to multiply one row of a fvMatrix with a scalar value?

Thank you
Gunnar
gunnar2 is offline   Reply With Quote

Old   August 11, 2011, 16:40
Default
  #3
New Member
 
Join Date: Aug 2011
Posts: 6
Rep Power: 6
gunnar2 is on a distinguished road
anybody any idea?

or at least a reason, why there cannot be an implicit scheme for \nabla\cdot k\nabla\alpha u?

Thank you
Gunnar
gunnar2 is offline   Reply With Quote

Old   August 12, 2011, 08:52
Default
  #4
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 397
Rep Power: 12
marupio is on a distinguished road
Can you use the chain rule to seperate alpha and u?
marupio is offline   Reply With Quote

Old   August 12, 2011, 11:41
Default
  #5
New Member
 
Jakob H.
Join Date: Aug 2011
Posts: 1
Rep Power: 0
jakobh is on a distinguished road
Hi Gunnar!
You can use this function:

Code:
namespace Foam{ namespace fvm{
  template<class Type, class GType>
  tmp<fvMatrix<Type> >
  laplacian
  (
    const GeometricField<GType, fvPatchField, volMesh>& gamma,
    GeometricField<Type, fvPatchField, volMesh>& vf,
    GeometricField<Type, fvPatchField, volMesh>& alpha
  )
  {
    tmp<fvMatrix<Type> > Laplacian=fvm::laplacian(gamma,vf);
    Laplacian()*=alpha;
    return Laplacian;
  }
} }
In your case: fvm::laplacian(k,u,alpha)

Jakob
jakobh is offline   Reply With Quote

Old   August 21, 2011, 14:57
Default
  #6
Senior Member
 
Mieszko Młody
Join Date: Mar 2009
Location: POLAND, USA
Posts: 129
Rep Power: 8
ziemowitzima is on a distinguished road
Hi Jakob,
I read your post and it seems that you can know the answer for my question with laplacian operator.
If you dont mind please read my post at:
laplacian problem
ziemowitzima 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
ddt explicit or implicit with courant number!! mrshb4 OpenFOAM 0 December 13, 2010 12:13
Help. implicit discritization dearboy Main CFD Forum 0 November 25, 2010 22:46
Can anyone explain the difference between these implicit concepts? bearcat Main CFD Forum 0 February 20, 2010 19:39
how implicit is implicit? Joe cool Main CFD Forum 7 July 16, 2004 11:10
UDF : Chemical Reaction in Catalytic Converter adhimac FLUENT 1 March 27, 2001 14:04


All times are GMT -4. The time now is 11:03.