Analytical fields
Analytical fields define values for spatial coordinates, e.g., for spatially varying material properties.
scalarexpression - Field defined by expression
Relevant module edelweissfe.analyticalfields.scalarexpression
Define a field using a scalar expression.
Option |
Type / Default |
Description |
|---|---|---|
f(x,y,z) |
str (required) |
Python expression using variables x, y, z (coordinates); dictionaries contained in model can be accessed |
testfiles/marmot/AnalyticalFieldsScalarExpression/test.inp*material, name=LinearElastic, id=linE
**Isotropic
**E nu
1.8e4, 0.22
*job, name=job, domain=3d
*solver, solver=NISTParallel, name=theSolver
*modelGenerator, generator=boxGen, name=gen
x0 =0
y0 =0
z0 =0
nX =5
nY =5
nZ =10
lX =1
lY =1
lZ =2
elType =C3D8
*section, name=section1, material=linE, type=solid
all
*fieldOutput
>>perNode, elSet=all, field=displacement, result=U, name=displacement
>>perElement, elSet=all, result=strain, name=strain, quadraturePoint=0:8, f(x)='np.mean(x,axis=1)'
>>perElement, elSet=all, result=stress, name=stress, quadraturePoint=0:8, f(x)='np.mean(x,axis=1)'
*output, type=ensight, name=test
>>perNode, fieldOutput=displacement
>>perElement, fieldOutput=stress
>>perElement, fieldOutput=strain
>>configuration, overwrite=yes
*AnalyticalField, name=rdmF, type=randomScalar
model = Gaussian
mean = 0.
variance = 0.03
lengthScale = .4
seed = 1
*AnalyticalField, name=exprF, type=scalarExpression
"f(x,y,z)" = "np.cos(x) * np.sin(y) * z * model.analyticalFields['rdmF'].evaluateAtCoordinates([x,y,z])[0][0]"
*step, solver=theSolver
maxInc=1e0, minInc=1e0, maxNumInc=100, maxIter=25, stepLength=1
>>dirichlet, name=all12, nSet=all, field=displacement, 1=0, 2=0
>>dirichlet, name=all3, nSet=all, field=displacement, 3=1., analyticalField=exprF
randomscalar - A random field
Relevant module edelweissfe.analyticalfields.randomscalar
Define a random field using the GSTools library. “Müller, S., Schüler, L., Zech, A., and Heße, F.: GSTools v1.3: a toolbox for geostatistical modelling in Python, Geosci. Model Dev., 15, 3161–3182, https://doi.org/10.5194/gmd-15-3161-2022, 2022.”
Option |
Type / Default |
Description |
|---|---|---|
model |
str, default=’Gaussian’ |
Covariance Model of the spatial random field |
mean |
float, default=0.0 |
Mean of the spatial random field |
variance |
float, default=1.0 |
Variance of the model |
lengthScale |
float, default=10.0 |
Length scale of the model |
nu |
float, default=1.0 |
Smoothness parameter for Matern covariance function |
seed |
int, default=0 |
Seed of the random number generator |
testfiles/marmot/AnalyticalFieldsRandomScalar/test.inp*material, name=VonMises, id=mat
210000, 0.3, 550, 1000, 200, 1400
*job, name=job, domain=3d
*solver, solver=NISTParallel, name=theSolver
*modelGenerator, generator=boxGen, name=gen
x0 =0
y0 =0
z0 =0
nX =6
nY =10
nZ =1
lX =30
lY =50
lZ =10
elType =C3D8
*section, name=section1, material=mat, type=solid
all
*fieldOutput
>>perNode, elSet=all, field=displacement, result=U, name=displacement
>>perElement, elSet=all, result=strain, name=strain, quadraturePoint=0:8, f(x)='np.mean(x,axis=1)'
>>perElement, elSet=all, result=stress, name=stress, quadraturePoint=0:8, f(x)='np.mean(x,axis=1)'
>>perElement, elSet=all, result=kappa, name=kappa, quadraturePoint=0:8
>>perElement, elSet=all, result=kappa, name=kappaMean, quadraturePoint=0:8, f(x)='np.mean(x,axis=1)'
*output, type=ensight, name=test
>>perNode, fieldOutput=displacement
>>perElement, fieldOutput=stress
>>perElement, fieldOutput=strain
>>perElement, fieldOutput=kappaMean
>>configuration, overwrite=yes
***output, type=monitor
*AnalyticalField, name=AnalyticalField-01, type=randomScalar
model = Gaussian
mean = 0.01
variance = 0.000001
lengthScale = 10
seed = 2
*AnalyticalField, name=AnalyticalField-02, type=randomScalar
model = Matern
mean = 0.01
variance = 0.000001
lengthScale = 3
nu = 0.2
seed = 3
*step, solver=theSolver
maxInc=1, minInc=1, maxNumInc=100, maxIter=25, stepLength=1
>>setfield, name=sf, fieldOutput=kappa, type=analyticalField, value=AnalyticalField-01
>>dirichlet, name=x0u, nSet=gen_left, field=displacement, 1=0.
>>dirichlet, name=y0u, nSet=gen_bottom, field=displacement, 2=0.
>>dirichlet, name=z0u, nSet=gen_back, field=displacement, 3=0.
*step, solver=theSolver
maxInc=1e-0, minInc=1e-2, maxNumInc=100, maxIter=25, stepLength=1
>>dirichlet, name=y1u, nSet=gen_top, field=displacement, 2=-0.5
*step, solver=theSolver
maxInc=1, minInc=1, maxNumInc=100, maxIter=25, stepLength=1
>>setfield, name=sf2, fieldOutput=kappa, type=analyticalField, value=AnalyticalField-02
*step, solver=theSolver
maxInc=1e-0, minInc=1e-2, maxNumInc=100, maxIter=25, stepLength=1
>>dirichlet, name=y1u, nSet=gen_top, field=displacement, 2=-0.5
fromvtk - Field interpolated from VTK data
Relevant module edelweissfe.analyticalfields.fromvtk
Use PyVista to interpolate from vtk data.
Option |
Type / Default |
Description |
|---|---|---|
file |
str (required) |
path to database file |
result |
str (required) |
result name in database |
Implementing your own fields
Subclass from the field base class in module edelweissfe.analyticalfields.base.analyticalfieldbase
- class edelweissfe.analyticalfields.base.analyticalfieldbase.AnalyticalField(name, data, model)[source]
The field base class.
- Parameters:
name (str) – The name of the field.
data (list[str]) – The input file data lines.
model (FEModel) – The dictionary containing the model tree.
- Attributes:
- schema
Methods
evaluateAtCoordinates(coordinates)Evaluate a field at coordinates.