# Implementation of Implicit Source term in OpenFOAM

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

August 14, 2014, 23:28
Implementation of Implicit Source term in OpenFOAM
#1
New Member

Delstat
Join Date: Apr 2013
Posts: 15
Rep Power: 6
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,
Attached Images
 Implicit Source term.jpg (75.4 KB, 105 views)

 August 18, 2014, 00:28 #2 Senior Member   Cyprien Join Date: Feb 2010 Location: Stanford University Posts: 257 Rep Power: 11 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

 August 18, 2014, 01:07 #3 New Member   Delstat Join Date: Apr 2013 Posts: 15 Rep Power: 6 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

 August 18, 2014, 01:10 #4 Senior Member   Cyprien Join Date: Feb 2010 Location: Stanford University Posts: 257 Rep Power: 11 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

August 18, 2014, 01:30
#5
New Member

Delstat
Join Date: Apr 2013
Posts: 15
Rep Power: 6
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,
Attached Images
 Picture1.png (16.9 KB, 70 views)

 August 18, 2014, 01:40 #6 Senior Member   Cyprien Join Date: Feb 2010 Location: Stanford University Posts: 257 Rep Power: 11 Indeed it is obvious (because of the laplacian..). I modified my previous post.

 August 18, 2014, 01:57 #7 New Member   Delstat Join Date: Apr 2013 Posts: 15 Rep Power: 6 It worked! Thank you very much Cpy

 May 20, 2016, 07:30 #8 Member   Colli, Alejandro Join Date: Jan 2014 Posts: 31 Rep Power: 5 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

 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 NiFl OpenFOAM 11 November 1, 2016 07:43 chris_j_meyer OpenFOAM Programming & Development 3 July 25, 2016 16:11 AB08 OpenFOAM 28 February 2, 2016 02:22 wyldckat Site Help, Feedback & Discussions 20 October 28, 2014 10:04 Andrea_85 OpenFOAM Programming & Development 0 August 30, 2013 04:30

All times are GMT -4. The time now is 21:55.

 Contact Us - CFD Online - Top