Operations during iterations
Greetings, FOAMers!
I have magnetic problem solver Code:
1. B=fvc::curl(A); Basically I want that these 5 steps are done during each iteration, so I could get an output similar to this Code:
DICPCG: Solving for Ax, Initial residual = 1, Final residual = 8.67698e-06, No Iterations 96 Any hint would be much appreciated! Yours, Martin |
I do not fully understand what sets of equations you are trying to solve. Is it a time-dependent problem?
Short answer: A while loop does the job. Long answer: In case of a steady-state problem, you can just use the time-iteration as iteration over your set of equations. This is what is done in the simpleFoam solver. You can look at some of these cases and check how iterative convergence is controlled in these examples. (using residualControl). (Now rechecking the code, and simpleFoam in 2.1.1 does not explicitly call it a time-loop anymore, although the output does) If your problem is transient, you cannot misuse the time loop for that, and you should build an additional loop around your five lines of code. This what is done in the pimpleFoam solver. |
Sweet, thanks Bernhard! I tried this before but calculation was blowing up so I was looking for different ways. Just had to rearrange order of equations and then follow your advice.
I don't want to start a new thread for a new simple question as I hope someone will reply in here. How can I write a field? But not simply like Code:
volScalarField T ( IOobject ( "T", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Code:
volScalarField T ( IOobject ( "T", runTime.timeName(), mesh ) ); Sadly it doesn't work this simple as I understand there is need for some argument (equation). Like Code:
volScalarField T ( IOobject ( "T", runTime.timeName(), mesh ) |
I don't understand your follow-up question. Also, writing all on one line doesn't make it clearer to read. I thought it was possible to do just something like T.write() or something like that (see e.g. the source code of potentialFoam)
|
Sorry, was a bit tired when I wrote this question.
Lets say I define a field B in createFields.H. Code:
volVectorField B B = fvc::curl(A) and solver knows that here I want to calculate my field and afterwards it creates a nice file with all values. But I can't do this: Code:
volVectorField A Sorry if question seems too trivial, and I hope I explained it better. Yours, Martin |
hello,
The value in createFields, like your "fvc::curl(A)" are only for initialisation, so you can put what you want (should be dimensioned correctly through). So try to provide a "good" initial guess. regards, olivier |
All times are GMT -4. The time now is 19:53. |