|
[Sponsors] |
May 9, 2021, 12:07 |
Coded boundary condition
|
#1 |
New Member
Join Date: Jan 2021
Location: Norway
Posts: 22
Rep Power: 5 |
Hi all,
How can I introduce a boundary condition of a variable as a function of another variable. Lets say, how can I introduce the following boundary condition: epsilon=0.391*k*y*z Thanking you. Subhojit Last edited by subhojitkadiacfd; May 9, 2021 at 15:35. |
|
May 10, 2021, 09:26 |
|
#2 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 736
Rep Power: 14 |
Simplest would be to use the funkSetBoundaryField utility, but you want to do it with codeStream, so here's how. Use a fixedValue type for the epsilon boundary patch you are interested in (here I will assume that this patch is called "inlet"), and put this for the value:
Code:
inlet { type fixedValue; value #codeStream { codeInclude #{ #include "fvCFD.H" #}; codeOptions #{ -I$(LIB_SRC)/finiteVolume/lnInclude -I$(LIB_SRC)/meshTools/lnInclude #}; codeLibs #{ -lfiniteVolume -lmeshTools #}; code #{ const IOdictionary& d = static_cast<const IOdictionary&>(dict.parent().parent()); const fvMesh& mesh = refCast<const fvMesh>(d.db()); const label id = mesh.boundary().findPatchID("inlet"); const fvPatch& patch = mesh.boundary()[id]; scalarField epsp(patch.size(), 0.0); const volScalarField& k = mesh.lookupObject<volScalarField>("k"); const scalarField& kp = k.boundaryField()[id]; forAll(epsp, facei) { const scalar y = patch.Cf()[facei].y(); epsp[facei] = 0.391*kp[facei]*y; } writeEntry(os, "", epsp); #}; }; } |
|
May 12, 2021, 06:42 |
|
#3 |
New Member
Join Date: Jan 2021
Location: Norway
Posts: 22
Rep Power: 5 |
Many thanks. It shows dict is not defined. How to remove it?
|
|
Tags |
codedfixed, codedmixed |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
sliding mesh problem in CFX | Saima | CFX | 46 | September 11, 2021 08:38 |
Centrifugal fan | j0hnny | CFX | 13 | October 1, 2019 14:55 |
Accessing multiple boundary patches from a custom boundary condition file | ripudaman | OpenFOAM Programming & Development | 0 | October 22, 2014 19:34 |
Radiation interface | hinca | CFX | 15 | January 26, 2014 18:11 |
An error has occurred in cfx5solve: | volo87 | CFX | 5 | June 14, 2013 18:44 |