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

rotating source term using fvOptions

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

Like Tree2Likes
  • 1 Post By anon_q
  • 1 Post By C. Okubo

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 16, 2018, 04:27
Default rotating source term using fvOptions
  #1
Senior Member
 
Join Date: Mar 2018
Posts: 115
Rep Power: 8
anon_q is on a distinguished road
Hello
In my simulation, I need to add a rotating source term to momentum equations without modifying the code of the solver.
Is it possible to use a rotating source term in fvOptions (has a distance R from the origin rotates about the origin (0,0,0) as a function of time and with given angular velocity)?
Please, can you give me an example?

PS: Without using MRF or Dynamic mesh.
C. Okubo likes this.

Last edited by anon_q; October 16, 2018 at 06:10.
anon_q is offline   Reply With Quote

Old   October 29, 2018, 11:12
Default
  #2
New Member
 
Join Date: Jan 2017
Posts: 22
Rep Power: 9
C. Okubo is on a distinguished road
Hi!

I am trying to do this also, but still not successful. Even though, SRFSimpleFoam is not an option for you?

Okubo
C. Okubo is offline   Reply With Quote

Old   October 29, 2018, 11:52
Default
  #3
New Member
 
Join Date: Jan 2017
Posts: 22
Rep Power: 9
C. Okubo is on a distinguished road
Tried some variations of the code below (in .../constant/fvOptions), but it is still not working well...

As far as I understand, this implements a explicit source...maybe, it should be implicit to work (like SRFSimpleFoam)?

Hope somebody can help...

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1806                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
velocitySource
{
    type            vectorCodedSource;

    vectorCodedSourceCoeffs
    {
        selectionMode   all;

        fields          (U);
        name            vectorSource;

        codeInclude
        #{

        #};

        codeCorrect
        #{
            Pout<< "**codeCorrect**" << endl;
        #};

        codeAddSup
        #{
	    vectorField& Usource = eqn.source();
            vector rotation = vector(0, 1, 0); // rotation in rad/s

	    const vectorField& radius = mesh_.C(); // center of cells (axis is considered passing through origin)
	    const vectorField& U_ = mesh().lookupObject<volVectorField>("U");

            Usource =  - (rotation^(rotation^radius)) - 2.0*(rotation^U_);
        #};

        codeSetValue
        #{
            Pout<< "**codeSetValue**" << endl;
        #};

        // Dummy entry. Make dependent on above to trigger recompilation
        code
        #{
            $codeInclude
            $codeCorrect
            $codeAddSup
            $codeSetValue
        #};
    }
}// ************************************************************************* //
anon_q likes this.
C. Okubo is offline   Reply With Quote

Old   March 30, 2023, 05:55
Default
  #4
ozi
New Member
 
Ph.D.(c) Oğuzhan KIRIKBAŞ
Join Date: Mar 2017
Location: İstanbul
Posts: 15
Rep Power: 9
ozi is on a distinguished road
Did you get any progress with your code. I am struggling with the same issue. Code is working but the solution blows up very quick because of the large numbers produced by the additional source term.



Quote:
Originally Posted by C. Okubo View Post
Tried some variations of the code below (in .../constant/fvOptions), but it is still not working well...

As far as I understand, this implements a explicit source...maybe, it should be implicit to work (like SRFSimpleFoam)?

Hope somebody can help...

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1806                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
velocitySource
{
    type            vectorCodedSource;

    vectorCodedSourceCoeffs
    {
        selectionMode   all;

        fields          (U);
        name            vectorSource;

        codeInclude
        #{

        #};

        codeCorrect
        #{
            Pout<< "**codeCorrect**" << endl;
        #};

        codeAddSup
        #{
        vectorField& Usource = eqn.source();
            vector rotation = vector(0, 1, 0); // rotation in rad/s

        const vectorField& radius = mesh_.C(); // center of cells (axis is considered passing through origin)
        const vectorField& U_ = mesh().lookupObject<volVectorField>("U");

            Usource =  - (rotation^(rotation^radius)) - 2.0*(rotation^U_);
        #};

        codeSetValue
        #{
            Pout<< "**codeSetValue**" << endl;
        #};

        // Dummy entry. Make dependent on above to trigger recompilation
        code
        #{
            $codeInclude
            $codeCorrect
            $codeAddSup
            $codeSetValue
        #};
    }
}// ************************************************************************* //
ozi 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
Source Term due to evaporation in energy transport equation styleworker OpenFOAM Programming & Development 3 September 7, 2022 04:09
[OpenFOAM.org] Error creating ParaView-4.1.0 OpenFOAM 2.3.0 tlcoons OpenFOAM Installation 13 April 20, 2016 18:34
[Other] How to use finite area method in official OpenFOAM 2.2.0? Detian Liu OpenFOAM Meshing & Mesh Conversion 4 November 3, 2015 04:04
SparceImage v1.7.x Issue on MAC OS X rcarmi OpenFOAM Installation 4 August 14, 2014 07:42
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 02:24


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