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

Want to change value of g during case running. i.e after 3 seconds

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 22, 2015, 00:50
Post Want to change value of g during case running. i.e after 3 seconds
  #1
Member
 
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0
13msmemusman is on a distinguished road
i want to apply value of g in a different way. i want to change value of g after half of endTime. Is there any way to do that???? i tried if else statement but it doesnt work and terminates with this error
--> FOAM FATAL IO ERROR:
"ill defined primitiveEntry starting at keyword 'if' on line 19 and ending at line 28"

file: /home/usman/OpenFOAM/project2D/constant/g at line 28.

From function primitiveEntry::readEntry(const dictionary&, Istream&)
in file lnInclude/IOerror.C at line 132.

FOAM exiting
13msmemusman is offline   Reply With Quote

Old   March 22, 2015, 01:15
Post Help required. i want to change value of g after half of endTime
  #2
Member
 
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0
13msmemusman is on a distinguished road
hye i want to change value of g after half of endTime. i did the following changes in g file



/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
double B;
value (B -9.81 0)

if (runTime.timeName() < ( endTime / 2)) {B = 0}
else
{B = 15};

// ************************************************** *********************** //



but the error was

Reading g


--> FOAM FATAL IO ERROR:
wrong token type - expected Scalar, found on line 19 the word 'B'

file: /home/usman/OpenFOAM/project2D/constant/g.value at line 19.

From function operator>>(Istream&, Scalar&)
in file lnInclude/Scalar.C at line 93.

FOAM exiting


please help me how can i do that
13msmemusman is offline   Reply With Quote

Old   March 22, 2015, 01:40
Post
  #3
Member
 
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0
13msmemusman is on a distinguished road
hello foamers i also have a similer problem.
i just want to do this

double B;
value (B -9.81 0)

if (runTime.timeName() < ( endTime / 2)) {B = 0}
else
{B = 15;}




please tell me how to do this. i am new in openfoam and programming
13msmemusman 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
Running AMI case in parallel Kaskade OpenFOAM Running, Solving & CFD 3 March 14, 2016 15:58
running a case of multiphase Nozzle 2d harsha_kulkarni OpenFOAM Running, Solving & CFD 3 June 19, 2014 04:29
facing high courant number while running the case in OpenFOAM Nikhil Thakur Main CFD Forum 1 July 30, 2012 04:23
Free surface boudary conditions with SOLA-VOF Fan Main CFD Forum 10 September 9, 2006 12:24
How to save a case running in background us FLUENT 0 July 6, 2005 10:43


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