|
[Sponsors] |
How to define a spatial source in ScalarTransportFoam? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 18, 2013, 12:08 |
How to define a spatial source in ScalarTransportFoam?
|
#1 |
Member
Yijiu Jiang
Join Date: Jan 2013
Location: Michigan, US
Posts: 49
Rep Power: 13 |
Hi,
I am working on ScalarTransportFoam trying to add a distribution of source term. For example, considering 1D convection-diffusion problem, if the source term is define as follow: S(x)=ax+b (x1<x<x2) S(x)=cx+d (x2<x<x3) a, b, c, d are all constants How to add this distribution in ScalarTransportFoam? Anyone made something similar? Thank you and best regards |
|
December 19, 2013, 07:54 |
|
#2 |
Senior Member
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 22 |
Hi Jiang,
You can try something like: Code:
volScalarField S ( IOobject ( "S", runTime_.timeName(), mesh_, IOobject::NO_READ, IOobject::NO_WRITE ), mesh_, dimensionedScalar("S", pow(dimTime,-1)*T.dimensions(), 0.0) ) forAll(mesh.C(),cellI) { const point& Ccell = mesh.C()[cellI]; if(Ccell.x() > x1 && Ccell.x() <= x2) { S[cellI] = a*Ccell.x() + b; } else if(Ccell.x() > x2 && Ccell.x() < x3) { S[cellI] = c*Ccell.x() + d; } } Code:
== S Cheers, L |
|
April 3, 2014, 22:08 |
|
#3 | |
Member
Yijiu Jiang
Join Date: Jan 2013
Location: Michigan, US
Posts: 49
Rep Power: 13 |
Hi Lieven,
Thank you very much for your idea. It works for me. Sorry for the late reply cause I have been doing a different project for the last several months. Now I got a new problem about mesh manipulation. It is a kind of same as the previous one which I asked you. The thing is: I am trying generate bedforms for my case, basically, the Mesh is just a 3D box and I want to modify the bottom from flat bottom to a sine wave surface. I have already written a utility for the bedform generation. I attached the .C file for you. But I want to make it more general, for example, if I just want generate the sine wave for the part which a<x<b. I have tried, but unfortunately didn't make it. Do you have any idea on this? Thank you. Yijiu Quote:
Last edited by y_jiang; April 4, 2014 at 01:33. |
||
April 4, 2014, 01:35 |
|
#4 |
Member
Yijiu Jiang
Join Date: Jan 2013
Location: Michigan, US
Posts: 49
Rep Power: 13 |
Hi Lieven,
I have already solved this problem. It is pretty simple. I just thought it in a wrong way at the very beginning. Cheers, Yijiu |
|
October 19, 2016, 10:11 |
|
#5 | |
New Member
Sana Ullah
Join Date: Sep 2014
Location: Daejeon,South Korea
Posts: 28
Blog Entries: 2
Rep Power: 12 |
Quote:
Its an old thread, but I hope I can get a reply from you for how you actually solved your problem, and I am also working on scalarTransportFoam, and I want to include a sink to it, any suggestion on how I can implement this. Thanks mehar
__________________
Mehar, Phd Scholar KAIST, Korea |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
GPU Linear Solvers for OpenFOAM | gocarts | OpenFOAM Announcements from Other Sources | 37 | August 17, 2022 14:22 |
[swak4Foam] swak4Foam-groovyBC build problem | zxj160 | OpenFOAM Community Contributions | 18 | July 30, 2013 13:14 |
[swak4Foam] problem on installing swak4Foam | navid2 | OpenFOAM Community Contributions | 2 | May 30, 2012 04:32 |
OpenFOAM on MinGW crosscompiler hosted on Linux | allenzhao | OpenFOAM Installation | 127 | January 30, 2009 19:08 |
Missing math.h header | Travis | FLUENT | 4 | January 15, 2009 11:48 |