How to update volVectorField from files
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 |
All times are GMT -4. The time now is 01:37. |