On 10/26/2017 06:38 AM, James Martino wrote:
I have a specific request which derives from my work to couple SfePy with SPARRKS (an open source kMC solver by Sandia National Labs). In essence, I would like a way to recreate the "under the hood" steps that occur inside the typical for loop presented in many examples:
for step, time, state in tss(): ....
I have dug into the source code and came up with what I thought were the equivalent lines from sfepy.solvers.ts_solvers --> SimpleTimeSteppingSolver:
totalsteps = 3 for i in range(totalsteps):
#### solving commands state = tss.solve_step(tss.ts, state0) staten1 = state.copy(deep=True) problemInstance.advance(tss.ts)
However, I have found that "state" remains equivalent to "state0", so I know I've missed some crucial bit of understanding here. I have attached a simplified version of my code (a diffusion problem solving an initial gaussian profile over a 1d finite element mesh) that shows my implementation details.
You are not advancing the time-stepper. The problem is in using for i in range(totalsteps):
instead of for i, time in tss.ts.iter_from(0):
or simply: for i, time in tss.ts:
In greater detail, I will briefly describe our convergence strategy between the FE and kMC domains and how it pertains to the SfePy functionality we need. We need to be able to solve for the next FE state from an initial state with a specific boundary condition (essential/natural). The catch is that we also need the ability to choose whether to accept this new state (dependent on our convergence criteria) as the next time step OR if we need to change the applied boundary condition (essential/natural) and resolve from the same initial state. This iterative procedure continues until convergence is attained and that final state is used as the next FE timestep.
This should be doable - you can change/update boundary conditions in many ways. Let me know if you need help with that, but a more complete script might be needed so that I could really see what you want.
Thank you in advance for your time here, and please let me know if I can clarify anything in the above. I know it's an atypical request due to my unique implementation of SfePy.
Looking forward seeing your results/application. :)