CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   funkySetFields setup (https://www.cfd-online.com/Forums/openfoam-pre-processing/224003-funkysetfields-setup.html)

joshmccraney February 4, 2020 11:46

funkySetFields setup
 
Hi FOAMers!

I'm think I've successfully installed swak4foam for OF6. However, it's not clear to me how to initialize pressure, velocity, and the phase. Does anyone have a tutorial?

I've been reading here but I am a little confused exactly how to format things. Is there an extra file I need to put in a dictionary, or do I modify current dictionaries?

If anyone has a simple case file for running a test case that serves as a good template, I'd really appreciate it.

joshmccraney February 5, 2020 18:16

A senior member of this community was nice enough to help me out (not sure if I should list names?). At any rate, for clarity, this is how you run funkySetFields:

1) in the "system" directory, copy the setFieldsDict as a funkySetFieldsDict via
>> cp setFieldsDict funkySetFieldsDict

2) delete all lines of funkySetFieldsDict and replace with what you want, for example:

/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 6
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object funkySetFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

expressions
(
initFieldAlpha//JMC: INITIALIZE DATA (SIMILAR TO defaultFieldValues)
{
field alpha.water;
expression "0";
keepPatches true;
}

initFieldU//JMC: INITIALIZE DATA (SIMILAR TO defaultFieldValues)
{
field U;
expression "vector(0.0,0.0,0.0)";
keepPatches true;
}

pressureAir//JMC: INITIALIZE DATA (SIMILAR TO defaultFieldValues)
{
field p_rgh;
expression "0";
keepPatches true;
}

floatingCircle
{
field alpha.water;
expression "1";
condition "sqrt(pow((pos().x-0.14),2)+pow((pos().y-0.2),2))<0.05";
keepPatches true;
}

pressureCircle
{
field p_rgh;
expression "100.0*pos().y";
condition "sqrt(pow((pos().x-0.14),2)+pow((pos().y-0.2),2))<0.05";
keepPatches true;
}

risingCircle
{
field U;
expression "vector(0.0,1.5,0.0)";
condition "sqrt(pow((pos().x-0.14),2)+pow((pos().y-0.2),2))<0.05";
keepPatches true;
}
);

// ************************************************** *********************** //

3) now go into the case file, and as usual run
>> blockMesh
>> funkySetFields -time 0
IMPORTANT, RUN THIS INSTEAD OF setFields, WHERE -time 0 STIPULATES WHERE TO BEGIN THE IC
>> interFoam

All done!


All times are GMT -4. The time now is 11:53.