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

An awkward issue

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 29, 2021, 09:06
Default An awkward issue
  #1
New Member
 
Sandro Brad Martinez Sardon
Join Date: Sep 2021
Posts: 17
Rep Power: 5
sandrobrad is on a distinguished road
Hello,
First of all ,I'm a little newbie using Openfoam9 and right now I'm trying to simulate a flow around a NACA0012 using SA turbulence model.
I'm having some issues when I want to write and monitor the fields nu and nut, nuTilda using the function turbulenceFields located in the controlDict:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/

FoamFile
{
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //


application     simpleFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime        10000;

deltaT          1;

writeControl    timeStep;

writeInterval   100;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;




functions
{

    turbulenceFields1
    {
        type        turbulenceFields;

        libs       ("libfieldFunctionObjects.so");
        fields
        (
            k
            nut
            L
          
        );
	executeControl  writeTime;
	writeControl    writeTime;
    }

    forceCoeffs
	{
	    type            forceCoeffs;

	    libs            ("libforces.so");
	    writeControl    timeStep;
	    timeInterval    1;
	    log             yes;
	    patches         (airfoil);
	    rho             rhoInf;      // Indicates incompressible
	    rhoInf          1.225;           // Redundant for incompressible
	    
	   liftDir (0 1 0);
	   dragDir (1 0 0);
/*			
	    liftDir         (-0.08715574275 0.9961946981 0);
	    dragDir         (0.9961946981  0.08715574275  0);

*/
	    CofR            (0.72 0 0);  // Axle midpoint on ground
	    pitchAxis       (0 1 0);
	    magUInf         51.4815;
	    lRef            1;        // Wheelbase length
	    Aref            1.2944;        // Estimated //span= 0.6472197728*2 -> Aref = c*span;
	    /*
	    binData
	    {
		nBin        20;          // output data into 20 bins
		direction   (1 0 0);     // bin direction
		cumulative  yes;
	    }
	    */
	}
    yPlus1
    {
        type        yPlus;
        libs        ("libfieldFunctionObjects.so");
        writeControl    writeTime;
        patches         ("airfoil");
    }

}
// ************************************************************************* //
Even though the mesh quality is good , when I start the simulation the following message pop up:
Code:
Create time

Create mesh for time = 0


SIMPLE: Convergence criteria found
        p: tolerance 1e-05
        U: tolerance 1e-05
        nuTilda: tolerance 1e-05
        "(k|epsilon|omega)": tolerance 1e-06

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting turbulence model type RAS
Selecting RAS turbulence model SpalartAllmaras
Selecting patchDistMethod meshWave
RAS
{
    RASModel        SpalartAllmaras;
    turbulence      on;
    printCoeffs     on;
    sigmaNut        0.66666;
    kappa           0.41;
    Cb1             0.1355;
    Cb2             0.622;
    Cw2             0.3;
    Cw3             2;
    Cv1             7.1;
    Cs              0.3;
}

No MRF models present

No fvModels present
No fvConstraints present

Starting time loop

turbulenceFields turbulenceFields1: storing fields:
    nut
    k
    L

forces forceCoeffs:
    Not including porosity effects
forceCoeffs forceCoeffs:
    Not including porosity effects


--> FOAM FATAL ERROR:
attempted assignment to self

    From function void Foam::DimensionedField<Type, GeoMesh>::operator=(const Foam::DimensionedField<Type, GeoMesh>&) [with Type = double; GeoMesh = Foam::volMesh]
    in file /home/ubuntu/OpenFOAM/OpenFOAM-9/src/OpenFOAM/lnInclude/DimensionedField.C at line 535.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::error::abort() at ??:?
#2  Foam::DimensionedField<double, Foam::volMesh>::operator=(Foam::DimensionedField<double, Foam::volMesh> const&) in "/opt/openfoam9/platforms/linux64GccDPInt32Opt/bin/simpleFoam"
#3  Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::operator==(Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&) in "/opt/openfoam9/platforms/linux64GccDPInt32Opt/bin/simpleFoam"
#4  void Foam::functionObjects::turbulenceFields::processField<double>(Foam::word const&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&) at ??:?
#5  Foam::functionObjects::turbulenceFields::execute() at ??:?
#6  Foam::functionObjects::timeControl::execute() at ??:?
#7  Foam::functionObjectList::start() at ??:?
#8  Foam::Time::run() const at ??:?
#9  Foam::Time::loop() at ??:?
#10  ? in "/opt/openfoam9/platforms/linux64GccDPInt32Opt/bin/simpleFoam"
#11  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#12  ? in "/opt/openfoam9/platforms/linux64GccDPInt32Opt/bin/simpleFoam"
Aborted
And now is questions time :

1.
--> FOAM FATAL ERROR:
attempted assignment to self What does that mean?
2.
where should I start to watch in order to know whats going on?

3. Exta info : If i comment this specific part of the control dict the code works fine, so the issue is related with the use of the turbulenceFields function.
Code:
 turbulenceFields1
    {
        type        turbulenceFields;

        libs       ("libfieldFunctionObjects.so");
        fields
        (
            k
            nut
            L
          
        );
	executeControl  writeTime;
	writeControl    writeTime;
    }
Therefore, could you tell me how to fix that error?.Don't hesitate to ask me if you need more info about my case. Thanks in advance.
sandrobrad is offline   Reply With Quote

Old   November 5, 2021, 08:27
Default
  #2
New Member
 
Join Date: May 2019
Posts: 16
Rep Power: 7
NiklasW is on a distinguished road
Hello,

in general self assignment means that you are trying to assign a variable to itself, something like:
Code:
int x = 5;
x = x;
In your case this error might be caused if you are trying to store a field which is already stored in the database under the same name.

Suggestions for solving the issue:
1.) Find out if some of the fields are already stored and if so, remove them from your field list
2.) If this doesn't help, add the following line to your turbulenceFields subdict:
prefix true;
With this, the fields will be stored under a different name.
3.) I assume you also want the fields to be written in the time folders. I think this requires you to use the writeObjects function object additionally.


Hope this helps.
NiklasW 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
Issue on zeroGradient BC for system rotation magnushaese OpenFOAM Running, Solving & CFD 2 January 28, 2022 14:43
rhoCentralFoam inviscid airfoil issue (Foam::error::printStack(Foam::Ostream&) at ??) kmkb21 OpenFOAM Running, Solving & CFD 1 March 1, 2018 02:07
Prism Layer - Core Mesh Boundary Issue InfernoxCJC STAR-CCM+ 7 November 21, 2017 16:46
foamToTecplot360 issue with multiregion solvers manuc OpenFOAM Post-Processing 2 November 21, 2016 14:51
Pressure boundary condition issue Vijay FLUENT 0 April 6, 2012 14:35


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