Class DifferenceScheme
- java.lang.Object
-
- pulse.util.UpwardsNavigable
-
- pulse.util.Group
-
- pulse.util.Accessible
-
- pulse.util.PropertyHolder
-
- pulse.problem.schemes.DifferenceScheme
-
- All Implemented Interfaces:
Serializable,Descriptive,Reflexive
- Direct Known Subclasses:
ADIScheme,OneDimensionalScheme
public abstract class DifferenceScheme extends PropertyHolder implements Reflexive
ADifferenceSchemeis an abstract class that declares general methods for converting aProblemto a set of algebraic operations on aGrid. TheGridobject defines the time and coordinate partitioning, adjusted to ensure a stable or conditionally-stable behaviour of the solution. TheGridis also used to define aDiscretePulsefunction.- See Also:
Grid,DiscretePulse, Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDifferenceScheme()A constructor which merely sets the time limit to its default value.protectedDifferenceScheme(NumericProperty timeLimit)A constructor for setting the time limit to a pre-set value.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanareDetailsHidden()If true, Lets the UI know that the user only wants to have the most important properties displayed.abstract voidclearArrays()abstract DifferenceSchemecopy()Creates aDifferenceScheme, which is an exact copy of this object.voidcopyFrom(DifferenceScheme df)Copies theGridandtimeLimitfromdf.abstract Class<? extends Problem>[]domain()Retrieves all problem statements that can be solved with this implementation of the difference scheme.abstract voidfinaliseStep()doublegetCurrentPulseValue()DiscretePulsegetDiscretePulse()Gets the discrete representation ofPulseon theGrid.GridgetGrid()Gets theGridobject defining partioning used in thisDifferenceSchemeintgetTimeInterval()The time interval is the number of discrete timesteps that will be discarded when storing the resulting solution into aHeatingCurveobject, thus ensuring that only a limited set of points is stored.NumericPropertygetTimeLimit()The time limit (in whatever units thisDifferenceSchemeuses to process the solution), which serves as the ultimate breakpoint for the calculations.voidinitFrom(DifferenceScheme another)Set<NumericPropertyKeyword>listedKeywords()The superclass only lists theTIME_LIMITproperty.booleannormalOperation()protected voidprepare(Problem problem)Contains preparatory steps to ensure smooth running of the solver.This includes creating aDiscretePulseobject and adjusting the grid of this scheme to match theDiscretePulsecreated for thisproblemFinally, a heating curve is cleared from the previously calculated values.voidprepareStep(int m)Do preparatory calculations that depend only on the time variable, e.g., calculate the pulse power.doublepulse(int m)voidrunTimeSequence(Problem problem)voidrunTimeSequence(Problem problem, double offset, double endTime)voidscaleSolution(Problem problem)voidset(NumericPropertyKeyword type, NumericProperty property)An abstract method, which must be overriden to gain access over setting the values of all relevant (selected by the programmer)NumericProperties in subclasses ofAccessible.static voidsetDetailsHidden(boolean b)Changes the policy of displaying a detailed information about this scheme.voidsetGrid(Grid grid)Sets the grid and adopts it as its child.voidsetTimeInterval(int timeInterval)Sets the time interval to the argument of this method.voidsetTimeLimit(NumericProperty timeLimit)Sets the time limit (in units defined by the correspondingNumericProperty), which serves as the breakpoint for the calculations.abstract doublesignal()abstract voidtimeStep(int m)StringtoString()-
Methods inherited from class pulse.util.PropertyHolder
addListener, data, describe, firePropertyChanged, getDescriptor, getListeners, getPrefix, ignoreSiblings, initListeners, isListedNumericType, isListedParameter, listedTypes, numericData, parameterListChanged, removeListeners, setPrefix, updateProperties, updateProperty
-
Methods inherited from class pulse.util.Accessible
accessibleChildren, genericProperties, genericProperty, numericProperties, numericProperty, property, update, update
-
Methods inherited from class pulse.util.UpwardsNavigable
addHierarchyListener, getHierarchyListeners, getParent, identify, removeHierarchyListener, removeHierarchyListeners, setParent, specificAncestor, tellParent
-
-
-
-
Constructor Detail
-
DifferenceScheme
protected DifferenceScheme()
A constructor which merely sets the time limit to its default value.
-
DifferenceScheme
protected DifferenceScheme(NumericProperty timeLimit)
A constructor for setting the time limit to a pre-set value.- Parameters:
timeLimit- the calculation time limit
-
-
Method Detail
-
initFrom
public void initFrom(DifferenceScheme another)
-
copyFrom
public void copyFrom(DifferenceScheme df)
Copies theGridandtimeLimitfromdf.- Parameters:
df- the DifferenceScheme to copy from
-
prepare
protected void prepare(Problem problem) throws SolverException
Contains preparatory steps to ensure smooth running of the solver.This includes creating a
DiscretePulseobject and adjusting the grid of this scheme to match theDiscretePulsecreated for thisproblemFinally, a heating curve is cleared from the previously calculated values.All subclasses of
DifferenceSchemeshould override and explicitly call this superclass method where appropriate.- Parameters:
problem- the heat problem to be solved- Throws:
SolverException
-
runTimeSequence
public void runTimeSequence(Problem problem) throws SolverException
- Throws:
SolverException
-
scaleSolution
public void scaleSolution(Problem problem)
-
runTimeSequence
public void runTimeSequence(Problem problem, double offset, double endTime) throws SolverException
- Throws:
SolverException
-
pulse
public double pulse(int m)
-
prepareStep
public void prepareStep(int m)
Do preparatory calculations that depend only on the time variable, e.g., calculate the pulse power.- Parameters:
m- the time step number
-
normalOperation
public boolean normalOperation()
-
listedKeywords
public Set<NumericPropertyKeyword> listedKeywords()
The superclass only lists theTIME_LIMITproperty.- Overrides:
listedKeywordsin classPropertyHolder- Returns:
- a set of
NumericPropertyKeywordinstances, which have been explicitly marked as a listed parameter for thisPropertyHolder.
-
getDiscretePulse
public final DiscretePulse getDiscretePulse()
Gets the discrete representation ofPulseon theGrid.- Returns:
- the discrete pulse
- See Also:
Pulse
-
getGrid
public final Grid getGrid()
Gets theGridobject defining partioning used in thisDifferenceScheme- Returns:
- the grid
-
setGrid
public final void setGrid(Grid grid)
Sets the grid and adopts it as its child.- Parameters:
grid- the grid
-
getTimeInterval
public final int getTimeInterval()
The time interval is the number of discrete timesteps that will be discarded when storing the resulting solution into aHeatingCurveobject, thus ensuring that only a limited set of points is stored.- Returns:
- the time interval
-
setTimeInterval
public final void setTimeInterval(int timeInterval)
Sets the time interval to the argument of this method.- Parameters:
timeInterval- a positive integer.
-
areDetailsHidden
public final boolean areDetailsHidden()
If true, Lets the UI know that the user only wants to have the most important properties displayed. Otherwise this will signal all properties need to be displayed.- Overrides:
areDetailsHiddenin classPropertyHolder- Returns:
trueif the auto-adjustable numeric properties need to stay hidden,falseotherwise.
-
setDetailsHidden
public static final void setDetailsHidden(boolean b)
Changes the policy of displaying a detailed information about this scheme.- Parameters:
b- a boolean.
-
getTimeLimit
public final NumericProperty getTimeLimit()
The time limit (in whatever units thisDifferenceSchemeuses to process the solution), which serves as the ultimate breakpoint for the calculations.- Returns:
- the
NumericPropertywith the typeTIME_LIMIT - See Also:
NumericPropertyKeyword
-
getCurrentPulseValue
public double getCurrentPulseValue()
-
setTimeLimit
public final void setTimeLimit(NumericProperty timeLimit)
Sets the time limit (in units defined by the correspondingNumericProperty), which serves as the breakpoint for the calculations.- Parameters:
timeLimit- theNumericPropertywith the typeTIME_LIMIT- See Also:
NumericPropertyKeyword
-
set
public void set(NumericPropertyKeyword type, NumericProperty property)
Description copied from class:AccessibleAn abstract method, which must be overriden to gain access over setting the values of all relevant (selected by the programmer)
NumericProperties in subclasses ofAccessible. Typically this involves aswitchstatement that goes through the different options for thetypeand invokes differentset(...)methods to update the matchingNumericPropertywithproperty.- Specified by:
setin classAccessible- Parameters:
type- the type, which must be equal by definition toproperty.getType().property- the property, which contains new information.
-
signal
public abstract double signal()
-
clearArrays
public abstract void clearArrays()
-
timeStep
public abstract void timeStep(int m) throws SolverException- Throws:
SolverException
-
finaliseStep
public abstract void finaliseStep() throws SolverException- Throws:
SolverException
-
domain
public abstract Class<? extends Problem>[] domain()
Retrieves all problem statements that can be solved with this implementation of the difference scheme.- Returns:
- an array containing subclasses of the
Problemclass which can be used as input for this difference scheme.
-
copy
public abstract DifferenceScheme copy()
Creates aDifferenceScheme, which is an exact copy of this object.- Returns:
- an exact copy of this
DifferenceScheme.
-
-