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 sclar expression.

Options

Option

Description

f(x,y,z)

Python expression using variables x, y, z (coordinates); dictionaries contained in model can be accessed

Example: testfiles/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
create=perNode, elSet=all, field=displacement, result=U, name=displacement
create=perElement, elSet=all, result=strain, name=strain, quadraturePoint=0:8, f(x)='np.mean(x,axis=1)'
create=perElement, elSet=all, result=stress, name=stress, quadraturePoint=0:8, f(x)='np.mean(x,axis=1)'

*output, type=ensight, name=test
create=perNode, fieldOutput=displacement
create=perElement, fieldOutput=stress
create=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, maxInc=1e0, minInc=1e0, maxNumInc=100, maxIter=25, stepLength=1, solver=theSolver
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.

Options

Option

Description

model

(Optional) default = Gaussian

mean

(Optional) default = 0.

variance

(Optional) default = 1.

lengthScale

(Optional) default = 10.

seed

(Optional) default = 0

Example: testfiles/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
create=perNode, elSet=all, field=displacement, result=U, name=displacement
create=perElement, elSet=all, result=strain, name=strain, quadraturePoint=0:8, f(x)='np.mean(x,axis=1)'
create=perElement, elSet=all, result=stress, name=stress, quadraturePoint=0:8, f(x)='np.mean(x,axis=1)'
create=perElement, elSet=all, result=kappa, name=kappa, quadraturePoint=0:8
create=perElement, elSet=all, result=kappa, name=kappaMean, quadraturePoint=0:8, f(x)='np.mean(x,axis=1)'

*output, type=ensight, name=test
create=perNode, fieldOutput=displacement
create=perElement, fieldOutput=stress
create=perElement, fieldOutput=strain
create=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

*step, maxInc=1, minInc=1, maxNumInc=100, maxIter=25, stepLength=1, solver=theSolver
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, maxInc=1e-0, minInc=1e-2, maxNumInc=100, maxIter=25, stepLength=1, solver=theSolver
dirichlet,  name=y1u, nSet=gen_top,    field=displacement, 2=-0.5

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.

Methods

evaluateAtCoordinates(coordinates)

Evaluate a field at coordinates.

abstract evaluateAtCoordinates(coordinates)[source]

Evaluate a field at coordinates.

Parameters

coordinates (ndarray) – The spatial coordinates for evaluation of the field.

Returns

The value of the field.

Return type

float