|
[Sponsors] |
Reading a volumeField from a file at every timestep |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 20, 2022, 08:37 |
Reading a volumeField from a file at every timestep
|
#1 |
New Member
Jesus
Join Date: Sep 2021
Posts: 11
Rep Power: 5 |
Hi everyone,
I want to implement a new discretization scheme for the convective term in OpenFOAM. At every timestep, I have a coefficient file generated by python with the format: Code:
... header internalField nonuniform List<vector> 16384 ( (1.03544e-05 -1.06153e-05 1.03544e-05 1.03544e-05 ) // Cell 0 (3.06175e-05 -1.01041e-05 -1.01041e-05 -1.01041e-05) // Cell 1 (5.11404e-05 -9.46919e-06 -9.46919e-06 -9.46919e-06) // Cell 2 (7.20913e-05 -9.58538e-06 -9.58538e-06 -9.58538e-06 ) // ... (9.31207e-05 -9.87433e-06 -9.87433e-06 -9.87433e-06 ) (0.000115088 -1.02901e-05 -1.02901e-05 -1.02901e-05 ) I guess I should implement this on the runTime.loop(), since createFields.H is only executed once at the beginning of the main loop, but I do not have a clear idea of how to do that. Thank you in advance! |
|
September 21, 2022, 08:37 |
|
#3 |
New Member
Jesus
Join Date: Sep 2021
Posts: 11
Rep Power: 5 |
Thank you Mr Wang for your reply, it was what I was looking for. For anyone with the same doubt, the solution was to modify the createFields.H of your solver, and add the following lines:
Code:
volVectorField coefficients ( IOobject ( "coefficients", runTime.timeName(), mesh, IOobject::MUST_READ_IF_MODIFIED, //If object is registered its timestamp will be checked every timestep and possibly re-read. IOobject::NO_WRITE //No automatic writing, but can be written explicitly ), mesh ); |
|
Tags |
createfields, new implementation, read fields |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Postprocess: sampleDict works but creates no output folder | shock77 | OpenFOAM Post-Processing | 14 | November 15, 2021 09:27 |
Problem compiling a custom Lagrangian library | brbbhatti | OpenFOAM Programming & Development | 2 | July 7, 2014 12:32 |
[swak4Foam] Error bulding swak4Foam | sfigato | OpenFOAM Community Contributions | 18 | August 22, 2013 13:41 |
Version 15 on Mac OS X | gschaider | OpenFOAM Installation | 113 | December 2, 2009 11:23 |
OpenFOAM on MinGW crosscompiler hosted on Linux | allenzhao | OpenFOAM Installation | 127 | January 30, 2009 20:08 |