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

Add source term in the NS equation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 13, 2021, 11:27
Default Add source term in the NS equation
  #1
New Member
 
Thibaut
Join Date: Nov 2020
Posts: 21
Rep Power: 5
Taendyr is on a distinguished road
Hi,
I built a polynomial solution for the compressible NS equations, which gives me a source term which is also polynomial.

In every paper I read about OpenFoam solvers, I see no source term. However when I look in the source code of rhoPimpleFoam, I can see a ==fvOptions(U). I guess this is the source term.
I tried this in fvOptions:
Code:
vectorCodedSource
{
    type            vectorCodedSource;
    name            vectorCodedSource;
        selectionMode   all;

        fields          (U);


        

        codeInclude
        #{
        #};

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

        codeAddSup
        #{
            const Time& time = mesh().time();
            const scalarField& V = mesh_.V();
            vectorField& uSource = Uqn.source();
            // Retrieve the x component of the cell centres
            const scalarField& cellx = mesh_.C().component(0);
            forAll(cellx,i)
            {
                uSource[i] += (1e5*(5-cellx[i]),0,0);
            }
        #};

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

}
When I execute rhoPimpleFoam I have some errors:
Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


PIMPLE: no residual control data found. Calculations will employ 3 corrector loops

Reading thermophysical properties

Selecting thermodynamics package
{
    type            hePsiThermo;
    mixture         pureMixture;
    transport       const;
    thermo          hConst;
    equationOfState perfectGas;
    specie          specie;
    energy          sensibleInternalEnergy;
}

Reading field U

Reading/calculating face flux field phi

Creating turbulence model

Selecting turbulence model type laminar
Selecting laminar stress model Stokes
Creating field dpdt

Creating field kinetic energy K

No MRF models present

Creating finite volume options from "system/fvOptions"

Selecting finite volume options type vectorCodedSource
    Source: vectorCodedSource
    - selecting all cells
    - selected 100 cell(s) with volume 40
Courant Number mean: 0 max: 0

Starting time loop

Courant Number mean: 0 max: 0
deltaT = 1.20048e-06
Time = 1.20048e-06

PIMPLE: iteration 1
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
Using dynamicCode for fvOption::vectorCodedSource at line 19 in "/mnt/c/Users/MyName/OpenFOAM/shockTubeSource/system/fvOptions.vectorCodedSource"
Could not load "/mnt/c/Users/MyName/OpenFOAM/shockTubeSource/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libvectorCodedSource_f246261c7f08eb1177877a95da075ee833702145.so"
/mnt/c/Users/MyName/OpenFOAM/shockTubeSource/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libvectorCodedSource_f246261c7f08eb1177877a95da075ee833702145.so: cannot open shared object file: No such file or directory
Invoking wmake libso /mnt/c/Users/MyName/OpenFOAM/shockTubeSource/dynamicCode/vectorCodedSource
wmake libso /mnt/c/Users/MyName/OpenFOAM/shockTubeSource/dynamicCode/vectorCodedSource
Could not load "/mnt/c/Users/MyName/OpenFOAM/shockTubeSource/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libvectorCodedSource_f246261c7f08eb1177877a95da075ee833702145.so"
/mnt/c/Users/MyName/OpenFOAM/shockTubeSource/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libvectorCodedSource_f246261c7f08eb1177877a95da075ee833702145.so: cannot open shared object file: No such file or directory
Selecting finite volume options type vectorCodedSource
    Source: vectorCodedSource
    - selecting all cells
    - selected 100 cell(s) with volume 40
Using dynamicCode for fvOption::vectorCodedSource at line 0 in "/mnt/c/Users/MyName/OpenFOAM/shockTubeSource/system/fvOptions.vectorCodedSource"
Could not load "/mnt/c/Users/MyName/OpenFOAM/shockTubeSource/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libvectorCodedSource_f246261c7f08eb1177877a95da075ee833702145.so"
/mnt/c/Users/MyName/OpenFOAM/shockTubeSource/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libvectorCodedSource_f246261c7f08eb1177877a95da075ee833702145.so: cannot open shared object file: No such file or directory
Invoking wmake libso /mnt/c/Users/MyName/OpenFOAM/shockTubeSource/dynamicCode/vectorCodedSource
wmake libso /mnt/c/Users/MyName/OpenFOAM/shockTubeSource/dynamicCode/vectorCodedSource
Could not load "/mnt/c/Users/MyName/OpenFOAM/shockTubeSource/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libvectorCodedSource_f246261c7f08eb1177877a95da075ee833702145.so"
/mnt/c/Users/MyName/OpenFOAM/shockTubeSource/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libvectorCodedSource_f246261c7f08eb1177877a95da075ee833702145.so: cannot open shared object file: No such file or directory
Selecting finite volume options type vectorCodedSource

Last edited by Taendyr; February 15, 2021 at 07:58.
Taendyr is offline   Reply With Quote

Reply


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 03:09
[swak4Foam] swak4foam for OpenFOAM 4.0 mnikku OpenFOAM Community Contributions 80 May 17, 2022 08:06
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 03:30
[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
what is swap4foam ?? AB08 OpenFOAM 28 February 2, 2016 01:22


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