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/)
-   -   Problem with velocity profile varying in time (https://www.cfd-online.com/Forums/openfoam-pre-processing/244450-problem-velocity-profile-varying-time.html)

André Silva August 9, 2022 01:33

Problem with velocity profile varying in time
 
Hi everybody, im a postgraduate student currently working with openfoam. I have a problem and i can't figure how to solve it, i have this velocity profile,


Code:

    inlet_profile
    {
        type            codedFixedValue;
        value          uniform (0 0 0);
        name  parabolicProfile;
       
            code
            #{               
                const fvPatch& boundaryPatch = patch();
                const vectorField& Cf = boundaryPatch.Cf();
                vectorField& field = *this;

                scalar t = this->db().time().value();
                forAll(Cf, faceI)
                {
                  field[faceI] = vector (sin(t*3.141592/0.2)*0.8*(0.5-0.5*tanh(10.*((200.0*(sqrt(pow(Cf[faceI].y(),2)+pow(Cf[faceI].z(),2))))-1.0))) ,0,0);
                }
            #};
       
    }

as you can see, my profile varies in time (sine function) but I don't know how to "change" this dependence after I arrive certain value, what I want to do is when I arrive to time=0.2[sec] change the profile to another one ( for example for t>0.2[sec] change to U=(0,0,0) and continue the simulation), I think I need to use an IF statement, but I don't know how to do it.

Thank you


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