• Nebyly nalezeny žádné výsledky

Running the code

In document Text práce (31.18Mb) (Stránka 143-147)

C. Heat equation solver

The heat equation solver module can be obtained from a git repository:

git clone https://bitbucket.org/spice-dev/heat.git

C.1 Setup

C.1.1 Requirements

Several libraries, which are provided in the spice-lib package, are required to run the module:

Clock library (timing, performance evaluation),

Umfpack direct solver for solution of the discretized heat equation, and Matio Matlab input/output for reading SPICE files and output.

Location of library files has to be provided in a configuration file located at config/environment.sh. Static linking is preferred. An example of such file is provided in the repository.

Further requirements include a Fortran compiler and SPICE2 output in a form of T and O output files. The minimal required input is included in the repository in testingdirectory.

C.1.2 Compilation

A compilation script compile.sh is provided in the root directory of the reposi-tory. Provided that the libraries were compiled successfully, smooth compilation is expected.

C.2. Running the code

$> ./run.sh

or in PBS managed queue usually present on supercomputers:

$> qsub ./run.sh

Output of the testing run will be placed to testing/out. On a successful run, the log file produced by the program will be terminated with a message:

--- Main model loop complete.

-

---Several output files containing the physical results are produced. Their descrip-tion will be provided in the secdescrip-tion C.3. The calculadescrip-tion time of the specified example is about 15 min, depending on the available computing power.

C.2.1 Executable arguments

The executable can be run with following arguments:

-i path/to/file.hin Location of the input file (.hin) [required].

-o path/to/file.mat Path to the output files in a form of a file prefix. Ex-tensions will be added automatically, all folders in the path have to exist beforehand [required].

-T path/to/file.mat,-O path/to/file.matLocation of SPICE2 output files [required].

-r path/to/file.mat Location of a file with initial temperature distribution, i. e. existing output file [optional].

-s path/to/sf.datScaling function file [optional].

-x Disables heat equation solver [optional].

-S Disables creation of the initial output file [optional].

C.2.2 Input file description

A typical input file for the module is a Fortran namelist divided into four seg-ments. First segment defines the operation field:

$field

gapLength = 0 bulkLength = 0.01 duration = 1 numSteps = 0 saveEvery = 10

stepDuration = 0.001 initTemp = 300

roundingMultiple = 1 boundaryType = 3

$end

Control variables have following meaning:

gapLength Length of the gap between the corner blocks [m].

bulkLength Height of the simulated block [m].

duration Duration of the simulation [s].

numSteps Number of time steps in the simulation. Valid only if duration= 0. saveEvery Number of time steps between temporary file saves.

stepDuration Duration of one time step [m].

initTemp Initial temperature of the tile [K]. Also serves as a background tem-perature for radiative losses.

roundingMultiple Resulting block size in cells can be forced to be a multiple of this value (0: no rounding).

boundaryType Boundary condition selection. See section C.2.2. Permitted values are 1 (fixed flux on the boundary),2 (fixed temperature on the boundary), 3 (fixed temperature at the bottom of the block, fixed flux at block sides).

Boundary condition types

The solver loads the heat flux from SPICE2 output, however, if the bulk block is extended, additional boundary conditions have to be specified. These conditions are applied to the bottom of the block and to its sides. The type of the boundary is chosen by boundaryTypeswitch in the field block.

Fixed flux, boundaryType= 1 Fixes heat flux at all newly created boundaries.

$flux

boundaryFluxRight = 0 % W/m^2 boundaryFluxBottom = 0

boundaryFluxLeft = 0

boundaryPeriodic = .false. % or .true.

boundaryOverwrite = .false. % or .true.

$end

Heat flux at the specified part of the boundary is set to a particular value [W m−2].

C.2. Running the code Fixed temperature, boundaryType= 2 Fixes temperature at all newly cre-ated boundaries.

$temperature

boundaryTempRight = 100 % K boundaryTempBottom = 200 % K boundaryTempLeft = 300 % K

boundaryPeriodic = .false. % or .true.

boundaryOverwrite = .false. % or .true.

$end

Temperature at the specified part of the boundary is set to a particular value [K].

Combined conditions, boundaryType= 3 Fixes temperature or heat flux at newly created boundaries.

$combined

boundaryFluxRight = 0 boundaryTempBottom = 500 boundaryFluxLeft = 0

boundaryPeriodic = .false.

boundaryOverwrite = .false.

$end

Temperature at the bottom boundary is set to a particular value [K]. Heat flux at left and right boundary is set to a particular value [W m−2].

Common boundary variables boundaryPeriodic and boundaryOverwrite apply to all possible boundary types. The former controls the left-right periodicity of the simulation field. If the field should be treated as periodic, left and right boundaries are ignored. The latter controls the treatment of SPICE2 output. In case ofboundaryOverwrite == .true., the values set to left and right boundary in the input file overwrite the ones loaded from SPICE2 output.

Material settings

Next namelist section defines the material of the block.

$material

materialName = ’tungsten’

thermalConductivity = 173 specificHeat = 130

density = 19250 maxT = 3722

$end

materialName The name of the material.

thermalConductivity Thermal conductivity, [W m−1K−1].

specificHeat Specific heat of the material [J kg−1K−1].

density Density of the material [kg m−3].

maxT Melting temperature [K].

SPICE2 file handling

Definition of blocks used as the heat flux source in the heat equation module.

$blocks

blockCount = 1 % or 2

middleObjectIds = (comma separated number list) leftObjectIds = (comma separated number list) rightObjectIds = (comma separated number list) fluxSource = (comma separated number list)

$end

Identifiers in this section are those defined in the SPICE2 T output file (see the array objectsenum), basically according to order of objects in the SPICE input file. Flux source uses SPICE2 particle species numbering (usually 1 for ions, 2 for electrons).

blockCount Number of the blocks to be created from SPICE2 files [required].

leftObjectIds Ids forming a middle block [required, scenario A].

rightObjectIds Ids forming a middle block [required, scenario A].

middleObjectIds Ids forming a middle block [required, scenario B].

fluxSource Particle species identification for heat flux input [required].

The model runs either in scenario A (two block forming corners of the bulk block) or in scenario B (one block atop the bulk). Scenarios are defined in the fig. C.1.

Scenario is selected automatically according to blockCount value (1→ scenario B; 2→ scenario A).

In document Text práce (31.18Mb) (Stránka 143-147)