CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

codedFixedValue

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 20, 2024, 11:20
Default codedFixedValue
  #1
New Member
 
Karol Celinski
Join Date: Feb 2024
Location: UK
Posts: 13
Rep Power: 2
kac24 is on a distinguished road
Hi all,

I am trying to use:
U
{
internalField uniform (0 0 2.5);

boundaryField
{
inlet
{
type codedFixedValue;
value uniform (0 0 1);

name parabolicVelocity;
code
#{
const vectorField& Cf = patch().Cf;
vectorField& field = *this;

const scalar R = 69
const scalar Vav = 2.5;

forAll(Cf, faceI)
{
const scalar x = Cf[faceI][0]
const scalar y = Cf[faceI][1]

field[faceI] = vector(0,0,2*Vav*(1-(pow(((pow(pow(x,2+pow(y,2),0.5))/R),2))
}

#};
}
but I am getting an error
Could not load "/alice-home/1/k/kac24/cavity_but_bendy/bubbler_18mar/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libparabolicVelocity_0dd38b0724eb3f538f626fd383ecd a3f8f71b9cd.so"





I could not see any documentation anywhere. The tutorial (yt) I based my code on is for version openfoam .org.




Does anyone have any working codedFixedValue script for version v2306 or similar that I could use as a template?

Thanks in advance
kac24 is offline   Reply With Quote

Old   April 23, 2024, 19:00
Default
  #2
New Member
 
Felipe Noh
Join Date: Aug 2014
Posts: 8
Rep Power: 12
fnohpat is on a distinguished road
Quote:
Originally Posted by kac24 View Post
Hi all,

I am trying to use:
U
{
internalField uniform (0 0 2.5);

boundaryField
{
inlet
{
type codedFixedValue;
value uniform (0 0 1);

name parabolicVelocity;
code
#{
const vectorField& Cf = patch().Cf;
vectorField& field = *this;

const scalar R = 69
const scalar Vav = 2.5;

forAll(Cf, faceI)
{
const scalar x = Cf[faceI][0]
const scalar y = Cf[faceI][1]

field[faceI] = vector(0,0,2*Vav*(1-(pow(((pow(pow(x,2+pow(y,2),0.5))/R),2))
}

#};
}
but I am getting an error
Could not load "/alice-home/1/k/kac24/cavity_but_bendy/bubbler_18mar/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libparabolicVelocity_0dd38b0724eb3f538f626fd383ecd a3f8f71b9cd.so"





I could not see any documentation anywhere. The tutorial (yt) I based my code on is for version openfoam .org.




Does anyone have any working codedFixedValue script for version v2306 or similar that I could use as a template?

Thanks in advance
Hi Karol!

This works perfectly in OpenFOAM 11.

inlet
{

type codedFixedValue;
value uniform (0 0 0);
name parabolicU; // user-defined name

code
#{
const fvPatch& boundaryPatch = this->patch();
const vectorField& Cf = boundaryPatch.Cf();

vectorField& v = *this;
scalar Uc = 0.264075; // centerline velocity, U_average
scalar R = 0.04; // inlet radius

forAll(Cf,faceI)
{
scalar z = Cf[faceI].z(), y = Cf[faceI].y(), rSq = z*z + y*y;
v[faceI] = vector(2*Uc*(1 - rSq/(R*R)),0, 0);
}
#};

I hope you find it useful.
fnohpat is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
including parameter file in codedFixedValue Loekatoni OpenFOAM Running, Solving & CFD 4 November 9, 2023 17:56
Syntax of codedFixedValue trailer OpenFOAM Running, Solving & CFD 1 July 24, 2021 07:17
[sedFoam] codedFixedValue does not transport alpha fields victor13165 OpenFOAM Running, Solving & CFD 0 July 13, 2021 10:30
codedFixedValue: accessing other patch causes crash in parallel RL-S OpenFOAM Running, Solving & CFD 2 December 24, 2019 22:20
Using codedFixedvalue to apply totalPressure Boundary Condition cdm OpenFOAM Running, Solving & CFD 2 June 22, 2013 15:10


All times are GMT -4. The time now is 17:03.