|
[Sponsors] |
March 20, 2012, 11:41 |
explicitSetValue
|
#1 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Dear all,
reading this tutorial, I have found these lines: Code:
The example shows an explicit volumetric source for a scalar equation, given by a ...ExplicitSource entry. Similarly a constraint can also be applied that sets values in given cells, given by a ...ExplicitSetValue entry. Specialised sources are also available, e.g. actuationDiskSource for wind turbing siting calculations. The point is that I can not understand which is the file that I have to edit. Could anyone help? Thanks a lot, Samuele |
|
March 20, 2012, 23:38 |
|
#2 |
Senior Member
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21 |
Take a look at constant/sourcesProperties. This is where you set the sources. The easiest way is to use a cellSet as is done in the simpleFoam/turbineSiting tutorial. The cellSets are defined in system/topoSetDict by running topoSet--which will need to be run in parallel after your decomposePar if you are planning to run your solver in parallel.
For an explicit scalar source named s1 on a field T for example, you would have the following in your sourcesProperties: Code:
s1 { type scalarExplicitSource; active true; timeStart 0; duration 10000; selectionMode cellSet; cellSet s1; scalarExplicitSourceCoeffs { volumeMode absolute; //specific injectionRate { T <some scalar value>; } } } |
|
March 21, 2012, 03:42 |
|
#3 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Dear kwardle,
yeah, this helps a lot, thank you very much. Just a question (I'll google it, but maybe you already know the answer): can I use `explicitSetValue' with buoyantSimpleFoam/buoyantPisoFoam solver, too? Thanks again, Samuele |
|
March 21, 2012, 04:18 |
|
#4 | |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Pardon the spam, but I need more help. Let me try to explain what I think I should do:
1. I prepare my case folder 2. I add the constant/sourcesProperties file 3. I give the command topoSet --which (I can not und this point very well. I have a volume patch in my constant/polyMesh/cellZones file.. Isn't it possible to insert in the constant/sourcesProperties the name of that patch instead of running topoSet? I can not und how to use it) 4. I run my simulation. Is that correct? If so, I am going to work ok point 3. Also, in order to embed this functionality in the buoyantSimplFoam folder is it enough to add this line Quote:
Thanks a lot for your help, Samuele Last edited by samiam1000; March 21, 2012 at 05:33. Reason: I added a new question |
||
March 21, 2012, 10:03 |
|
#5 |
Senior Member
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21 |
First, no, buoyantSimpleFoam is not currently set up to use sources as you can see in UEqn.H. You are correct in that you need to add the line you mentioned, but you also need to add the source term in the actual equation as:
Code:
tmp<fvVectorMatrix> UEqn ( fvm::div(phi, U) + turbulence->divDevRhoReff(U) == sources(U) ); 1. Add the header to the main solver source file (buoyantSimpleFoam.C) as: Code:
#include "IObasicSourceList.H" Code:
IObasicSourceList sources(mesh); Again take a look at the files in simpleFoam as an example. Be sure to recompile your solver and you should be good (unless I have missed something). If there are errors, they are usually helpful it you start at the time and actually take a look at why it is complaining. This will help you add what is missing. Regards, Kent |
|
March 21, 2012, 10:09 |
|
#6 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Hi Kent and thanks for answering.
I did what you suggested, but I get an error. Here you can find a new post with my problem (I started a new thread since it is a different problem). If you can have a look, that would be great. Thanks a lot, Samuele PS: now I am trying to run a case using the simpleFoam solver in order to be able to use the explicitSetValue feature. I want to fix the value of a variable (the temperature!) in each cell of a certain patch. That sounds challenging, doesn't it? |
|
March 21, 2012, 10:15 |
|
#7 |
Senior Member
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21 |
Sorry, I didn't answer item #3 in your post. If you want to apply a uniform source everywhere in your domain (not sure what you mean by 'volume patch') then just create a cellSet as a box bigger than your volume with the following in topoSetDict:
Code:
actions ( { name bigBox; type cellSet; action new; source boxToCell; sourceInfo { box (-1 -1 -1) (1 1 1); //box corner limits } } ); |
|
March 21, 2012, 10:22 |
|
#8 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Sorry: maybe I didn't explain very well what I meant. I don't want to fix the temperature in each cell of my domain, but I want to fix it in each cell that is in a subdomain in the patch called air_infinite.
If you look at my constant/polyMesh/cellZones, you will find: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.0.1 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class regIOobject; location "constant/polyMesh"; object cellZones; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 3 ( air_infinite { type cellZone; cellLabels List<label> 1218 ( 0 . . . 1217 ) ; } air_internal { type cellZone; cellLabels List<label> 97372 ( 1218 . . . 98589 ) ; } air_external { type cellZone; cellLabels List<label> 9492 ( 98590 . . . 108081 ) ; } ) // ************************************************************************* // |
|
March 21, 2012, 10:29 |
|
#9 |
Senior Member
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21 |
OK, I misunderstood and thought you were trying to set a source not constrain the value to a set value. Even so, I think the setup is all the same you would just use scalarExplicitSetValue instead in your sourcesProperties as:
Code:
s1 { type scalarExplicitSetValue; active true; timeStart 0; duration 10000; selectionMode cellSet; cellSet bigBox; scalarExplicitSetValueCoeffs { injectionRate { T <some scalar value>; } } } |
|
March 21, 2012, 10:41 |
|
#10 | ||
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Quote:
Quote:
Also, I don't have any constant/polyMesh.. How can I create it? Sorry, but I can not understand your suggestion. Could you explain the steps? Thanks again, Samuele |
|||
March 21, 2012, 11:04 |
|
#11 |
Senior Member
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21 |
Two thoughts.
1. Not sure which converter you used, but fluentMeshToFoam has an option -writeSets which will write your regions as sets. It also has one -writeZones which will just write the zones only. So, you could make a new case and reconvert your mesh with -writeSets and copy those over to the old case.. 2. Alternatively, it would be pretty simple to manually create the cellSet file from the cellZone file. The format of the cellSet file would just be: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.1.x | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class cellSet; location "constant/polyMesh/sets"; object air_internal; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 97372 ( 1218 . . . 98589 ) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
|
March 21, 2012, 12:28 |
|
#12 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Thanks a lot. I am going to try with this.
Just a question: should I "activate" the sourceProperties file? I mean, once I save it in the constant folder, how can I `tell' the solver to read it? Is it automatic? Thanks again, Samuele |
|
March 21, 2012, 12:43 |
|
#13 |
Senior Member
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21 |
If the solver is set up for sources it will look for the file and probably complain if it is not there. If the file sourcesProperties is there and the specific source is set to "active true;" then it should work.
|
|
March 22, 2012, 04:16 |
|
#14 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
I thought about fixing the velocity instead of pressure.
But it doesn't work. Last edited by samiam1000; March 22, 2012 at 04:39. |
|
March 22, 2012, 04:35 |
|
#15 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
That's great.
Everything works, now! Thanks for the support, Samuele. PS: now I have to add this feature into the buoyantSimpleFoam problem. If you want to help me, look at this. Samuele Last edited by samiam1000; March 22, 2012 at 05:36. |
|
March 26, 2012, 07:16 |
Could you have a look at the link?
|
#16 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Dear Kent,
could you help me in solving the same problem with buoyanPimpleFoam. If you want, you can read this thread. Thanks a lot, Samuele. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ExplicitSetValue | samiam1000 | OpenFOAM | 0 | March 8, 2012 09:28 |