BAMresearch / FenicsConcrete

FE model representing the hardening of concrete
MIT License
1 stars 1 forks source link

How to consistently and elegantly define 2D and 3D experimental setups #1

Closed eriktamsen closed 1 year ago

eriktamsen commented 2 years ago

problems: definition of direction of gravity. currently in 2D in -y and in 3D in -z definition of zero displacement (0,0) and (0,0,0) and more...

TTitscher commented 2 years ago

In you example above, you could extract the geometric dimension and then define vectors based on that.

dim = mesh.geometric_dimension()
fix_left = DirichletBC(function_space, np.zeros(dim),...) # or maybe list(np.zeros(dim))
gravity = np.zeros(dim)
gravity[dim-1] = -9.81

For me, this a matter of readability. Since there are only three cases (dim=1, 2, 3), a simple if dim == 1: elif dim==2, ... would also work.

eriktamsen commented 2 years ago

Good suggestions. I guess the bigger question is, do we want to go with gravity[dim-1], which messes with the code every time a direction is concerned, with the only upside that the visualization might be more intuitive. Is it maybe easier to define x as the relevant direction, in this case direction of gravity. The problem also just appears if you want to run 1d/2D/3D simulations of the "same" problem, which I guess is usually also just relevant for testing.

eriktamsen commented 1 year ago

will be addressed in fenicsXconcrete