|
[Sponsors] |
April 7, 2015, 05:13 |
"if" function in boundary condition
|
#1 |
New Member
Sasa Goran
Join Date: Feb 2015
Location: Japan
Posts: 23
Rep Power: 11 |
Hello all,
i want to simulate a pressure-boundary condition consisting of two parts depending on time. basically, the first part (from t=0 till t=t1)is changing the pressure from 0 to the maximum and the second part (t1<) is making this pressure harmonically change. In MATLAB/octave it looks like this: Code:
for i=1:length(t) if t(i)<=t1 p_cos(i)=pMax/2*(1+C_if*cos(2*pi*f1*t(i))); else p_cos(i)=(p0*(1+(C1*cos(2*pi*f*t(i)-pi/2)+C1*cos(4*pi*f*t(i)+pi/2)))); end end All help apriciated!! |
|
April 7, 2015, 06:23 |
|
#2 |
Member
Join Date: Jun 2011
Posts: 53
Rep Power: 15 |
Hi Supersale,
OpenFOAM can handle time-dependent boundaries, described here: http://www.openfoam.org/version2.1.0...conditions.php But regarding your function I would suggest using groovyBC from swak4Foam: https://openfoamwiki.net/index.php/Contrib/groovyBC http://www.cfd-online.com/Forums/ope...end-inlet.html Regards Squirrel |
|
April 7, 2015, 22:27 |
|
#3 |
New Member
Sasa Goran
Join Date: Feb 2015
Location: Japan
Posts: 23
Rep Power: 11 |
Hi!
thanks for the reply, it seems to work using groovyBC. I used this code: Code:
inlet { type groovyBC; variables "p0=437500;f=64000.0;pi=3.14159265358979323846264338327950288;t1=5.5e-06;f1=1/(2*t1);pMax=530000;C1=(pMax-p0)/(p0*(cos(2*pi*f*t1-pi/2)+cos(4*pi*f*t1+pi/2)));p0_if=pMax/2;Cif=-(pMax/p0_if-1)/(cos(2*pi*f1*t1+pi));"; valueExpression "(time()<t1) ? pMax/2*(1+Cif*cos(2*pi*f1*time())) : p0*(1+C1*cos(2*pi*f*time()-pi/2)+C1*cos(4*pi*f*time()+pi/2))"; value uniform 0; } |
|
Tags |
time dependent |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wind turbine simulation | Saturn | CFX | 60 | July 17, 2024 06:45 |
Low Mixing time Problem | Mavier | CFX | 5 | April 29, 2013 01:00 |
Compile problem | ivanyao | OpenFOAM Running, Solving & CFD | 1 | October 12, 2012 10:31 |
vorticity boundary condition | bearcharge | Main CFD Forum | 0 | May 14, 2010 12:32 |
[blockMesh] Axisymmetrical mesh | Rasmus Gjesing (Gjesing) | OpenFOAM Meshing & Mesh Conversion | 10 | April 2, 2007 15:00 |