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

How to access endTime in codedFixedValue

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By KTG
  • 1 Post By KTG

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 10, 2018, 04:46
Default How to access endTime in codedFixedValue
  #1
KTG
Senior Member
 
Abe
Join Date: May 2016
Posts: 119
Rep Power: 10
KTG is on a distinguished road
Hey everyone,



this is pretty simple, but I can't seem to figure it out! I am just trying to access "endTime" in my codestream so that I can set the flow direction to move through a 90 degree angle from startTime to endTime. I have made various wild guesses, but no luck - the below breaks at the line: scalar tend = this->db().time().endTime();


Code:
    "in.*"
    {
       type            codedFixedValue;
        value           uniform (0 0 0);
        redirectType    timeDepWind;
   
    code
        #{
            scalar U_0 = 3;  
            const fvPatch& boundaryPatch = patch(); 
            const vectorField& Cf = boundaryPatch.Cf(); 
            vectorField& field = *this; 

        scalar t = this->db().time().value();
        scalar tend = this->db().time().endTime();
         forAll(Cf, faceI)
            {

                field[faceI] = vector(tend,0,0); 
        }

       #};         

      codeOptions
      #{

            -I$(LIB_SRC)/finiteVolume/lnInclude \
            -I$(LIB_SRC)/meshTools/lnInclude

       #};

      codeInclude
       #{
              #include "fvCFD.H"
              #include <cmath>
             #include <iostream>
      #};
    }

Any ideas?
atulkjoy likes this.
KTG is offline   Reply With Quote

Old   October 16, 2018, 05:00
Default
  #2
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Hi!


You try to pass a dimensionedScalar to a scalar. Try with this->db().time().endTime().value()
Maybe you just need "this->db().endTime().value()", i'm not sure which is the correct, but that .value() is missing.
simrego is offline   Reply With Quote

Old   October 16, 2018, 05:52
Default
  #3
KTG
Senior Member
 
Abe
Join Date: May 2016
Posts: 119
Rep Power: 10
KTG is on a distinguished road
Thanks! It is working with:


this->db().time().endTime().value()


I need to spend more time learning C++...
ancolli likes this.
KTG 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
[DesignModeler] DesignModeler Scripting: How to get Full Command Access ANT ANSYS Meshing & Geometry 53 February 16, 2020 16:13
codedFixedValue: accessing other patch causes crash in parallel RL-S OpenFOAM Running, Solving & CFD 2 December 24, 2019 22:20
cannot set exact 'endtime' in controlDict when using a steady state solver minecraftgp OpenFOAM Running, Solving & CFD 4 July 24, 2018 06:13
codedFixedValue BC access to boundary patch face nodes instead of centers? Svenja OpenFOAM Pre-Processing 0 April 10, 2018 04:56
Is there a way to access the gradient limiter in Fluent ? CFDYourself FLUENT 1 February 16, 2016 06:49


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