|
[Sponsors] |
February 13, 2013, 06:04 |
adjust volscalarfield
|
#1 |
Member
v
Join Date: Nov 2011
Posts: 33
Rep Power: 14 |
hi foamers
i will want to constant volscalarfield (Tsol ) in particular time and place. But using the following code does not work properly. and Tsol is not adjust!! ------------------------------------------ for (int i=0;i<U.size();i++) { if( runTime.value() > 0.1 && runTime.value() < 0.3 ) if (mesh.C().internalField()[i][0] > 0.031 && mesh.C().internalField()[i][0] < 0.08 && mesh.C().internalField()[i][1] > 0.001 && mesh.C().internalField()[i][1] < 0.009 ) { Tsol.internalField()[i]=1200.0; } } --------------------- who can help me? best regards |
|
February 13, 2013, 09:06 |
|
#2 |
Senior Member
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18 |
Where are you adding this code?
Does it change something but that is not what you want? Or there it does not affect your field at all? there two points in solution, first change the order of for loop and if, so for every grid cell and every iteration it don't check the time. Second I never recommend to use for to loop over OF objects, instead of that try using forAll. |
|
February 13, 2013, 17:31 |
|
#3 |
Member
Join Date: Jun 2012
Posts: 65
Rep Power: 13 |
Hi, you can just define a volscalarfield like:
const volscalarfield T then T would be a constant field,but you need to give the initialised value. |
|
February 14, 2013, 01:44 |
|
#4 |
Member
v
Join Date: Nov 2011
Posts: 33
Rep Power: 14 |
thanks your reply
i added my reactingFoam.C (in pimple loop)after solved hs and Tsol eqn(Tsol equation is new equation). Tsol is porous medium temperature and Tsol was increased in order to simulation ignition. -------------------- #include "hsEqn.H" #include "TsolEqn.H" if( runTime.value() > 0.1 && runTime.value() < 0.3 ) if (mesh.C().internalField()[i][0] > 0.031 && mesh.C().internalField()[i][0] < 0.08 && mesh.C().internalField()[i][1] > 0.001 && mesh.C().internalField()[i][1] < 0.009 ) { Tsol.internalField()[i]=1200.0; } --------------------------------------------- |
|
February 15, 2013, 03:34 |
|
#5 |
Senior Member
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18 |
It seems right but I can understand why you are not getting what you want? Did you see any change after adding this section? Trying increasing it to a dramatic value and see what happens?
also check the limiters you may have been set somewhere else, there is a possibility you've been clipped temperature to a value way below 1200 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[openSmoke] libOpenSMOKE | Tobi | OpenFOAM Community Contributions | 562 | January 25, 2023 09:21 |
if-loop, volScalarField comparison | volker | OpenFOAM | 7 | March 6, 2020 20:03 |
Problems with creating a volScalarField | georlade | OpenFOAM Programming & Development | 4 | December 4, 2016 12:31 |
how to export every data w.r.t time to txt file | jaho | CFX | 94 | August 25, 2015 09:45 |
dimensionedScalar + volScalarField is evaluated elementwisely ? | tianyikillua | OpenFOAM Programming & Development | 1 | March 30, 2012 03:12 |