Skip to main content

Import from toml

In this section you can learn how construct an instance of LinearElasticModel_ by reading data from the toml-file, and ``ImportFromToml command. You can learn more about the ImportFromToml here.

Details of toml-config

Click here to see the toml-config
[linearElasticModel]
name = "linearElasticModel"
# name of the model

isPlaneStress = true
# set it to true for plane-stress formulation
# the default is false

isPlaneStrain = true
# set it to true for plane-strain formulation
# the default is false

elasticityType = "ISO"
# elasticity type, default is "ISO".
# following options are possible:
#
# - ISO: Isotropic elasticity
# - ANISO: Anisotropic elasticity
# - ORTHO: Orthotropic elasticity
# - TRANS: Transverse isotropic elasticity

poissonRatio = 0.1
# Poisson's Ratio, it is necessary when elasticityType is ISO

youngsModulus = 1.0
# Young's Modulus, it is necessary when elasticityType is ISO

stiffnessPower = 1.0
# It is only needed in case of moving mesh algorithms

c = [
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
]
# C elasticity tensor
# It should be 6 by 6
# For plane-stress and plane-strain case, it can be 3 by 3

invC = [
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
]

Example 1 (Isotropic 3D)

info

This program initiates an instance of LinearElasticModel by reading config from toml.

The config is given below. It is for isotropic elasticity type.

[linearElasticModel1]
name = "linearElasticModel"
# name of the model

elasticityType = "ISO"
# elasticity type, default is "ISO".

poissonRatio = 0.1
# Poisson's Ratio, it is necessary when elasticityType is ISO
youngsModulus = 1.0
# Young's Modulus, it is necessary when elasticityType is ISO
See program
PROGRAM main
USE easifemBase
USE easifemClasses
USE easifemMaterials

TYPE(LinearElasticModel_) :: obj
CHARACTER(*), PARAMETER :: filename = "./LinearElasticModel.toml"
CHARACTER(*), PARAMETER :: tomlName = "linearElasticModel1"

CALL FPL_Init

