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

Issue with codedFixedValue: oldTime()

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By anthonygay1812

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 3, 2020, 01:55
Default Issue with codedFixedValue: oldTime()
  #1
New Member
 
Anthony Gay
Join Date: Oct 2019
Posts: 17
Rep Power: 7
anthonygay1812 is on a distinguished road
Hello

I'm trying to implement the following BC

Code:
        type               codedFixedValue; 
        value              $internalField;
        redirectType       hybridParticleContinuim; 

        code 
        #{ 
            const fvMesh& fluidMeshRef = patch().boundaryMesh().mesh();
            const volScalarField& pFluid = db().lookupObject<volScalarField>("p"); 
            const volScalarField& pParticle = db().lookupObject<volScalarField>("p_Mean");
            const volScalarField& pFluidOld=pFluid.oldTime();
            Info<< "code accessed";

            //const scalar t = this->db().time().value();
            const label fluidIdx=fluidMeshRef.nCells();
            const label particleIdx=1;
            const scalar w=0.75; 

            operator==(1-w)*pFluidOld[fluidIdx]+w*(0.5*pFluid[fluidIdx]+0.5*pParticle[particleIdx]); 
        #};
Unfortunately the
Code:
pFluidOld[fluidIdx]
is triggering the following error

Code:
/p.boundaryField.fluidBound:43:28: error: invalid operands of types ‘void’ and ‘const double’ to binary ‘operator*’
/opt/openfoam7/wmake/rules/General/transform:25: recipe for target 'Make/linux64GccDPInt32Opt/fixedValueFvPatchFieldTemplate.o' failed
make: *** [Make/linux64GccDPInt32Opt/fixedValueFvPatchFieldTemplate.o] Error 1


--> FOAM FATAL IO ERROR
I can't quite figure out how to approach this. I have figured out that its pFluidOld[fluidIdx] thats returning a void value. Is there a better way to get the pressure from the previous timestep?

Any help is appreciated thank you!
anthonygay1812 is offline   Reply With Quote

Old   May 3, 2020, 02:58
Default Resolved Sort of
  #2
New Member
 
Anthony Gay
Join Date: Oct 2019
Posts: 17
Rep Power: 7
anthonygay1812 is on a distinguished road
So it turns out my initial guess was way off and I simply had a syntax error in the operator statement, the correct line is
Code:
            operator==((1-w)*pFluidOld[fluidIdx]+w*(0.5*pFluid[fluidIdx]+0.5*pParticle[particleIdx]));
Notice the parenthesis. Unfortunately now my code is crashing when it tries to access the BC

Code:
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Create mesh for time = 0

Meshes created
Reading thermophysical properties

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

Using dynamicCode for patch fluidBound on field p at line 30 in "/home/anthonygay1812/OpenFOAM/Working/finalShockTube/0/fluid/p.boundaryField.fluidBound"
I have run into this sort of issue before and it happened when I had not properly initialized with the setFields command. So my guess is that something within the BC code may not accessible.
ruloz likes this.
anthonygay1812 is offline   Reply With Quote

Reply

Tags
boundary condition, codedfixedvalue, time average problem


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 15:13.