User SubroutinesThe following user subroutine defines a species term that varies as a function of coordinate and time: coord = support.getVector('COORD', CenteringType.ELEMENT for (var i = 0; i < this.values.length; i++) { x = coord[i][0]; if (x<0.102 && x>0.098 && timeParameters.time < 10){ this.values[i] = 100.0 ; } else{ this.values[i] = 1.0 ; } } The following user subroutine defines a species term that varies as a function of mass fraction: var massFraction = support.getSpecies("CMF", CenteringType.ELEMENT, "Test_drug"); var scale = -1000; for (var i=0; i<this.values.length; i++){ this.values[i] = scale*massFraction[i]; } |