setFields.C within solver code
Does anyone know if it is possible to call setFields.C from within the solver C code? What is the correct procedure since both C codes have main function (and this gives an error).
Still learning C++!
Probably a very stupid answer..but hope it helps ...
Create your own solver ... and change name of setFields.C keeping the references same and change the mail function in it to your name...
Might work ... If it doesnt... dont blame me :)
what fields do you want to set? You probably only need a few lines of code to set the fields you want.
For example, if you want to set the value of a volScalarField vsf based on the x coordinate of the cell centre:
Thanks for your replies. I wanted to change the temperature, which has a constant access in the source code. So unless I add a non constant access to T in the source code, I have to use other ways to change T.
I tried some ways based on what I found in the forum, and found that using setFields works. But I want to use it to change T over a few time steps, and so am looking to include it in the solver.
Following is the code I use (and it works) but for this to work, I need to have time directories after each computation. Any ways to avoid this and use the previous time step computations directly, without creating time directories?
instantList timeDirs = instantList(1, instant(runTime.value(), runTime.timeName())); //writeInterval has to be same as computational 'fixed' deltaT
Info<< "Reading setFieldsDict\n" << endl;
Info<< "Setting field region values" << endl;
const entry& region = regions[regionI];
autoPtr<topoSetSource> cellSelector =
topoSetSource::New(region.keyword(), mesh, region.dict());
mesh.nCells()/10+1 // Reasonable size estimate.
|All times are GMT -4. The time now is 02:37.|