alpie77 |
May 5, 2023 12:29 |
setFieldsDict - Ellipse
Hello everyone,
I am working on an Openfoam assignment at my university. For this assignment, I need to use setFieldsDict and define an ellipsoid volume or region ( It is 3D) and set different values for inside and outside of the ellipsoid region. But I could not find any documentation on defining an ellipsoid region in setFields.
I could manage to do it with funkySetFields which is below.
In this funkysetfields an ellipsoid is defined and inside the ellipsoid thermal diffusivity for sand is valid, outside of this ellipsoid diffusivity of aluminum is valid.
Code:
FoamFile
{
version 2.0;
format ascii;
root "";
case "defective cooler";
instance "system";
local "";
class dictionary;
object funkySetFieldsDict;
}
expressions
(
aAluminum
{
field a;
expression "8.418e-5";
condition "sqr((pos().x-0.003))/(sqr(0.015))+sqr((pos().y-0.0045))/(sqr(0.0007))+sqr((pos().z-0.003))/(sqr(0.001))>1";
// This equation describes the inside or outside of an ellipsoid.
}
aSand
{
field a;
expression "1-12e-6";
condition "sqr((pos().x-0.003))/(sqr(0.015))+sqr((pos().y-0.0045))/(sqr(0.0007))+sqr((pos().z-0.003))/(sqr(0.001))<1";
}
);
Question :
I need to do the same thing with OpenFOAM V10, setFieldsDict.
How can I do the same thing, in setFieldsDict?
Code:
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 10
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
volScalarFieldValue a 8.418e-5
);
regions
(
// Setting values inside a sphere
sphereToCell
{
centre (0.015 0.0045 0.003);
radius (0.003 0.007 0.001); // I tried to give 3 radiui assuming in 3D, but this did not work of course :)//
fieldValues
(
volScalarFieldValue a 1.12e-6
);
}
);
// ************************************************************************* //
Thanks for your help and effort.
|