On 07/29/2014 05:38 AM, Ouyang wrote:
Hi Robert,
It works now. Thanks a lot.
Hth!
Since I learn fenics a little and run several examples, for your reference, I have a question about the "term".
Suppose we have a weak form of PDE,
\int_\Omega \Delta u \Delta v dx = \int_\Omega 6 v dx
In Fenics, this inner product, \Delta u \Delta v, can be implemented in python as
a = inner(nabla_grad(u), nabla_grad(v))*dx
it is more readable mathematically and seems any new terms can be defined here(I am not sure).
In sfepy, is there a way to do the similar thing?
No. I do not say it would be impossible to have a similar functionality, but somebody would have to think a lot and implement it.
r.
Ouyang
Fenics python script for the example: ..... bc = DirichletBC(V, u0, u0_boundary) # Define variational problem u = TrialFunction(V) v = TestFunction(V) f = Constant(-6.0) a = inner(nabla_grad(u), nabla_grad(v))*dx L = f*v*dx # Compute solution u = Function(V) solve(a == L, u, bc) ....
On Monday, July 28, 2014 9:45:00 PM UTC+8, Robert Cimrman wrote:
Hi Robert,
The attached file is basically from the interactive example of
elasticity and can be run by "python block_pointload_01.py". Displacements can be viewed in vtk. Can you drop several lines of code to demonstrate
how to update m with D in stress = ev('ev_cauchy_stress.3.Omega(m.D, u)', mode='el_avg')
how to add stress and strain output into vtk?
I did some testing between lines 85 and 105 in the attached file for
On 07/28/2014 12:41 PM, Ouyang wrote: linear that
purpose but failed.
Try this:
young = 2000.0 # Young's modulus [MPa] poisson = 0.4 # Poisson's ratio m1 = Material('m1', values={'D': stiffness_from_youngpoisson(3, young,
poisson)})
ev = pb.evaluate strain = ev('ev_cauchy_strain.3.Omega(u)', mode='el_avg') stress = ev('ev_cauchy_stress.3.Omega(m1.D, u)', m1=m1, mode='el_avg') out = vec.create_output_dict() out['cauchy_strain'] = Struct(name='output_data', mode='cell', data=strain) out['cauchy_stress'] = Struct(name='output_data', mode='cell', data=stress) pb.save_state('block_pointload_script2.vtk', out=out)
- the material can be simply passed to Problem.evaluate() as a keyword argument
- use the out argument of Problem.save_state() to save dicts with any derived data.
r.