CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

Source term in solveTransportPDE

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 29, 2013, 22:52
Default Source term in solveTransportPDE
  #1
Senior Member
 
Julien de Charentenay
Join Date: Jun 2009
Location: Australia
Posts: 231
Rep Power: 18
julien.decharentenay is on a distinguished road
Send a message via Skype™ to julien.decharentenay
Hi,

I have been playing with the "solveTransportPDE" function - which I think is part of swak4Foam - to add passive scalars when using simpleFoam.

I use syntax similar to the following [taken from one of the example]:
Code:
type solveTransportPDE;
outputControl   timeStep;
outputInterval  1;

solveAt timestep;
fieldName TCompare;
steady false;
rho "1" [0 0 0 0 0 0 0];
diffusion "0.01" [0 2 -1 0 0 0 0];
source "0" [0 0 -1 1 0 0 0];
phi "phi" [0 3 -1 0 0];
It is working great. I was looking at trying to specify sources using algebraic expression - such as nominated a source term at a given spatial location (and probably ramping it up in time) for example. I was wondering if anyone had experienced with it/guidance on how to construct the source term. Is multiple line expression allowed?

I was also wondering if the fieldName had to match with the function name?

Thanks in advance for any help/pointer.
Julien
__________________
---
Julien de Charentenay

Last edited by julien.decharentenay; May 29, 2013 at 22:56. Reason: Changed type for the code extract, and correct alignment
julien.decharentenay is offline   Reply With Quote

Old   June 5, 2013, 20:55
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by julien.decharentenay View Post
Hi,

I have been playing with the "solveTransportPDE" function - which I think is part of swak4Foam - to add passive scalars when using simpleFoam.

I use syntax similar to the following [taken from one of the example]:
Code:
type solveTransportPDE;
outputControl   timeStep;
outputInterval  1;

solveAt timestep;
fieldName TCompare;
steady false;
rho "1" [0 0 0 0 0 0 0];
diffusion "0.01" [0 2 -1 0 0 0 0];
source "0" [0 0 -1 1 0 0 0];
phi "phi" [0 3 -1 0 0];
It is working great. I was looking at trying to specify sources using algebraic expression - such as nominated a source term at a given spatial location (and probably ramping it up in time) for example. I was wondering if anyone had experienced with it/guidance on how to construct the source term. Is multiple line expression allowed?

I was also wondering if the fieldName had to match with the function name?

Thanks in advance for any help/pointer.
Julien
What do you mean with "fieldName had to match with the function name"

Basically in the source term you can do anything you can do with other swak-expressions (so something like "mag(pos()-vector(1,0,0))<0.1 ? (time()<1 ? time() : 1)*42 : 0" would for instance give you a source in a circle around (1,0,0) that grows until t=1 and then stays constant

Multiline: with a variable list you can make this more "structured". BTW: variable are shared between the expressions (rho, diffusion, source, phi): that might help you to make it more consistent
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   June 6, 2013, 00:32
Default
  #3
Senior Member
 
Julien de Charentenay
Join Date: Jun 2009
Location: Australia
Posts: 231
Rep Power: 18
julien.decharentenay is on a distinguished road
Send a message via Skype™ to julien.decharentenay
Thanks a lot. It is exactly the information I was looking to hear.

Quote:
Originally Posted by gschaider View Post
What do you mean with "fieldName had to match with the function name"
My post was not very clear [easier to say with hindsight]. In the following sample of code:

Code:
functions {
    TCompare {
        type solveTransportPDE;
        outputControl   timeStep;
        outputInterval  1;

        solveAt timestep;
        fieldName TCompare;
        steady false;
        rho "1" [0 0 0 0 0 0 0];
        diffusion "0.01" [0 2 -1 0 0 0 0];
        source "0" [0 0 -1 1 0 0 0];
        phi "phi" [0 3 -1 0 0];
    }
There are two occurrences of "TCompare". I was referring to the first "TCompare" (2nd line) as being the function name and the second "TCompare" (line 8) as being the fieldName.

I was wondering if the two had to match or if one could nominate a fieldName different from the function name?
__________________
---
Julien de Charentenay

Last edited by julien.decharentenay; June 6, 2013 at 00:34. Reason: Trying to clarify my question
julien.decharentenay is offline   Reply With Quote

Old   June 6, 2013, 06:53
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by julien.decharentenay View Post
Thanks a lot. It is exactly the information I was looking to hear.



My post was not very clear [easier to say with hindsight]. In the following sample of code:

Code:
functions {
    TCompare {
        type solveTransportPDE;
        outputControl   timeStep;
        outputInterval  1;

        solveAt timestep;
        fieldName TCompare;
        steady false;
        rho "1" [0 0 0 0 0 0 0];
        diffusion "0.01" [0 2 -1 0 0 0 0];
        source "0" [0 0 -1 1 0 0 0];
        phi "phi" [0 3 -1 0 0];
    }
There are two occurrences of "TCompare". I was referring to the first "TCompare" (2nd line) as being the function name and the second "TCompare" (line 8) as being the fieldName.

I was wondering if the two had to match or if one could nominate a fieldName different from the function name?
No. You can call the functionObject julienLovesLongNamesThatHaveNothingToDoWithWhatThe yName and it would still work. The fieldName is the one that is referred to everywhere else (the field file, fvSchems and fvSolution)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem of SOURCE term gradient in UDS wind Fluent UDF and Scheme Programming 6 December 1, 2022 15:21
GPU Linear Solvers for OpenFOAM gocarts OpenFOAM Announcements from Other Sources 37 August 17, 2022 15:22
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 14:59
UDF source term jerome_ FLUENT 2 July 11, 2011 12:55
UDFs for Scalar Eqn - Fluid/Solid HT Greg Perkins FLUENT 0 October 11, 2000 04:43


All times are GMT -4. The time now is 01:13.