Skip to content

Update Transient Class to all them to be "rerun"? #2971

@jgostick

Description

@jgostick

I was trying to run a transient algorithm for times 0->1, then update the BCs and run from 1->2, but this soln object was recreated each time, deleting previous progress. It was relatively easy to fix as follows:

if len(self.soln):  # New code
    new_t = np.hstack((self.soln[q].t, soln.t))
    new_y = np.hstack((self.soln[q], soln))
    self.soln[q] = TransientSolution(new_t, new_y)
else:  # Original code
    # Return solution as dictionary
    self.soln = SolutionContainer()
    self.soln[self.settings['quantity']] = soln

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions