|
[Sponsors] |
using boxes to partition constant-regions for computing |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 31, 2015, 04:27 |
using boxes to partition constant-regions for computing
|
#1 |
Member
Karelke Yu
Join Date: Dec 2014
Posts: 96
Rep Power: 11 |
dear foamers,
i will be very sorry if the title misleads you. well, i am trying to partition my computational domain (not mesh or grid) into several "subregions", and each "subregion" has two constant factors for some computation. different "subregions" will have different constant factors. i hope you know that this is not for parallel computing and i do not mean to decompose any fields or mesh. what i want to do is to impose specific constants to corresponding "subregions" and i consider this as some pre-processing. the very simple psudo-code may be as follows: Code:
// this file locates in constant/ and named by subregionProperties constantFactors1 4 // lets say, 4 subregions ( subregionName0 0.1; subregionName1 0.2; subregionName2 0.1; subregionName3 0.3; ); constantFactors2 4 // lets say, 4 subregions ( subregionName0 0.3; subregionName1 0.1; subregionName2 0.2; subregionName3 0.5; ) Code:
// during runTime if(current cell in subregionName0) then use factors(0.1 0.3); // or if(current cell in box0) then use factors(0.1 0.3); ... i hope i have clarified my intention. thanks for your attention. |
|
October 31, 2015, 10:41 |
|
#2 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Quick answer: http://www.cfd-online.com/Forums/ope...tml#post512233 - post #10
|
|
November 1, 2015, 07:52 |
|
#3 | |
Member
Karelke Yu
Join Date: Dec 2014
Posts: 96
Rep Power: 11 |
Quote:
also, i draft the pesudo-code in mySolver.C: Code:
// the following code to be added in mySolver.C List<dimensionedScalar> p1(subregionPropertiesDict.lookup("constantFactors1")); forAll(p1, i) { const word regionName = p1[i].name(); forAll(cellsInRegionName, cellI) { U[cellI] = U[cellI] * p1[i].value(); }; }; /karelke |
||
November 1, 2015, 16:55 |
|
#4 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Hi Karelke,
Sorry, I should have emphasized this line from the post I mentioned: Quote:
The 3rd tutorial on the OpenFOAM User Guide explains how to use setFields: http://cfd.direct/openfoam/user-guid...#x7-530002.3.3 - subsection "2.3.3 Setting initial field" "cellSet" is what I like to call a shopping list. It has a list of cells index/identification numbers and only that. "cellZone" is an actual zone in the mesh, that can be created from a "cellSet". A "cellZone" can have its own mesh characteristics, such as identification of what's inside and orientation and stuff like that (sorry, I can't remember all of the details right now). As for the code you're trying to use... I believe that by using setFields to define the values for a specific field, for example one named "Zoning", you can then load the "Zoning" field file the same way that "U" and "p" are loaded in the solver's "createFields.H". Then you can use something like this: Code:
// the following code to be added in mySolver.C List<dimensionedScalar> p1(subregionPropertiesDict.lookup("constantFactors1")); forAll(p1, i) { const word regionName = p1[i].name(); forAll(U, cellI) { if(p1[i].value() == Zoning[cellI]) { U[cellI] = U[cellI] * p1[i].value(); } }; }; Best regards, Bruno |
||
November 1, 2015, 23:21 |
|
#5 | |
Member
Karelke Yu
Join Date: Dec 2014
Posts: 96
Rep Power: 11 |
Quote:
maybe this intention could not be easy (or even possible) to implement. but that is what this thread posted to ask. hope that clarified. thanks again for your attention. |
||
November 2, 2015, 04:48 |
|
#6 |
Senior Member
Join Date: Oct 2013
Posts: 397
Rep Power: 19 |
You might be able to do that if you compute some field values manually, e.g. not in a differential equation. However, in normal cases I would suggest using a field with the factors assigned as its values. Then you can directly use the field in an equation. The memory requirement is usually not the limiting factor in OpenFOAM.
|
|
November 2, 2015, 05:15 |
|
#7 | |
Member
Karelke Yu
Join Date: Dec 2014
Posts: 96
Rep Power: 11 |
Quote:
yeah. what i need do is actually some simple manually-computing and it's not in a differential equation. and now i find it might indeed not be a easy task without creating a field. but i wonder if there are (or should be) classes such as cellSetScalarField or cellZoneScalarField for convenience. at last i think the problem will be solved as what you and Bruno have suggested. BTW, in terms of the dictionary Code:
// this file locates in constant/ and named by subregionProperties constantFactors1 4 // lets say, 4 subregions. is this a list? ( subregionName0 0.1; // delimited by a ";"?? subregionName1 0.2; subregionName2 0.1; subregionName3 0.3; ); thanks for your attention and valuable suggestion. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Chemical properties that are used in Fluent | kimej | FLUENT | 4 | August 19, 2011 12:29 |
Constant Volume Combustion with reactingFoam | Alish1984 | OpenFOAM Running, Solving & CFD | 2 | May 8, 2011 09:51 |
How to install CGNS under windows xp? | lzgwhy | Main CFD Forum | 1 | January 11, 2011 19:44 |
CGNS lib and Fortran compiler | manaliac | Main CFD Forum | 2 | November 29, 2010 07:25 |
Really big problems when creating own materials da | Jop | FLUENT | 0 | June 28, 2007 12:15 |