|
[Sponsors] |
July 12, 2008, 05:07 |
Hi All,
I am trying to modi
|
#1 |
Senior Member
Mark Couwenberg
Join Date: Mar 2009
Location: Netherlands
Posts: 130
Rep Power: 17 |
Hi All,
I am trying to modify interFoam solver to my needs. It is necessary for the new solver to perform an initialisation step (include"initialise.H"). Here, from time = 0 the p field is needed to perform some tasks. Now my question is: how to make it always reading this time =0? I tried many things: In initialise.H add: //volScalarField p ( IOobject ( "p", runTime.timeName(0), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); This compiles but when running it reads from the startTime stated in controldict anyway. Uncommenting the line volScalarField p gives compiler error: p already declared. That is correct, this is done with createrFields. I moved around with the location in the main solver of the initialisation step, without succes. I think it is really something trivial, however, not for me apparently. A more general question (as I have similar questions more often): anyone has advice as where to find some good basic C-programming reading, except for the user manal? Thanks in advance, Mark |
|
July 14, 2008, 04:20 |
Hi Mark,
isn't the pressure
|
#2 |
New Member
Tammo Wenterodt
Join Date: Mar 2009
Posts: 24
Rep Power: 17 |
Hi Mark,
isn't the pressure in interFoam called pd? This field is created in createFields.H, you can initialize it right there. Also when you specify IOobject::MUST_READ, the solver will attempt to read the field upon start. Maybe the combination IOobject::NO_READ, IOobject::AUTO_WRITE is what you are looking for? Regards, Tammo |
|
July 14, 2008, 05:29 |
Hello Tammo,
Thanks for you
|
#3 |
Senior Member
Mark Couwenberg
Join Date: Mar 2009
Location: Netherlands
Posts: 130
Rep Power: 17 |
Hello Tammo,
Thanks for your reply. Yes, you are right, pd is usualy used in interFoam. However I created an extra field p which contains hydrostatic pressure. However, this does not matter here. I initialised this in createFields.H as with other fields. The problem is simply that I can only read it once and that it always uses the startTime from the controlDict, as usual. However I want to read one field (p) one more time but at a different time (always "0" instead of "startTime"). I feel a bit dump about it because I suspect it is really something simple for experienced OF-ers. Brgds, Mark |
|
July 14, 2008, 05:57 |
How about copying your p-file
|
#4 |
New Member
Tammo Wenterodt
Join Date: Mar 2009
Posts: 24
Rep Power: 17 |
How about copying your p-file to "constant" and then use runTime.constant()?
|
|
July 14, 2008, 07:01 |
Hello Tammo,
I think I foun
|
#5 |
Senior Member
Mark Couwenberg
Join Date: Mar 2009
Location: Netherlands
Posts: 130
Rep Power: 17 |
Hello Tammo,
I think I found the problem. The code snippet I posted in the 1st message does not contain the word mesh just before the final bracket. Now I added this word and it seems to work. The structure now is: solver.C int main(int etc etc) - - #include "createFields.H" etc etc #include "initialise.H" (extra header file) This header file contains amongst others: ( IOobject ( "p", runTime.timeName(0), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ), mesh ); back to solver.C and further. It seems to work. Thanks for your advice, Mark |
|
July 14, 2008, 08:41 |
Recall: no it did not work. In
|
#6 |
Senior Member
Mark Couwenberg
Join Date: Mar 2009
Location: Netherlands
Posts: 130
Rep Power: 17 |
Recall: no it did not work. In this setup "initialise.H" still seems to work with the timestep which is stated as "startTime" instead of "0".
We continue trying... Mark |
|
July 14, 2008, 09:27 |
1. Did you give the runTime.co
|
#7 |
New Member
Tammo Wenterodt
Join Date: Mar 2009
Posts: 24
Rep Power: 17 |
1. Did you give the runTime.constant() idea a shot?
2. how about (this is not pretty but might work) creating a field pConst with IOobject::AUTO_WRITE, from which you make a copy "p" (which you can alter as you like) whenever you need it ? The solver should then always find a pConst in the actual time-directory. Any good? |
|
July 14, 2008, 11:00 |
Hello Tammo,
1. Not yet, wi
|
#8 |
Senior Member
Mark Couwenberg
Join Date: Mar 2009
Location: Netherlands
Posts: 130
Rep Power: 17 |
Hello Tammo,
1. Not yet, will try asap. 2. Will keep that as emergency exit. Thanks for your advice, Mark |
|
July 22, 2008, 16:11 |
Hello All,
This did the tri
|
#9 |
Senior Member
Mark Couwenberg
Join Date: Mar 2009
Location: Netherlands
Posts: 130
Rep Power: 17 |
Hello All,
This did the trick: >>> # include "addTimeOptions.H" # include "setRootCase.H" # include "createTime.H" // Get times list instantList Times = runTime.times(); // set startTime and endTime depending on -time and -latestTime options # include "checkTimeOptions.H" runTime.setTime(Times[startTime], 0); # include "createMesh.H" # include "createFields.H" createfields e.g.: >>> Info<< "Reading field pd\n" << endl; volScalarField pd ( IOobject ( "pd", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); <<< <<< Brgds, Mark |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Time step size and max iterations per time step | pUl| | FLUENT | 31 | October 23, 2020 23:50 |
SELECTING TIME STEP SIZE, NUMBER OF TIME STEP | NITUL KALITA | FLUENT | 2 | November 22, 2012 09:28 |
Reading case file at certain time interval | Chin Fook | FLUENT | 1 | September 11, 2008 07:54 |
Long time CHT transient simulation time step.... | JP | CFX | 0 | May 9, 2008 04:36 |
Relation of computational time step with real time | Salman | Main CFD Forum | 2 | August 3, 2005 15:13 |