CALL obj%ImportFromToml2(tomlName=tomlName, filename=filename, &
& printToml=.TRUE.)
CALL obj%Display("[1]"//CHAR_LF)

CALL FPL_Finalize

END PROGRAM main

Example 2 (Isotropic and plane-stress)

info

This program initiates an instance of LinearElasticModel by reading config from toml.

The config is given below. It is for isotropic elasticity type and plane-stress.

[linearElasticModel2]
name = "linearElasticModel"
# name of the model

isPlaneStress = true
# set it to true for plane-stress formulation
# the default is false

elasticityType = "ISO"
# elasticity type, default is "ISO".

poissonRatio = 0.1
# Poisson's Ratio, it is necessary when elasticityType is ISO
youngsModulus = 1.0
# Young's Modulus, it is necessary when elasticityType is ISO
See program
PROGRAM main
USE easifemBase
USE easifemClasses
USE easifemMaterials

TYPE(LinearElasticModel_) :: obj
CHARACTER(*), PARAMETER :: filename = "./LinearElasticModel.toml"
CHARACTER(*), PARAMETER :: tomlName = "linearElasticModel2"

CALL FPL_Init

CALL obj%ImportFromToml2(tomlName=tomlName, filename=filename, &
& printToml=.TRUE.)
CALL obj%Display("[2]"//CHAR_LF)

CALL FPL_Finalize

END PROGRAM main

Example 3 (Isotropic and plane-strain)

info

This program initiates an instance of LinearElasticModel by reading config from toml.

The config is given below. It is for isotropic elasticity type and plane-strain.

[linearElasticModel3]
name = "linearElasticModel"
# name of the model

isPlaneStrain = true
# set it to true for plane-stress formulation
# the default is false

elasticityType = "ISO"
# elasticity type, default is "ISO".

poissonRatio = 0.1
# Poisson's Ratio, it is necessary when elasticityType is ISO
youngsModulus = 1.0
# Young's Modulus, it is necessary when elasticityType is ISO
See program
PROGRAM main
USE easifemBase
USE easifemClasses
USE easifemMaterials

TYPE(LinearElasticModel_) :: obj
CHARACTER(*), PARAMETER :: filename = "./LinearElasticModel.toml"
CHARACTER(*), PARAMETER :: tomlName = "linearElasticModel3"

CALL FPL_Init

CALL obj%ImportFromToml2(tomlName=tomlName, filename=filename, &
& printToml=.TRUE.)
CALL obj%Display("[3]"//CHAR_LF)

CALL FPL_Finalize

END PROGRAM main

Example 4 (Anisotropic and 3D)

info

This program initiates an instance of LinearElasticModel by reading config from toml. The config is given below. It is for isotropic anisotropic elasticity type.

[linearElasticModel4]
name = "linearElasticModel"
# name of the model

elasticityType = "ANISO"
# elasticity type, default is "ISO".

c = [
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
]
# C elasticity tensor
# It should be 6 by 6
# For plane-stress and plane-strain case, it can be 3 by 3

invC = [
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
]
# inverse of C elasticity tensor
# It should be 6 by 6
# For plane-stress and plane-strain case, it can be 3 by 3
See program
PROGRAM main
USE easifemBase
USE easifemClasses
USE easifemMaterials

TYPE(LinearElasticModel_) :: obj
CHARACTER(*), PARAMETER :: filename = "./LinearElasticModel.toml"
CHARACTER(*), PARAMETER :: tomlName = "linearElasticModel4"

CALL FPL_Init

CALL obj%ImportFromToml2(tomlName=tomlName, filename=filename, &
& printToml=.TRUE.)
CALL obj%Display("[4]"//CHAR_LF)

CALL FPL_Finalize

END PROGRAM main

Example 5 (Anisotropic and plane-stress)

info

This program initiates an instance of LinearElasticModel by reading config from toml. The config is given below. It is for isotropic anisotropic elasticity type and plane-stress case.

note

In the case of plane-stress case we only read 3-by-3 block.

[linearElasticModel5]
name = "linearElasticModel"
# name of the model

elasticityType = "ANISO"
# elasticity type, default is "ISO".

isPlaneStress = true
# Plane stress

c = [
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
]
# C elasticity tensor
# It should be 6 by 6
# For plane-stress and plane-strain case, we use only 3 by 3 part

invC = [
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
]
# inverse of C elasticity tensor
# It should be 6 by 6
# For plane-stress and plane-strain case, we use only 3 by 3 part
See program
PROGRAM main
USE easifemBase
USE easifemClasses
USE easifemMaterials

TYPE(LinearElasticModel_) :: obj
CHARACTER(*), PARAMETER :: filename = "./LinearElasticModel.toml"
CHARACTER(*), PARAMETER :: tomlName = "linearElasticModel5"

CALL FPL_Init

CALL obj%ImportFromToml2(tomlName=tomlName, filename=filename, &
& printToml=.TRUE.)
CALL obj%Display("[5]"//CHAR_LF)

CALL FPL_Finalize

END PROGRAM main

Example 6 (Anisotropic and plane-strain)

info

This program initiates an instance of LinearElasticModel by reading config from toml. The config is given below. It is for isotropic anisotropic elasticity type and plane-strain case.

note

In the case of plane-stress and plane-strain case we only read 3-by-3 block.

[linearElasticModel6]
name = "linearElasticModel"
# name of the model

elasticityType = "ANISO"
# elasticity type, default is "ISO".

isPlaneStrain = true
# Plane strain

c = [
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
]
# C elasticity tensor
# It should be 6 by 6
# For plane-stress and plane-strain case, we use only 3 by 3 part

invC = [
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
]
# inverse of C elasticity tensor
# It should be 6 by 6
# For plane-stress and plane-strain case, we use only 3 by 3 part
See program
PROGRAM main
USE easifemBase
USE easifemClasses
USE easifemMaterials

TYPE(LinearElasticModel_) :: obj
CHARACTER(*), PARAMETER :: filename = "./LinearElasticModel.toml"
CHARACTER(*), PARAMETER :: tomlName = "linearElasticModel6"

CALL FPL_Init

CALL obj%ImportFromToml2(tomlName=tomlName, filename=filename, &
& printToml=.TRUE.)
CALL obj%Display("[6]"//CHAR_LF)

CALL FPL_Finalize

END PROGRAM main