Merge branch 'development' of git.damask.mpie.de:damask/DAMASK into typehints_orientation_rotation
This commit is contained in:
commit
df54bf724c
2
PRIVATE
2
PRIVATE
|
@ -1 +1 @@
|
||||||
Subproject commit 5598ec4892b0921fccf63e8570f9fcd8e0365716
|
Subproject commit ebb7f0ce78d11275020af0ba60f929f95b446932
|
|
@ -1,178 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
from io import StringIO
|
|
||||||
from optparse import OptionParser
|
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
from scipy import ndimage
|
|
||||||
|
|
||||||
import damask
|
|
||||||
|
|
||||||
|
|
||||||
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
|
||||||
scriptID = ' '.join([scriptName,damask.version])
|
|
||||||
|
|
||||||
|
|
||||||
getInterfaceEnergy = lambda A,B: np.float32((A != B)*1.0) # 1.0 if A & B are distinct, 0.0 otherwise
|
|
||||||
struc = ndimage.generate_binary_structure(3,1) # 3D von Neumann neighborhood
|
|
||||||
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------------------------------------
|
|
||||||
# MAIN
|
|
||||||
#--------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
parser = OptionParser(option_class=damask.extendableOption, usage='%prog option(s) [geomfile(s)]', description = """
|
|
||||||
Smoothen interface roughness by simulated curvature flow.
|
|
||||||
This is achieved by the diffusion of each initially sharply bounded grain volume within the periodic domain
|
|
||||||
up to a given distance 'd' voxels.
|
|
||||||
The final geometry is assembled by selecting at each voxel that grain index for which the concentration remains largest.
|
|
||||||
References 10.1073/pnas.1111557108 (10.1006/jcph.1994.1105)
|
|
||||||
|
|
||||||
""", version = scriptID)
|
|
||||||
|
|
||||||
parser.add_option('-d', '--distance',
|
|
||||||
dest = 'd',
|
|
||||||
type = 'float', metavar = 'float',
|
|
||||||
help = 'diffusion distance in voxels [%default]')
|
|
||||||
parser.add_option('-N', '--iterations',
|
|
||||||
dest = 'N',
|
|
||||||
type = 'int', metavar = 'int',
|
|
||||||
help = 'curvature flow iterations [%default]')
|
|
||||||
parser.add_option('-i', '--immutable',
|
|
||||||
action = 'extend', dest = 'immutable', metavar = '<int LIST>',
|
|
||||||
help = 'list of immutable material indices')
|
|
||||||
parser.add_option('--ndimage',
|
|
||||||
dest = 'ndimage', action='store_true',
|
|
||||||
help = 'use ndimage.gaussian_filter in lieu of explicit FFT')
|
|
||||||
|
|
||||||
parser.set_defaults(d = 1,
|
|
||||||
N = 1,
|
|
||||||
immutable = [],
|
|
||||||
ndimage = False,
|
|
||||||
)
|
|
||||||
|
|
||||||
(options, filenames) = parser.parse_args()
|
|
||||||
|
|
||||||
options.immutable = list(map(int,options.immutable))
|
|
||||||
|
|
||||||
|
|
||||||
if filenames == []: filenames = [None]
|
|
||||||
|
|
||||||
for name in filenames:
|
|
||||||
damask.util.report(scriptName,name)
|
|
||||||
|
|
||||||
geom = damask.Grid.load(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
|
||||||
|
|
||||||
grid_original = geom.cells
|
|
||||||
damask.util.croak(geom)
|
|
||||||
material = np.tile(geom.material,np.where(grid_original == 1, 2,1)) # make one copy along dimensions with grid == 1
|
|
||||||
grid = np.array(material.shape)
|
|
||||||
|
|
||||||
# --- initialize support data ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
# store a copy of the initial material indices to find locations of immutable indices
|
|
||||||
material_original = np.copy(material)
|
|
||||||
|
|
||||||
if not options.ndimage:
|
|
||||||
X,Y,Z = np.mgrid[0:grid[0],0:grid[1],0:grid[2]]
|
|
||||||
|
|
||||||
# Calculates gaussian weights for simulating 3d diffusion
|
|
||||||
gauss = np.exp(-(X*X + Y*Y + Z*Z)/(2.0*options.d*options.d),dtype=np.float32) \
|
|
||||||
/np.power(2.0*np.pi*options.d*options.d,(3.0 - np.count_nonzero(grid_original == 1))/2.,dtype=np.float32)
|
|
||||||
|
|
||||||
gauss[:,:,:grid[2]//2:-1] = gauss[:,:,1:(grid[2]+1)//2] # trying to cope with uneven (odd) grid size
|
|
||||||
gauss[:,:grid[1]//2:-1,:] = gauss[:,1:(grid[1]+1)//2,:]
|
|
||||||
gauss[:grid[0]//2:-1,:,:] = gauss[1:(grid[0]+1)//2,:,:]
|
|
||||||
gauss = np.fft.rfftn(gauss).astype(np.complex64)
|
|
||||||
|
|
||||||
for smoothIter in range(options.N):
|
|
||||||
|
|
||||||
interfaceEnergy = np.zeros(material.shape,dtype=np.float32)
|
|
||||||
for i in (-1,0,1):
|
|
||||||
for j in (-1,0,1):
|
|
||||||
for k in (-1,0,1):
|
|
||||||
# assign interfacial energy to all voxels that have a differing neighbor (in Moore neighborhood)
|
|
||||||
interfaceEnergy = np.maximum(interfaceEnergy,
|
|
||||||
getInterfaceEnergy(material,np.roll(np.roll(np.roll(
|
|
||||||
material,i,axis=0), j,axis=1), k,axis=2)))
|
|
||||||
|
|
||||||
# periodically extend interfacial energy array by half a grid size in positive and negative directions
|
|
||||||
periodic_interfaceEnergy = np.tile(interfaceEnergy,(3,3,3))[grid[0]//2:-grid[0]//2,
|
|
||||||
grid[1]//2:-grid[1]//2,
|
|
||||||
grid[2]//2:-grid[2]//2]
|
|
||||||
|
|
||||||
# transform bulk volume (i.e. where interfacial energy remained zero), store index of closest boundary voxel
|
|
||||||
index = ndimage.morphology.distance_transform_edt(periodic_interfaceEnergy == 0.,
|
|
||||||
return_distances = False,
|
|
||||||
return_indices = True)
|
|
||||||
|
|
||||||
# want array index of nearest voxel on periodically extended boundary
|
|
||||||
periodic_bulkEnergy = periodic_interfaceEnergy[index[0],
|
|
||||||
index[1],
|
|
||||||
index[2]].reshape(2*grid) # fill bulk with energy of nearest interface
|
|
||||||
|
|
||||||
if options.ndimage:
|
|
||||||
periodic_diffusedEnergy = ndimage.gaussian_filter(
|
|
||||||
np.where(ndimage.morphology.binary_dilation(periodic_interfaceEnergy > 0.,
|
|
||||||
structure = struc,
|
|
||||||
iterations = int(round(options.d*2.))-1, # fat boundary
|
|
||||||
),
|
|
||||||
periodic_bulkEnergy, # ...and zero everywhere else
|
|
||||||
0.),
|
|
||||||
sigma = options.d)
|
|
||||||
else:
|
|
||||||
diffusedEnergy = np.fft.irfftn(np.fft.rfftn(
|
|
||||||
np.where(
|
|
||||||
ndimage.morphology.binary_dilation(interfaceEnergy > 0.,
|
|
||||||
structure = struc,
|
|
||||||
iterations = int(round(options.d*2.))-1),# fat boundary
|
|
||||||
periodic_bulkEnergy[grid[0]//2:-grid[0]//2, # retain filled energy on fat boundary...
|
|
||||||
grid[1]//2:-grid[1]//2,
|
|
||||||
grid[2]//2:-grid[2]//2], # ...and zero everywhere else
|
|
||||||
0.)).astype(np.complex64) *
|
|
||||||
gauss).astype(np.float32)
|
|
||||||
|
|
||||||
periodic_diffusedEnergy = np.tile(diffusedEnergy,(3,3,3))[grid[0]//2:-grid[0]//2,
|
|
||||||
grid[1]//2:-grid[1]//2,
|
|
||||||
grid[2]//2:-grid[2]//2] # periodically extend the smoothed bulk energy
|
|
||||||
|
|
||||||
|
|
||||||
# transform voxels close to interface region
|
|
||||||
index = ndimage.morphology.distance_transform_edt(periodic_diffusedEnergy >= 0.95*np.amax(periodic_diffusedEnergy),
|
|
||||||
return_distances = False,
|
|
||||||
return_indices = True) # want index of closest bulk grain
|
|
||||||
|
|
||||||
periodic_material = np.tile(material,(3,3,3))[grid[0]//2:-grid[0]//2,
|
|
||||||
grid[1]//2:-grid[1]//2,
|
|
||||||
grid[2]//2:-grid[2]//2] # periodically extend the geometry
|
|
||||||
|
|
||||||
material = periodic_material[index[0],
|
|
||||||
index[1],
|
|
||||||
index[2]].reshape(2*grid)[grid[0]//2:-grid[0]//2,
|
|
||||||
grid[1]//2:-grid[1]//2,
|
|
||||||
grid[2]//2:-grid[2]//2] # extent grains into interface region
|
|
||||||
|
|
||||||
# replace immutable materials with closest mutable ones
|
|
||||||
index = ndimage.morphology.distance_transform_edt(np.in1d(material,options.immutable).reshape(grid),
|
|
||||||
return_distances = False,
|
|
||||||
return_indices = True)
|
|
||||||
material = material[index[0],
|
|
||||||
index[1],
|
|
||||||
index[2]]
|
|
||||||
|
|
||||||
immutable = np.zeros(material.shape, dtype=np.bool)
|
|
||||||
# find locations where immutable materials have been in original structure
|
|
||||||
for micro in options.immutable:
|
|
||||||
immutable += material_original == micro
|
|
||||||
|
|
||||||
# undo any changes involving immutable materials
|
|
||||||
material = np.where(immutable, material_original,material)
|
|
||||||
|
|
||||||
damask.Grid(material = material[0:grid_original[0],0:grid_original[1],0:grid_original[2]],
|
|
||||||
size = geom.size,
|
|
||||||
origin = geom.origin,
|
|
||||||
comments = geom.comments + [scriptID + ' ' + ' '.join(sys.argv[1:])],
|
|
||||||
)\
|
|
||||||
.save(sys.stdout if name is None else name)
|
|
|
@ -1 +1 @@
|
||||||
v3.0.0-alpha5-545-gad74f5dbe
|
v3.0.0-alpha5-556-g97f849c09
|
||||||
|
|
|
@ -5,7 +5,7 @@ import os
|
||||||
import copy
|
import copy
|
||||||
import datetime
|
import datetime
|
||||||
import warnings
|
import warnings
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET # noqa
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
|
@ -9,3 +9,6 @@ import numpy as np
|
||||||
FloatSequence = Union[np.ndarray,Sequence[float]]
|
FloatSequence = Union[np.ndarray,Sequence[float]]
|
||||||
IntSequence = Union[np.ndarray,Sequence[int]]
|
IntSequence = Union[np.ndarray,Sequence[int]]
|
||||||
FileHandle = Union[TextIO, str, Path]
|
FileHandle = Union[TextIO, str, Path]
|
||||||
|
NumpyRngSeed = Union[int, IntSequence, np.random.SeedSequence, np.random.Generator]
|
||||||
|
# BitGenerator does not exists in older numpy versions
|
||||||
|
#NumpyRngSeed = Union[int, IntSequence, np.random.SeedSequence, np.random.BitGenerator, np.random.Generator]
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
"""Functionality for generation of seed points for Voronoi or Laguerre tessellation."""
|
"""Functionality for generation of seed points for Voronoi or Laguerre tessellation."""
|
||||||
|
|
||||||
from typing import Tuple as _Tuple
|
from typing import Tuple as _Tuple
|
||||||
|
@ -5,7 +6,7 @@ from typing import Tuple as _Tuple
|
||||||
from scipy import spatial as _spatial
|
from scipy import spatial as _spatial
|
||||||
import numpy as _np
|
import numpy as _np
|
||||||
|
|
||||||
from ._typehints import FloatSequence as _FloatSequence, IntSequence as _IntSequence
|
from ._typehints import FloatSequence as _FloatSequence, IntSequence as _IntSequence, NumpyRngSeed as _NumpyRngSeed
|
||||||
from . import util as _util
|
from . import util as _util
|
||||||
from . import grid_filters as _grid_filters
|
from . import grid_filters as _grid_filters
|
||||||
|
|
||||||
|
@ -13,7 +14,7 @@ from . import grid_filters as _grid_filters
|
||||||
def from_random(size: _FloatSequence,
|
def from_random(size: _FloatSequence,
|
||||||
N_seeds: int,
|
N_seeds: int,
|
||||||
cells: _IntSequence = None,
|
cells: _IntSequence = None,
|
||||||
rng_seed=None) -> _np.ndarray:
|
rng_seed: _NumpyRngSeed = None) -> _np.ndarray:
|
||||||
"""
|
"""
|
||||||
Place seeds randomly in space.
|
Place seeds randomly in space.
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ def from_Poisson_disc(size: _FloatSequence,
|
||||||
N_candidates: int,
|
N_candidates: int,
|
||||||
distance: float,
|
distance: float,
|
||||||
periodic: bool = True,
|
periodic: bool = True,
|
||||||
rng_seed=None) -> _np.ndarray:
|
rng_seed: _NumpyRngSeed = None) -> _np.ndarray:
|
||||||
"""
|
"""
|
||||||
Place seeds according to a Poisson disc distribution.
|
Place seeds according to a Poisson disc distribution.
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ import numpy as np
|
||||||
import h5py
|
import h5py
|
||||||
|
|
||||||
from . import version
|
from . import version
|
||||||
from ._typehints import IntSequence, FloatSequence
|
from ._typehints import FloatSequence, NumpyRngSeed
|
||||||
|
|
||||||
# limit visibility
|
# limit visibility
|
||||||
__all__=[
|
__all__=[
|
||||||
|
@ -396,7 +396,7 @@ def execution_stamp(class_name: str,
|
||||||
|
|
||||||
def hybrid_IA(dist: np.ndarray,
|
def hybrid_IA(dist: np.ndarray,
|
||||||
N: int,
|
N: int,
|
||||||
rng_seed: Union[int, IntSequence] = None) -> np.ndarray:
|
rng_seed: NumpyRngSeed = None) -> np.ndarray:
|
||||||
"""
|
"""
|
||||||
Hybrid integer approximation.
|
Hybrid integer approximation.
|
||||||
|
|
||||||
|
|
|
@ -8,19 +8,19 @@ from damask import seeds
|
||||||
class TestGridFilters:
|
class TestGridFilters:
|
||||||
|
|
||||||
def test_coordinates0_point(self):
|
def test_coordinates0_point(self):
|
||||||
size = np.random.random(3)
|
size = np.random.random(3) # noqa
|
||||||
cells = np.random.randint(8,32,(3))
|
cells = np.random.randint(8,32,(3))
|
||||||
coord = grid_filters.coordinates0_point(cells,size)
|
coord = grid_filters.coordinates0_point(cells,size)
|
||||||
assert np.allclose(coord[0,0,0],size/cells*.5) and coord.shape == tuple(cells) + (3,)
|
assert np.allclose(coord[0,0,0],size/cells*.5) and coord.shape == tuple(cells) + (3,)
|
||||||
|
|
||||||
def test_coordinates0_node(self):
|
def test_coordinates0_node(self):
|
||||||
size = np.random.random(3)
|
size = np.random.random(3) # noqa
|
||||||
cells = np.random.randint(8,32,(3))
|
cells = np.random.randint(8,32,(3))
|
||||||
coord = grid_filters.coordinates0_node(cells,size)
|
coord = grid_filters.coordinates0_node(cells,size)
|
||||||
assert np.allclose(coord[-1,-1,-1],size) and coord.shape == tuple(cells+1) + (3,)
|
assert np.allclose(coord[-1,-1,-1],size) and coord.shape == tuple(cells+1) + (3,)
|
||||||
|
|
||||||
def test_coord0(self):
|
def test_coord0(self):
|
||||||
size = np.random.random(3)
|
size = np.random.random(3) # noqa
|
||||||
cells = np.random.randint(8,32,(3))
|
cells = np.random.randint(8,32,(3))
|
||||||
c = grid_filters.coordinates0_point(cells+1,size+size/cells)
|
c = grid_filters.coordinates0_point(cells+1,size+size/cells)
|
||||||
n = grid_filters.coordinates0_node(cells,size) + size/cells*.5
|
n = grid_filters.coordinates0_node(cells,size) + size/cells*.5
|
||||||
|
@ -28,7 +28,7 @@ class TestGridFilters:
|
||||||
|
|
||||||
@pytest.mark.parametrize('mode',['point','node'])
|
@pytest.mark.parametrize('mode',['point','node'])
|
||||||
def test_grid_DNA(self,mode):
|
def test_grid_DNA(self,mode):
|
||||||
"""Ensure that cellsSizeOrigin_coordinates0_xx is the inverse of coordinates0_xx."""
|
"""Ensure that cellsSizeOrigin_coordinates0_xx is the inverse of coordinates0_xx.""" # noqa
|
||||||
cells = np.random.randint(8,32,(3))
|
cells = np.random.randint(8,32,(3))
|
||||||
size = np.random.random(3)
|
size = np.random.random(3)
|
||||||
origin = np.random.random(3)
|
origin = np.random.random(3)
|
||||||
|
@ -37,7 +37,7 @@ class TestGridFilters:
|
||||||
assert np.allclose(cells,_cells) and np.allclose(size,_size) and np.allclose(origin,_origin)
|
assert np.allclose(cells,_cells) and np.allclose(size,_size) and np.allclose(origin,_origin)
|
||||||
|
|
||||||
def test_displacement_fluct_equivalence(self):
|
def test_displacement_fluct_equivalence(self):
|
||||||
"""Ensure that fluctuations are periodic."""
|
"""Ensure that fluctuations are periodic.""" # noqa
|
||||||
size = np.random.random(3)
|
size = np.random.random(3)
|
||||||
cells = np.random.randint(8,32,(3))
|
cells = np.random.randint(8,32,(3))
|
||||||
F = np.random.random(tuple(cells)+(3,3))
|
F = np.random.random(tuple(cells)+(3,3))
|
||||||
|
@ -45,14 +45,14 @@ class TestGridFilters:
|
||||||
grid_filters.point_to_node(grid_filters.displacement_fluct_point(size,F)))
|
grid_filters.point_to_node(grid_filters.displacement_fluct_point(size,F)))
|
||||||
|
|
||||||
def test_interpolation_to_node(self):
|
def test_interpolation_to_node(self):
|
||||||
size = np.random.random(3)
|
size = np.random.random(3) # noqa
|
||||||
cells = np.random.randint(8,32,(3))
|
cells = np.random.randint(8,32,(3))
|
||||||
F = np.random.random(tuple(cells)+(3,3))
|
F = np.random.random(tuple(cells)+(3,3))
|
||||||
assert np.allclose(grid_filters.coordinates_node(size,F) [1:-1,1:-1,1:-1],
|
assert np.allclose(grid_filters.coordinates_node(size,F) [1:-1,1:-1,1:-1],
|
||||||
grid_filters.point_to_node(grid_filters.coordinates_point(size,F))[1:-1,1:-1,1:-1])
|
grid_filters.point_to_node(grid_filters.coordinates_point(size,F))[1:-1,1:-1,1:-1])
|
||||||
|
|
||||||
def test_interpolation_to_cell(self):
|
def test_interpolation_to_cell(self):
|
||||||
cells = np.random.randint(1,30,(3))
|
cells = np.random.randint(1,30,(3)) # noqa
|
||||||
|
|
||||||
coordinates_node_x = np.linspace(0,np.pi*2,num=cells[0]+1)
|
coordinates_node_x = np.linspace(0,np.pi*2,num=cells[0]+1)
|
||||||
node_field_x = np.cos(coordinates_node_x)
|
node_field_x = np.cos(coordinates_node_x)
|
||||||
|
@ -66,7 +66,7 @@ class TestGridFilters:
|
||||||
|
|
||||||
@pytest.mark.parametrize('mode',['point','node'])
|
@pytest.mark.parametrize('mode',['point','node'])
|
||||||
def test_coordinates0_origin(self,mode):
|
def test_coordinates0_origin(self,mode):
|
||||||
origin= np.random.random(3)
|
origin= np.random.random(3) # noqa
|
||||||
size = np.random.random(3) # noqa
|
size = np.random.random(3) # noqa
|
||||||
cells = np.random.randint(8,32,(3))
|
cells = np.random.randint(8,32,(3))
|
||||||
shifted = eval(f'grid_filters.coordinates0_{mode}(cells,size,origin)')
|
shifted = eval(f'grid_filters.coordinates0_{mode}(cells,size,origin)')
|
||||||
|
@ -79,7 +79,7 @@ class TestGridFilters:
|
||||||
@pytest.mark.parametrize('function',[grid_filters.displacement_avg_point,
|
@pytest.mark.parametrize('function',[grid_filters.displacement_avg_point,
|
||||||
grid_filters.displacement_avg_node])
|
grid_filters.displacement_avg_node])
|
||||||
def test_displacement_avg_vanishes(self,function):
|
def test_displacement_avg_vanishes(self,function):
|
||||||
"""Ensure that random fluctuations in F do not result in average displacement."""
|
"""Ensure that random fluctuations in F do not result in average displacement.""" # noqa
|
||||||
size = np.random.random(3)
|
size = np.random.random(3)
|
||||||
cells = np.random.randint(8,32,(3))
|
cells = np.random.randint(8,32,(3))
|
||||||
F = np.random.random(tuple(cells)+(3,3))
|
F = np.random.random(tuple(cells)+(3,3))
|
||||||
|
@ -89,7 +89,7 @@ class TestGridFilters:
|
||||||
@pytest.mark.parametrize('function',[grid_filters.displacement_fluct_point,
|
@pytest.mark.parametrize('function',[grid_filters.displacement_fluct_point,
|
||||||
grid_filters.displacement_fluct_node])
|
grid_filters.displacement_fluct_node])
|
||||||
def test_displacement_fluct_vanishes(self,function):
|
def test_displacement_fluct_vanishes(self,function):
|
||||||
"""Ensure that constant F does not result in fluctuating displacement."""
|
"""Ensure that constant F does not result in fluctuating displacement.""" # noqa
|
||||||
size = np.random.random(3)
|
size = np.random.random(3)
|
||||||
cells = np.random.randint(8,32,(3))
|
cells = np.random.randint(8,32,(3))
|
||||||
F = np.broadcast_to(np.random.random((3,3)), tuple(cells)+(3,3))
|
F = np.broadcast_to(np.random.random((3,3)), tuple(cells)+(3,3))
|
||||||
|
@ -142,13 +142,13 @@ class TestGridFilters:
|
||||||
function(unordered,mode)
|
function(unordered,mode)
|
||||||
|
|
||||||
def test_regrid_identity(self):
|
def test_regrid_identity(self):
|
||||||
size = np.random.random(3)
|
size = np.random.random(3) # noqa
|
||||||
cells = np.random.randint(8,32,(3))
|
cells = np.random.randint(8,32,(3))
|
||||||
F = np.broadcast_to(np.eye(3), tuple(cells)+(3,3))
|
F = np.broadcast_to(np.eye(3), tuple(cells)+(3,3))
|
||||||
assert all(grid_filters.regrid(size,F,cells) == np.arange(cells.prod()))
|
assert all(grid_filters.regrid(size,F,cells) == np.arange(cells.prod()))
|
||||||
|
|
||||||
def test_regrid_double_cells(self):
|
def test_regrid_double_cells(self):
|
||||||
size = np.random.random(3)
|
size = np.random.random(3) # noqa
|
||||||
cells = np.random.randint(8,32,(3))
|
cells = np.random.randint(8,32,(3))
|
||||||
g = Grid.from_Voronoi_tessellation(cells,size,seeds.from_random(size,10))
|
g = Grid.from_Voronoi_tessellation(cells,size,seeds.from_random(size,10))
|
||||||
F = np.broadcast_to(np.eye(3), tuple(cells)+(3,3))
|
F = np.broadcast_to(np.eye(3), tuple(cells)+(3,3))
|
||||||
|
|
|
@ -466,7 +466,14 @@ program DAMASK_grid
|
||||||
call MPI_Allreduce(interface_SIGUSR2,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI)
|
call MPI_Allreduce(interface_SIGUSR2,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI)
|
||||||
if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error'
|
if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error'
|
||||||
if (mod(inc,loadCases(l)%f_restart) == 0 .or. signal) then
|
if (mod(inc,loadCases(l)%f_restart) == 0 .or. signal) then
|
||||||
|
do field = 1, nActiveFields
|
||||||
|
select case (ID(field))
|
||||||
|
case(FIELD_MECH_ID)
|
||||||
call mechanical_restartWrite
|
call mechanical_restartWrite
|
||||||
|
case(FIELD_THERMAL_ID)
|
||||||
|
call grid_thermal_spectral_restartWrite
|
||||||
|
end select
|
||||||
|
end do
|
||||||
call CPFEM_restartWrite
|
call CPFEM_restartWrite
|
||||||
endif
|
endif
|
||||||
if (signal) call interface_setSIGUSR2(.false.)
|
if (signal) call interface_setSIGUSR2(.false.)
|
||||||
|
|
|
@ -16,6 +16,9 @@ module grid_thermal_spectral
|
||||||
use prec
|
use prec
|
||||||
use parallelization
|
use parallelization
|
||||||
use IO
|
use IO
|
||||||
|
use DAMASK_interface
|
||||||
|
use HDF5_utilities
|
||||||
|
use HDF5
|
||||||
use spectral_utilities
|
use spectral_utilities
|
||||||
use discretization_grid
|
use discretization_grid
|
||||||
use homogenization
|
use homogenization
|
||||||
|
@ -54,13 +57,13 @@ module grid_thermal_spectral
|
||||||
public :: &
|
public :: &
|
||||||
grid_thermal_spectral_init, &
|
grid_thermal_spectral_init, &
|
||||||
grid_thermal_spectral_solution, &
|
grid_thermal_spectral_solution, &
|
||||||
|
grid_thermal_spectral_restartWrite, &
|
||||||
grid_thermal_spectral_forward
|
grid_thermal_spectral_forward
|
||||||
|
|
||||||
contains
|
contains
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief allocates all neccessary fields and fills them with data
|
!> @brief allocates all neccessary fields and fills them with data
|
||||||
! ToDo: Restart not implemented
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine grid_thermal_spectral_init(T_0)
|
subroutine grid_thermal_spectral_init(T_0)
|
||||||
|
|
||||||
|
@ -72,6 +75,7 @@ subroutine grid_thermal_spectral_init(T_0)
|
||||||
PetscScalar, dimension(:,:,:), pointer :: T_PETSc
|
PetscScalar, dimension(:,:,:), pointer :: T_PETSc
|
||||||
integer(MPI_INTEGER_KIND) :: err_MPI
|
integer(MPI_INTEGER_KIND) :: err_MPI
|
||||||
PetscErrorCode :: err_PETSc
|
PetscErrorCode :: err_PETSc
|
||||||
|
integer(HID_T) :: fileHandle, groupHandle
|
||||||
class(tNode), pointer :: &
|
class(tNode), pointer :: &
|
||||||
num_grid
|
num_grid
|
||||||
|
|
||||||
|
@ -105,12 +109,6 @@ subroutine grid_thermal_spectral_init(T_0)
|
||||||
allocate(T_lastInc(grid(1),grid(2),grid3), source=T_0)
|
allocate(T_lastInc(grid(1),grid(2),grid3), source=T_0)
|
||||||
allocate(T_stagInc(grid(1),grid(2),grid3), source=T_0)
|
allocate(T_stagInc(grid(1),grid(2),grid3), source=T_0)
|
||||||
|
|
||||||
ce = 0
|
|
||||||
do k = 1, grid3; do j = 1, grid(2); do i = 1,grid(1)
|
|
||||||
ce = ce + 1
|
|
||||||
call homogenization_thermal_setField(T_0,0.0_pReal,ce)
|
|
||||||
end do; end do; end do
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! initialize solver specific parts of PETSc
|
! initialize solver specific parts of PETSc
|
||||||
call SNESCreate(PETSC_COMM_WORLD,SNES_thermal,err_PETSc)
|
call SNESCreate(PETSC_COMM_WORLD,SNES_thermal,err_PETSc)
|
||||||
|
@ -142,13 +140,31 @@ subroutine grid_thermal_spectral_init(T_0)
|
||||||
CHKERRQ(err_PETSc)
|
CHKERRQ(err_PETSc)
|
||||||
call SNESSetFromOptions(SNES_thermal,err_PETSc) ! pull it all together with additional CLI arguments
|
call SNESSetFromOptions(SNES_thermal,err_PETSc) ! pull it all together with additional CLI arguments
|
||||||
CHKERRQ(err_PETSc)
|
CHKERRQ(err_PETSc)
|
||||||
|
|
||||||
|
|
||||||
|
restartRead: if (interface_restartInc > 0) then
|
||||||
|
print'(/,1x,a,i0,a)', 'reading restart data of increment ', interface_restartInc, ' from file'
|
||||||
|
|
||||||
|
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','r')
|
||||||
|
groupHandle = HDF5_openGroup(fileHandle,'solver')
|
||||||
|
|
||||||
|
call HDF5_read(T_current,groupHandle,'T',.false.)
|
||||||
|
call HDF5_read(T_lastInc,groupHandle,'T_lastInc',.false.)
|
||||||
|
end if restartRead
|
||||||
|
|
||||||
|
ce = 0
|
||||||
|
do k = 1, grid3; do j = 1, grid(2); do i = 1, grid(1)
|
||||||
|
ce = ce + 1
|
||||||
|
call homogenization_thermal_setField(T_current(i,j,k),0.0_pReal,ce)
|
||||||
|
end do; end do; end do
|
||||||
|
|
||||||
call DMDAVecGetArrayF90(thermal_grid,solution_vec,T_PETSc,err_PETSc)
|
call DMDAVecGetArrayF90(thermal_grid,solution_vec,T_PETSc,err_PETSc)
|
||||||
CHKERRQ(err_PETSc)
|
CHKERRQ(err_PETSc)
|
||||||
T_PETSc = T_current
|
T_PETSc = T_current
|
||||||
call DMDAVecRestoreArrayF90(thermal_grid,solution_vec,T_PETSc,err_PETSc)
|
call DMDAVecRestoreArrayF90(thermal_grid,solution_vec,T_PETSc,err_PETSc)
|
||||||
CHKERRQ(err_PETSc)
|
CHKERRQ(err_PETSc)
|
||||||
|
|
||||||
call updateReference()
|
call updateReference
|
||||||
|
|
||||||
end subroutine grid_thermal_spectral_init
|
end subroutine grid_thermal_spectral_init
|
||||||
|
|
||||||
|
@ -253,6 +269,37 @@ subroutine grid_thermal_spectral_forward(cutBack)
|
||||||
end subroutine grid_thermal_spectral_forward
|
end subroutine grid_thermal_spectral_forward
|
||||||
|
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
!> @brief Write current solver and constitutive data for restart to file
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
subroutine grid_thermal_spectral_restartWrite
|
||||||
|
|
||||||
|
PetscErrorCode :: err_PETSc
|
||||||
|
DM :: dm_local
|
||||||
|
integer(HID_T) :: fileHandle, groupHandle
|
||||||
|
PetscScalar, dimension(:,:,:), pointer :: T
|
||||||
|
|
||||||
|
call SNESGetDM(SNES_thermal,dm_local,err_PETSc);
|
||||||
|
CHKERRQ(err_PETSc)
|
||||||
|
call DMDAVecGetArrayF90(dm_local,solution_vec,T,err_PETSc);
|
||||||
|
CHKERRQ(err_PETSc)
|
||||||
|
|
||||||
|
print'(1x,a)', 'writing thermal solver data required for restart to file'; flush(IO_STDOUT)
|
||||||
|
|
||||||
|
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','a')
|
||||||
|
groupHandle = HDF5_openGroup(fileHandle,'solver')
|
||||||
|
call HDF5_write(T,groupHandle,'T')
|
||||||
|
call HDF5_write(T_lastInc,groupHandle,'T_lastInc')
|
||||||
|
call HDF5_closeGroup(groupHandle)
|
||||||
|
call HDF5_closeFile(fileHandle)
|
||||||
|
|
||||||
|
call DMDAVecRestoreArrayF90(dm_local,solution_vec,T,err_PETSc);
|
||||||
|
CHKERRQ(err_PETSc)
|
||||||
|
|
||||||
|
end subroutine grid_thermal_spectral_restartWrite
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief forms the spectral thermal residual vector
|
!> @brief forms the spectral thermal residual vector
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -414,7 +414,7 @@ subroutine homogenization_restartWrite(fileHandle)
|
||||||
|
|
||||||
groupHandle(2) = HDF5_addGroup(groupHandle(1),material_name_homogenization(ho))
|
groupHandle(2) = HDF5_addGroup(groupHandle(1),material_name_homogenization(ho))
|
||||||
|
|
||||||
call HDF5_write(homogState(ho)%state,groupHandle(2),'omega') ! ToDo: should be done by mech
|
call HDF5_write(homogState(ho)%state,groupHandle(2),'omega_mechanical') ! ToDo: should be done by mech
|
||||||
|
|
||||||
call HDF5_closeGroup(groupHandle(2))
|
call HDF5_closeGroup(groupHandle(2))
|
||||||
|
|
||||||
|
@ -441,7 +441,7 @@ subroutine homogenization_restartRead(fileHandle)
|
||||||
|
|
||||||
groupHandle(2) = HDF5_openGroup(groupHandle(1),material_name_homogenization(ho))
|
groupHandle(2) = HDF5_openGroup(groupHandle(1),material_name_homogenization(ho))
|
||||||
|
|
||||||
call HDF5_read(homogState(ho)%state0,groupHandle(2),'omega') ! ToDo: should be done by mech
|
call HDF5_read(homogState(ho)%state0,groupHandle(2),'omega_mechanical') ! ToDo: should be done by mech
|
||||||
|
|
||||||
call HDF5_closeGroup(groupHandle(2))
|
call HDF5_closeGroup(groupHandle(2))
|
||||||
|
|
||||||
|
|
|
@ -124,11 +124,20 @@ module phase
|
||||||
integer, intent(in) :: ph
|
integer, intent(in) :: ph
|
||||||
end subroutine mechanical_restartWrite
|
end subroutine mechanical_restartWrite
|
||||||
|
|
||||||
|
module subroutine thermal_restartWrite(groupHandle,ph)
|
||||||
|
integer(HID_T), intent(in) :: groupHandle
|
||||||
|
integer, intent(in) :: ph
|
||||||
|
end subroutine thermal_restartWrite
|
||||||
|
|
||||||
module subroutine mechanical_restartRead(groupHandle,ph)
|
module subroutine mechanical_restartRead(groupHandle,ph)
|
||||||
integer(HID_T), intent(in) :: groupHandle
|
integer(HID_T), intent(in) :: groupHandle
|
||||||
integer, intent(in) :: ph
|
integer, intent(in) :: ph
|
||||||
end subroutine mechanical_restartRead
|
end subroutine mechanical_restartRead
|
||||||
|
|
||||||
|
module subroutine thermal_restartRead(groupHandle,ph)
|
||||||
|
integer(HID_T), intent(in) :: groupHandle
|
||||||
|
integer, intent(in) :: ph
|
||||||
|
end subroutine thermal_restartRead
|
||||||
|
|
||||||
module function mechanical_S(ph,en) result(S)
|
module function mechanical_S(ph,en) result(S)
|
||||||
integer, intent(in) :: ph,en
|
integer, intent(in) :: ph,en
|
||||||
|
@ -641,6 +650,7 @@ subroutine phase_restartWrite(fileHandle)
|
||||||
groupHandle(2) = HDF5_addGroup(groupHandle(1),material_name_phase(ph))
|
groupHandle(2) = HDF5_addGroup(groupHandle(1),material_name_phase(ph))
|
||||||
|
|
||||||
call mechanical_restartWrite(groupHandle(2),ph)
|
call mechanical_restartWrite(groupHandle(2),ph)
|
||||||
|
call thermal_restartWrite(groupHandle(2),ph)
|
||||||
|
|
||||||
call HDF5_closeGroup(groupHandle(2))
|
call HDF5_closeGroup(groupHandle(2))
|
||||||
|
|
||||||
|
@ -669,6 +679,7 @@ subroutine phase_restartRead(fileHandle)
|
||||||
groupHandle(2) = HDF5_openGroup(groupHandle(1),material_name_phase(ph))
|
groupHandle(2) = HDF5_openGroup(groupHandle(1),material_name_phase(ph))
|
||||||
|
|
||||||
call mechanical_restartRead(groupHandle(2),ph)
|
call mechanical_restartRead(groupHandle(2),ph)
|
||||||
|
call thermal_restartRead(groupHandle(2),ph)
|
||||||
|
|
||||||
call HDF5_closeGroup(groupHandle(2))
|
call HDF5_closeGroup(groupHandle(2))
|
||||||
|
|
||||||
|
|
|
@ -1248,7 +1248,7 @@ module subroutine mechanical_restartWrite(groupHandle,ph)
|
||||||
integer, intent(in) :: ph
|
integer, intent(in) :: ph
|
||||||
|
|
||||||
|
|
||||||
call HDF5_write(plasticState(ph)%state,groupHandle,'omega')
|
call HDF5_write(plasticState(ph)%state,groupHandle,'omega_plastic')
|
||||||
call HDF5_write(phase_mechanical_Fi(ph)%data,groupHandle,'F_i')
|
call HDF5_write(phase_mechanical_Fi(ph)%data,groupHandle,'F_i')
|
||||||
call HDF5_write(phase_mechanical_Li(ph)%data,groupHandle,'L_i')
|
call HDF5_write(phase_mechanical_Li(ph)%data,groupHandle,'L_i')
|
||||||
call HDF5_write(phase_mechanical_Lp(ph)%data,groupHandle,'L_p')
|
call HDF5_write(phase_mechanical_Lp(ph)%data,groupHandle,'L_p')
|
||||||
|
@ -1265,7 +1265,7 @@ module subroutine mechanical_restartRead(groupHandle,ph)
|
||||||
integer, intent(in) :: ph
|
integer, intent(in) :: ph
|
||||||
|
|
||||||
|
|
||||||
call HDF5_read(plasticState(ph)%state0,groupHandle,'omega')
|
call HDF5_read(plasticState(ph)%state0,groupHandle,'omega_plastic')
|
||||||
call HDF5_read(phase_mechanical_Fi0(ph)%data,groupHandle,'F_i')
|
call HDF5_read(phase_mechanical_Fi0(ph)%data,groupHandle,'F_i')
|
||||||
call HDF5_read(phase_mechanical_Li0(ph)%data,groupHandle,'L_i')
|
call HDF5_read(phase_mechanical_Li0(ph)%data,groupHandle,'L_i')
|
||||||
call HDF5_read(phase_mechanical_Lp0(ph)%data,groupHandle,'L_p')
|
call HDF5_read(phase_mechanical_Lp0(ph)%data,groupHandle,'L_p')
|
||||||
|
|
|
@ -8,10 +8,9 @@ submodule(phase:eigen) thermalexpansion
|
||||||
integer, dimension(:), allocatable :: kinematics_thermal_expansion_instance
|
integer, dimension(:), allocatable :: kinematics_thermal_expansion_instance
|
||||||
|
|
||||||
type :: tParameters
|
type :: tParameters
|
||||||
real(pReal) :: &
|
type(tPolynomial) :: &
|
||||||
T_ref
|
A_11, &
|
||||||
real(pReal), dimension(3,3,3) :: &
|
A_33
|
||||||
A = 0.0_pReal
|
|
||||||
end type tParameters
|
end type tParameters
|
||||||
|
|
||||||
type(tParameters), dimension(:), allocatable :: param
|
type(tParameters), dimension(:), allocatable :: param
|
||||||
|
@ -34,7 +33,7 @@ module function thermalexpansion_init(kinematics_length) result(myKinematics)
|
||||||
phase, &
|
phase, &
|
||||||
mech, &
|
mech, &
|
||||||
kinematics, &
|
kinematics, &
|
||||||
kinematic_type
|
myConfig
|
||||||
|
|
||||||
print'(/,1x,a)', '<<<+- phase:mechanical:eigen:thermalexpansion init -+>>>'
|
print'(/,1x,a)', '<<<+- phase:mechanical:eigen:thermalexpansion init -+>>>'
|
||||||
|
|
||||||
|
@ -56,21 +55,13 @@ module function thermalexpansion_init(kinematics_length) result(myKinematics)
|
||||||
do k = 1, kinematics%length
|
do k = 1, kinematics%length
|
||||||
if (myKinematics(k,p)) then
|
if (myKinematics(k,p)) then
|
||||||
associate(prm => param(kinematics_thermal_expansion_instance(p)))
|
associate(prm => param(kinematics_thermal_expansion_instance(p)))
|
||||||
kinematic_type => kinematics%get(k)
|
|
||||||
|
|
||||||
prm%T_ref = kinematic_type%get_asFloat('T_ref', defaultVal=T_ROOM)
|
myConfig => kinematics%get(k)
|
||||||
|
|
||||||
|
prm%A_11 = polynomial(myConfig%asDict(),'A_11','T')
|
||||||
|
if (any(phase_lattice(p) == ['hP','tI'])) &
|
||||||
|
prm%A_33 = polynomial(myConfig%asDict(),'A_33','T')
|
||||||
|
|
||||||
prm%A(1,1,1) = kinematic_type%get_asFloat('A_11')
|
|
||||||
prm%A(1,1,2) = kinematic_type%get_asFloat('A_11,T', defaultVal=0.0_pReal)
|
|
||||||
prm%A(1,1,3) = kinematic_type%get_asFloat('A_11,T^2',defaultVal=0.0_pReal)
|
|
||||||
if (any(phase_lattice(p) == ['hP','tI'])) then
|
|
||||||
prm%A(3,3,1) = kinematic_type%get_asFloat('A_33')
|
|
||||||
prm%A(3,3,2) = kinematic_type%get_asFloat('A_33,T', defaultVal=0.0_pReal)
|
|
||||||
prm%A(3,3,3) = kinematic_type%get_asFloat('A_33,T^2',defaultVal=0.0_pReal)
|
|
||||||
end if
|
|
||||||
do i=1, size(prm%A,3)
|
|
||||||
prm%A(1:3,1:3,i) = lattice_symmetrize_33(prm%A(1:3,1:3,i),phase_lattice(p))
|
|
||||||
end do
|
|
||||||
end associate
|
end associate
|
||||||
end if
|
end if
|
||||||
end do
|
end do
|
||||||
|
@ -91,22 +82,20 @@ module subroutine thermalexpansion_LiAndItsTangent(Li, dLi_dTstar, ph,me)
|
||||||
dLi_dTstar !< derivative of Li with respect to Tstar (4th-order tensor defined to be zero)
|
dLi_dTstar !< derivative of Li with respect to Tstar (4th-order tensor defined to be zero)
|
||||||
|
|
||||||
real(pReal) :: T, dot_T
|
real(pReal) :: T, dot_T
|
||||||
|
real(pReal), dimension(3,3) :: A
|
||||||
|
|
||||||
|
|
||||||
T = thermal_T(ph,me)
|
T = thermal_T(ph,me)
|
||||||
dot_T = thermal_dot_T(ph,me)
|
dot_T = thermal_dot_T(ph,me)
|
||||||
|
|
||||||
associate(prm => param(kinematics_thermal_expansion_instance(ph)))
|
associate(prm => param(kinematics_thermal_expansion_instance(ph)))
|
||||||
Li = dot_T * ( &
|
|
||||||
prm%A(1:3,1:3,1) & ! constant coefficient
|
A = 0.0_pReal
|
||||||
+ prm%A(1:3,1:3,2)*(T - prm%T_ref) & ! linear coefficient
|
A(1,1) = prm%A_11%at(T)
|
||||||
+ prm%A(1:3,1:3,3)*(T - prm%T_ref)**2 & ! quadratic coefficient
|
if (any(phase_lattice(ph) == ['hP','tI'])) A(3,3) = prm%A_33%at(T)
|
||||||
) / &
|
A = lattice_symmetrize_33(A,phase_lattice(ph))
|
||||||
(1.0_pReal &
|
Li = dot_T * A
|
||||||
+ prm%A(1:3,1:3,1)*(T - prm%T_ref) / 1.0_pReal &
|
|
||||||
+ prm%A(1:3,1:3,2)*(T - prm%T_ref)**2 / 2.0_pReal &
|
|
||||||
+ prm%A(1:3,1:3,3)*(T - prm%T_ref)**3 / 3.0_pReal &
|
|
||||||
)
|
|
||||||
end associate
|
end associate
|
||||||
dLi_dTstar = 0.0_pReal
|
dLi_dTstar = 0.0_pReal
|
||||||
|
|
||||||
|
|
|
@ -254,6 +254,36 @@ function integrateThermalState(Delta_t, ph,en) result(broken)
|
||||||
end function integrateThermalState
|
end function integrateThermalState
|
||||||
|
|
||||||
|
|
||||||
|
module subroutine thermal_restartWrite(groupHandle,ph)
|
||||||
|
|
||||||
|
integer(HID_T), intent(in) :: groupHandle
|
||||||
|
integer, intent(in) :: ph
|
||||||
|
|
||||||
|
integer :: so
|
||||||
|
|
||||||
|
|
||||||
|
do so = 1,thermal_Nsources(ph)
|
||||||
|
call HDF5_write(thermalState(ph)%p(so)%state,groupHandle,'omega_thermal')
|
||||||
|
enddo
|
||||||
|
|
||||||
|
end subroutine thermal_restartWrite
|
||||||
|
|
||||||
|
|
||||||
|
module subroutine thermal_restartRead(groupHandle,ph)
|
||||||
|
|
||||||
|
integer(HID_T), intent(in) :: groupHandle
|
||||||
|
integer, intent(in) :: ph
|
||||||
|
|
||||||
|
integer :: so
|
||||||
|
|
||||||
|
|
||||||
|
do so = 1,thermal_Nsources(ph)
|
||||||
|
call HDF5_read(thermalState(ph)%p(so)%state0,groupHandle,'omega_thermal')
|
||||||
|
enddo
|
||||||
|
|
||||||
|
end subroutine thermal_restartRead
|
||||||
|
|
||||||
|
|
||||||
module subroutine thermal_forward()
|
module subroutine thermal_forward()
|
||||||
|
|
||||||
integer :: ph, so
|
integer :: ph, so
|
||||||
|
|
|
@ -163,7 +163,7 @@ subroutine selfTest
|
||||||
'T_ref: '//trim(adjustl(x_ref_s))//IO_EOL
|
'T_ref: '//trim(adjustl(x_ref_s))//IO_EOL
|
||||||
Dict => YAML_parse_str(trim(YAML_s))
|
Dict => YAML_parse_str(trim(YAML_s))
|
||||||
p2 = polynomial(dict%asDict(),'C','T')
|
p2 = polynomial(dict%asDict(),'C','T')
|
||||||
if (dNeq(p1%at(x),p2%at(x),1.0e-12_pReal)) error stop 'polynomials: init'
|
if (dNeq(p1%at(x),p2%at(x),1.0e-10_pReal)) error stop 'polynomials: init'
|
||||||
|
|
||||||
p1 = polynomial(coef*[0.0_pReal,1.0_pReal,0.0_pReal],x_ref)
|
p1 = polynomial(coef*[0.0_pReal,1.0_pReal,0.0_pReal],x_ref)
|
||||||
if (dNeq(p1%at(x_ref+x),-p1%at(x_ref-x),1.0e-10_pReal)) error stop 'polynomials: eval(odd)'
|
if (dNeq(p1%at(x_ref+x),-p1%at(x_ref-x),1.0e-10_pReal)) error stop 'polynomials: eval(odd)'
|
||||||
|
|
Loading…
Reference in New Issue