May 9, 2022, 13:24
|
external variable in codedFixedValue boundary condition
|
#1
|
New Member
claudio caccia
Join Date: Nov 2014
Location: Italy
Posts: 1
Rep Power: 0
|
Hi,
I'd like to read an external variable (i.e. defined in another dictionary) within a boundary condition of the kind codedFixedValue.
The snippet is more or less like this:
Code:
#include "$FOAM_CASE/include/initialConditions"
dimensions [0 1 -1 0 0 0 0];
internalField uniform ($Uref 0 0);
boundaryField
{
inlet
{
//
type codedFixedValue;
value uniform (1 0 0);
name parabolicVelocity;
code
#{
const vectorField& Cf = patch().Cf();
vectorField& field = *this;
const scalar Umax = 1.5*$Uref;
forAll(Cf, faceI)
{
const scalar y =Cf[faceI][1];
field[faceI] = vector(4*Umax/(pow(H,2))*(H-y)*y, 0, 0);
}
#};
The variable Uref is defined in the file initialConditions. It is correctly read to initialize the internal field. But up to now, I'm not able to read it within the code. What is the correct way to access that variable?
Thank you
Claudio
|
|
|