using boxes to partition constant-regions for computing
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 Code:
// during runTime i hope i have clarified my intention. thanks for your attention. |
Quick answer: http://www.cfd-online.com/Forums/ope...tml#post512233 - post #10
|
Quote:
also, i draft the pesudo-code in mySolver.C: Code:
// the following code to be added in mySolver.C /karelke |
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" Quote:
"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 Best regards, Bruno |
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.:) |
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.
|
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 thanks for your attention and valuable suggestion.:) |
All times are GMT -4. The time now is 16:53. |