CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Restart simulation with different inflow (https://www.cfd-online.com/Forums/openfoam-solving/222774-restart-simulation-different-inflow.html)

cmgotelli December 8, 2019 23:46

Restart simulation with different inflow
 
Hi all! I'm running a simulation with interFoam and I have a (maybe) dumb question. I'm trying to restart a simulation from the 30 second, but using a different inflow rate. I've tried copying the solution from the folder "30" into a folder named "0", changing the initialConditions file in the path "0/include". Nevertheless, the after running the simulation I can't see any change in the results, it's like the flow never increased.
I've looked in forums but the answers I've found are for restarting with the same flow. Can any of you help me please?

Thanks in advance!

Bazinga December 9, 2019 06:36

you might want to post your files, but initialConditions are the conditions for the first guess at the flow field. You want to change your boundary conditions to increase the flow rate.

Krao December 9, 2019 06:48

Hi Clemente,

I would like to know, why you are copying the results into the 0 folder. You can resume your simulation from the latest time step, by editing your controlDict. As Mr. Bazinga told, you need to change the boundary conditions, to the new flow rate. You can edit your the BCs in the last time step, and continue the simulation from there onwards.

cmgotelli December 9, 2019 07:00

Hi Krao,


Thanks for your reply.


Quote:

I would like to know, why you are copying the results into the 0 folder

I'm doing it just to try something different, originally I just use the LatestTime setting in controlDict.


Quote:

You can edit your the BCs in the last time step, and continue the simulation from there onwards.

To do this I only have to replace the U file, or do I have to do something else?
Thank you again!!

cmgotelli December 9, 2019 07:03

Thank you Bazinga for replying! This are my files:


Code:

/*--------------------------------*- C++ -*----------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    | Website:  https://openfoam.org
    \\  /    A nd          | Version:  7
    \\/    M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application    interFoam;

startFrom      latestTime;

startTime      0;

stopAt          endTime;

endTime        100;

deltaT          0.001;

writeControl    adjustableRunTime;

writeInterval  0.1;

purgeWrite      0;

writeFormat    binary;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision  6;

runTimeModifiable yes;

adjustTimeStep  on;

maxCo          0.1;
maxAlphaCo      0.1;

maxDeltaT      1;

// ************************************************************************* //


Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      polyBoundaryMesh;
    location    "constant/polyMesh";
    object      boundary;
}

5       
(
    atmosphere
    {
        type patch;
        nFaces 89;
        startFace 3962;
    }
    inlet
    {
        type patch;
        nFaces 48;
        startFace 4051;
    }
    lowerWall
    {
        type wall;
        nFaces 128;
        startFace 4099;
    }
    outlet
    {
        type Unspecified;
        nFaces 19;
        startFace 4227;
    }
    BaseAndTop
    {
        type empty;
        nFaces 4104;
        startFace 4246;
    }
)


Code:

/*--------------------------------*- C++ -*----------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    | Website:  https://openfoam.org
    \\  /    A nd          | Version:  7
    \\/    M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      volVectorField;
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#include        "include/initialConditions"

dimensions      [0 1 -1 0 0 0 0];

internalField  uniform (0 0 0);

boundaryField
{
    inlet
    {
        type            variableHeightFlowRateInletVelocity;
        flowRate        $inletFlowRate;
        alpha          alpha.water;
        value          uniform (0 0 0);
    }

    outlet
    {
        type            zeroGradient;
    }

    lowerWall
    {
        type            noSlip;
    }

    atmosphere
    {
        type            pressureInletOutletVelocity;
        value          uniform (0 0 0);
    }

    defaultFaces
    {
        type            empty;
    }
}

// ************************************************************************* //




Code:

/*--------------------------------*- C++ -*----------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    | Website:  https://openfoam.org
    \\  /    A nd          | Version:  7
    \\/    M anipulation  |
\*---------------------------------------------------------------------------*/

inletFlowRate        60;
pressure            0;
turbulentKE          4.14e-03;
turbulentEpsilon    4.39e-05;

// ************************************************************************* //


As I read from you and Krao, I have to change the last two files in the latestTime that was recorded, right?


Thank you again!

Krao December 9, 2019 07:12

Yes you need to edit the last two files, but I don't think they are required to be replaced.

Assuming that you have a fully developed flow at the latest time step, it is worth to make use of the simulation results obtained so far. So, I would insert the new values into the required part/patch, by editing the files in the required U/K/epsilon/P files in the latest time step folder. Or, if you think that would not make any sense, you can replace and continue.

cmgotelli December 9, 2019 07:24

ohh that's great! One last thing, there's any way to edit these files if they are written in binary, or do I have to write the results in ascii format only?


thanks again!

Krao December 9, 2019 07:30

Not required, Binary is ok! But don't open these binary files in standard editors, as it makes the process slow. Use vi editor in your terminal to open and edit these files. Search for the particular patch and edit it. If you are not familiar with Linux terminal use the following link to explore more http://www.wolfdynamics.com/images/O...rash_intro.pdf

cmgotelli December 9, 2019 07:35

1 Attachment(s)
Yes, I'm using Ubuntu actually. The thing is that when I use the vi editor to open these files I get something weird. Attached is an image, maybe I have to use another editor like vim?

Krao December 9, 2019 07:50

What you are getting is absolutely okay, try to search the required patch in the file. For example inlet patch.

cmgotelli December 9, 2019 07:55

1 Attachment(s)
OMG you're right! hahaha I think that I just have to change the "flowRate", right?

Krao December 9, 2019 07:57

Yes :D you are ready to go from here!

cmgotelli December 9, 2019 08:11

Thanks! I really appreciate your help! <3


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