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

source term that stays constant over outerCorrectors of pimple loop

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 18, 2022, 23:45
Default source term that stays constant over outerCorrectors of pimple loop
  #1
Member
 
Jnana Bhaskar Rao
Join Date: Mar 2020
Posts: 46
Rep Power: 6
jnanabrao is on a distinguished road
Dear all,


My transient compressible flow calculation requires addition of random disturbances to the boundary layers of a nozzle at a particular location. The way I tried to do it is


1) create a cellSet of the boundary cells at the location.

2) Add random momentum source terms (disturbances) of the necessary magnitude using fvOptions active only at the aforementioned cellSet.



The issue:
For reasons I can't elaborate here, I need to use a pimple solver with 5 outerCorrector loops. I would like to keep my source term constant over all the 5 correctors. Unfortunately, when I tried to do so, I realized that fvOptions is called each time the U.Eqn is solved and it modifies the disturbances at each outer corrector step. My code for fvOptions is shared below


Code:
codedSource
{
    type            vectorCodedSource;
    selectionMode   cellSet;
    cellSet         boundaryLayerForce;

    fields           (U);
    name           disturbance;

    codeInclude
    #{
    #include "Random.H"
    # include "clock.H"
    #};
    
    codeCorrect
    #{
    #};

    codeAddSup
    #{
        const Time& time = mesh().time();
        Random rng(time.value());//Random rng(clock::getTime() + pid());
        vectorField& USource = eqn.source();
       
        // Start time
        const scalar startTime = -1.0;

        if (time.value() > startTime)
        {
             const labelList& cellIDs = cells();
            // Apply the source
            forAll(cellIDs, i)
            {
                label cellI = cellIDs[i];
                vector epsilon (1, 1, 1);
                epsilon.x() = -1.0 + 2.0*(rng.scalar01());
                epsilon.y() = -1.0 + 2.0*(rng.scalar01());
                epsilon.z() = 2.0*(-1.0 + 2.0*(rng.scalar01()));
               
                USource[cellI].x() =1e-4*508*epsilon.x();
                USource[cellI].y() =1e-4*508*epsilon.y();
                USource[cellI].z() = 1e-4*508*epsilon.z();
            };
        
        }
    #};

    codeSetValue
        #{
        #};
}

        {
As you can see the disturbances are scaled a fixed order of magnitude from a scalar (1e-04*508). These are then randomly weighed with a different random number between -2 and 2 in each cell.


The constant updating of the disturbances within a time step is not what I want and it leads to immediate blow up of the calculation.



My questions:
Is it possible to use fvOptions to add source terms that stay constant at a time step over all the outer correctors? It seems possible as fvOptions can access the time value.



Do I have to modify my solver in order to add disturbances and solve with a pimple loop?

Last edited by jnanabrao; February 20, 2022 at 03:33. Reason: I realized I didn't need to multiply the source term with rho. The main question is still open
jnanabrao is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[openSmoke] LaminarSMOKE compilation error mdhfiz OpenFOAM Community Contributions 7 October 4, 2022 13:57
[swak4Foam] swak4foam for OpenFOAM 4.0 mnikku OpenFOAM Community Contributions 80 May 17, 2022 08:06
[foam-extend.org] Problems installing foam-extend-4.0 on openSUSE 42.2 and Ubuntu 16.04 ordinary OpenFOAM Installation 19 September 3, 2019 18:13
Trouble compiling utilities using source-built OpenFOAM Artur OpenFOAM Programming & Development 14 October 29, 2013 10:59
centOS 5.6 : paraFoam not working yossi OpenFOAM Installation 2 October 9, 2013 01:41


All times are GMT -4. The time now is 16:31.