|
[Sponsors] |
September 20, 2021, 06:44 |
How to update volVectorField from files
|
#1 |
New Member
Join Date: Sep 2021
Posts: 10
Rep Power: 4 |
Hi,
I am new to OpenFOAM and new to C++ as well. I have a basic question. My question is what is the proper way to update volScalarField or volVectorField from files (the files come from previous calculation)? My problem is that I want to use scalarTransportFoam with prescribed time-varying velocity and phi field (calculated from pisoFoam). You might ask why don't I customise this into the time loop in pisoFoam. The thing is I know that my solution is periodic (with period of around 1s) so I only have to run pisoFoam for 3 periods for the solution to converge. Then, I can run scalarTransportFoam for 100 periods with the periodic velocity and phi field calculated earlier. By doing this, I think I can save a lot of time because I suppose pisoFoam is more computationally expensive than scalarTransportFoam. The problem is that scalarTransportFoam only works for time-independent velocity and it will overwrite all the subsequent velocity with the initial velocity. My solution is to first change IOobject::AUTO_WRITE to IOobject::NO_WRITE in the initialisation of U and phi in "createFields.H" and "createPhi.H". While this will prevent it to overwrite the prescribed U and phi field, it does not read the U and phi field for each time step. My second step is to include the following code inside the time loop of scalarTransportFoam: Code:
U = volVectorField ( IOobject ( "U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ), mesh ); phi = surfaceScalarField ( IOobject ( "phi", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE ), fvc::flux(U) ); |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
SIGSEGV Memory Access Exeption when Exporting Files using 'Update' | JamesPermain | STAR-CCM+ | 0 | April 22, 2020 10:50 |
The udf.h headers are unable to open- in VISUAL STUDIO 13 | sanjeetlimbu | Fluent UDF and Scheme Programming | 4 | May 2, 2016 05:38 |
UDF help for Rapid compression machine ECM. | sanjeetlimbu | Fluent UDF and Scheme Programming | 0 | March 17, 2015 22:45 |
Writing Case and Data Files Using Journal/Scheme Files | svp | Fluent UDF and Scheme Programming | 0 | April 5, 2011 11:04 |
Problems with result files | Kasper | CFX | 5 | December 14, 2006 02:41 |