|
[Sponsors] |
Heat source in a particular region inside the fluid domain |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Member
Robin Gilbert
Join Date: Jan 2010
Posts: 66
Rep Power: 15 ![]() |
Hi i want to add a heat source inside a small region in a fluid domain. i added a heat source term in TEqn.H and it works fine for the whole region. But i want to impose a condition that the heat source gets activated inside a small control volume. i have been reading up a lot but cant figure out how to go about doing it. if atleast someone can tell me where to start, I will figure it out. how do i give an if-else condition to check if it is solving the domain i need to add the source term.
i tried the following in the createFields.H Code:
volScalarField x = mesh.C().component(vector::X); volScalarField y = mesh.C().component(vector::Y); volScalarField z = mesh.C().component(vector::Z); forAll(x,celli) { if(x[celli] >= 1 && y[celli] >= 1 && z[celli] >= 2.2 && x[celli] <= 1.5 && y[celli] <= 1.5 && z[celli] <= 2.5) { dimensionedScalar Q ( "Q", dimensionSet(1,-1,-3,0,0,0,0), scalar(5000) ); }else { dimensionedScalar Q ( "Q", dimensionSet(1,-1,-3,0,0,0,0), scalar(1000) ); } } Thanks. |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 29 ![]() |
You are just storing a single value for Q, so it will be either 1000 or 5000 depending if your conditions in the last cell are met or not. Additionally, you are declaring Q right within the curly brackets, so it will not be valid outside of the forAll loop.
What I think you want is to have a volScalarField Q, and then assign values to Q[celli]. |
|
![]() |
![]() |
![]() |
![]() |
#3 |
Member
Robin Gilbert
Join Date: Jan 2010
Posts: 66
Rep Power: 15 ![]() |
Thank you so much for your reply.
I will try it and let you know what happens. Thanks once again. |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
|
It seems you didn't set Q value, just declare a local Q. You can achieve it in a more compact form like the following code
point mint(1.0,1.0,2.2); point max(1.5, 1.5, 2.5); boundBox box(min, max); forAll(Q, cellI) { if(box.contains(mesh.C()[cellI])) Q[cellI]=5000; else Q[cellI]=1000; } |
|
![]() |
![]() |
![]() |
![]() |
#5 |
Member
Robin Gilbert
Join Date: Jan 2010
Posts: 66
Rep Power: 15 ![]() |
Hi junwei,
i tried your suggestion but i am getting the following error: Code:
In file included from simpleFoam.C:44: createFields.H: In function int main(int, char**): createFields.H:117: error: Q was not declared in this scope In file included from simpleFoam.C:62: UEqn.H:16: error: no match for call to (Foam::point) (Foam::scalar&, Foam::scalar&) In file included from simpleFoam.C:63: pEqn.H:22: error: no match for call to (Foam::point) (Foam::scalar&, Foam::scalar&) In file included from simpleFoam.C:64: TEqn.H:14: error: Q was not declared in this scope TEqn.H:21: error: no match for call to (Foam::point) (Foam::scalar&, Foam::scalar&) |
|
![]() |
![]() |
![]() |
![]() |
#6 |
Senior Member
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 29 ![]() |
Robin, in junwei's code Q is not created, you'll have add that before calling the code. See other forum threads or the wiki how to make a new volScalarField with a certain size.
Also, if Q doesn't change over time and is just determined by the spatial coordinates, you could use setFields (this is used eg. in interFoam / damBreak to preset a volScalarField gamma) instead of including the setup in your solver code. |
|
![]() |
![]() |
![]() |
![]() |
#7 |
Senior Member
|
Yes, You have to declare a volScalarField for store source term for your temperature equation in your solver
|
|
![]() |
![]() |
![]() |
![]() |
#8 |
Member
Robin Gilbert
Join Date: Jan 2010
Posts: 66
Rep Power: 15 ![]() |
akidess and junwei,
thank you so much guys, for the suggestions. i defined Q as volScalarField and ran a test case with setFieldsDict and looks like its working the way i wanted. I will try it on the real case and see if it works. thank you once again. |
|
![]() |
![]() |
![]() |
Tags |
heat source, if-else |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Simulation of a single bubble with a VOF-method | Suzzn | CFX | 21 | January 29, 2018 01:58 |
Constant velocity of the material | Sas | CFX | 15 | July 13, 2010 09:56 |
How can I increase Heat Transfer at Domain Interf? | B.Simon | CFX | 3 | October 28, 2008 19:53 |
DecomposePar links against liblamso0 with OpenMPI | jens_klostermann | OpenFOAM Bugs | 11 | June 28, 2007 18:51 |
Convective Heat Transfer - Heat Exchanger | Mark | CFX | 6 | November 15, 2004 16:55 |