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

Implementation of Implicit Source term in OpenFOAM

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

Reply
 
LinkBack Thread Tools Display Modes
Old   August 14, 2014, 23:28
Default Implementation of Implicit Source term in OpenFOAM
  #1
New Member
 
Delstat
Join Date: Apr 2013
Posts: 15
Rep Power: 5
pradeepramesh is on a distinguished road
Dear All,

I am currently trying to solve linear and non-linear Poisson equation with implicit source terms in OpenFoam. I would like to request your feedback.

Case I : linear Poisson equation
Solve for : del^2(T) - T = 0

Source : S = -T
Implicit source: S = Su + Sp*T
Su = 0, Sp = -1

Open Foam: fvm::laplacian(T) == -fvm::Sp(Sp,T) + Su

I defined Sp and Su as "VolScalarField". I was successfully able to solve the case and compared it with the analytically results.

************************************************** ***********

Case II: Non-linear Poisson equation
Solve for : del^2(T) - T^2 = 0

Source : S = -T^2
Implicit source: S = Su + Sp*T
With taylor's series expansion:

S = To^2 + (- 2To)*T

Su = To^2, Sp = (- 2To)

I am facing errors to implement these sources terms.
How to mimic these equation in OpenFoam syntax?
How to define Su and Sp in terms of To.?

Please find the attached Snapshot for your reference.
Would be great to hear your feedback on Case II. Thank you very much and have a wonderful day.

Cheers,
Pradeep
Attached Images
File Type: jpg Implicit Source term.jpg (75.4 KB, 90 views)
pradeepramesh is offline   Reply With Quote

Old   August 18, 2014, 00:28
Default
  #2
Cyp
Senior Member
 
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 252
Rep Power: 10
Cyp is on a distinguished road
Hi,

It would have been easier if you post the error message. The implementation is similar to your first case. I guess you should program Foam:ow(T0,2) for T0^2. Maybe your compilation error comes from here.

Another point you have to be careful is the dimension of T ! Indeed, despite the case where T is dimensionless, your equation is not correct (at least you should put an dimensionedScalar factor in front of your source term in order to be homogeneous).

Best,
Cyp
Cyp is offline   Reply With Quote

Old   August 18, 2014, 01:07
Default
  #3
New Member
 
Delstat
Join Date: Apr 2013
Posts: 15
Rep Power: 5
pradeepramesh is on a distinguished road
Dear Cpy,

Thank you very much for your feedback and i highly appreciate that.

Could you please elaborate on the dimensionedScalar factor?


Case I: ----> fvm::laplacian(T)== -fvm::Sp(Sp,T) + Su

dimensionedScalar factor for source terms, you mean for Sp and Su???


Case II: ----> fvm::laplacian(T)== T*T*A

Where: A is a dummy object to make the operation compatible.


Thank you very much

Cheers,
Pradeep
pradeepramesh is offline   Reply With Quote

Old   August 18, 2014, 01:10
Default
  #4
Cyp
Senior Member
 
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 252
Rep Power: 10
Cyp is on a distinguished road
For both cases, I will declare A as :


Code:
dimensionedScalar A ("A", dimless/T.dimensions()/dimLength/dimLength, 1.0);
and then

Code:
fvm::laplacian(T) == -fvm::Sp(2*T0*A,T) + Foam::pow(T0,2)*A
Best,
Cyp
Cyp is offline   Reply With Quote

Old   August 18, 2014, 01:30
Default
  #5
New Member
 
Delstat
Join Date: Apr 2013
Posts: 15
Rep Power: 5
pradeepramesh is on a distinguished road
Dear Cpy,

I have updated the new syntax and with the new dimension syntax,I am facing the incompatibility error for operation. Please find the attached snapshot for your reference.

Thank you very much.

Cheers,
Pradeep
Attached Images
File Type: png Picture1.png (16.9 KB, 65 views)
pradeepramesh is offline   Reply With Quote

Old   August 18, 2014, 01:40
Default
  #6
Cyp
Senior Member
 
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 252
Rep Power: 10
Cyp is on a distinguished road
Indeed it is obvious (because of the laplacian..). I modified my previous post.
Cyp is offline   Reply With Quote

Old   August 18, 2014, 01:57
Default
  #7
New Member
 
Delstat
Join Date: Apr 2013
Posts: 15
Rep Power: 5
pradeepramesh is on a distinguished road
It worked! Thank you very much Cpy
pradeepramesh is offline   Reply With Quote

Old   May 20, 2016, 07:30
Default
  #8
Member
 
Colli, Alejandro
Join Date: Jan 2014
Posts: 31
Rep Power: 5
ancolli is on a distinguished road
Could you please explain how to modify code to solve a general nonlinear Poisson equation?
Step by Step if is it possible, because I do not fully understand
ancolli 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
Swak4Foam funkyDoCalc with OF2.3 massflow NiFl OpenFOAM 11 November 1, 2016 07:43
Anisotropic, implicit momentum source term chris_j_meyer OpenFOAM Programming & Development 3 July 25, 2016 16:11
what is swap4foam ?? AB08 OpenFOAM 28 February 2, 2016 02:22
Suggestion for a new sub-forum at OpenFOAM's Forum wyldckat Site Help, Feedback & Discussions 20 October 28, 2014 10:04
Implicit source term and porousInterFoam Andrea_85 OpenFOAM Programming & Development 0 August 30, 2013 04:30


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