On Friday, 26 July 2013 16:54:45 UTC+5:30, Robert Cimrman wrote:
Do you have the latest code with Navier-Stokes terms updated for 2D?


Yes.
Also the navier_stokes2D.py is working perfectly fine.
 
r.

On 07/26/2013 01:23 PM, Ankit Mahato wrote:
> Hi R,
>
> I looked the changes you made.
> But, the modified code you sent is still not working and throwing errors:
> convdiff: left over: ['os', '__builtins__', '__doc__', '__name__',
> '__package__', 'verbose', 'sys', 'data_dir', 'cwd', '_filename', 'main',
> '__file__']
> convdiff: reading mesh
> (/usr/local/lib/python2.7/dist-packages/sfepy/meshes/2d/rectangle_fine_quad.mesh)...
> convdiff: ...done in 0.02 s
> convdiff: creating regions...
> convdiff:     Wall
> convdiff:     Top
> convdiff:     Surface
> convdiff:     Driven
> convdiff:     Entry
> convdiff:     Omega
> convdiff: ...done in 0.03 s
> convdiff: using solvers:
>                  ts: no ts
>                 nls: newton
>                  ls: ls
> convdiff: equation "balance":
> convdiff: + dw_div_grad.5.Omega(m.viscosity, v, u)
>         + dw_convect.5.Omega(v, u)
>         - dw_stokes.5.Omega(v, p) = 0
> convdiff: equation "incompressibility":
> convdiff: dw_stokes.5.Omega(u, q) = 0
> convdiff: setting up dof connectivities...
> convdiff: ...done in 0.01 s
> convdiff: updating variables...
> convdiff: ...done
> convdiff: matrix shape: (44949, 44949)
> convdiff: assembling matrix graph...
> convdiff: ...done in 0.14 s
> convdiff: matrix structural nonzeros: 1747752 (8.65e-04% fill)
> convdiff: updating materials...
> convdiff:     m
> convdiff: ...done in 0.00 s
> convdiff: nls: iter: 0, residual: 2.002082e-02 (rel: 1.000000e+00)
> convect_build_vtg(): ERR_Switch
> Traceback (most recent call last):
>    File
> "examples/phase_change/convective_diffusive/convective_diffusive_R.py",
> line 131, in <module>
>      main()
>    File
> "examples/phase_change/convective_diffusive/convective_diffusive_R.py",
> line 113, in main
>      flow = problem.solve()
>    File "/usr/local/lib/python2.7/dist-packages/sfepy/fem/problemDef.py",
> line 933, in solve
>      vec = solvers.nls(vec0)
>    File "/usr/local/lib/python2.7/dist-packages/sfepy/solvers/nls.py", line
> 345, in __call__
>      mtx_a = fun_grad(vec_x)
>    File "/usr/local/lib/python2.7/dist-packages/sfepy/fem/evaluate.py", line
> 66, in eval_tangent_matrix
>      mtx = pb.equations.eval_tangent_matrices(vec, mtx)
>    File "/usr/local/lib/python2.7/dist-packages/sfepy/fem/equations.py",
> line 640, in eval_tangent_matrices
>      self.evaluate(mode='weak', dw_mode='matrix', asm_obj=tangent_matrix)
>    File "/usr/local/lib/python2.7/dist-packages/sfepy/fem/equations.py",
> line 526, in evaluate
>      asm_obj=asm_obj)
>    File "/usr/local/lib/python2.7/dist-packages/sfepy/fem/equations.py",
> line 766, in evaluate
>      ret_status=True)
>    File "/usr/local/lib/python2.7/dist-packages/sfepy/terms/terms.py", line
> 1474, in evaluate
>      vals.append(self.sign * val)
> RuntimeError: ccore error (see above)
>
> On Friday, 26 July 2013 14:17:51 UTC+5:30, Robert Cimrman wrote:
>>
>> Hi Ankit,
>>
>> you have to call problem.time_update() (= apply EBCs, update/compute
>> material
>> parameters) always after setting equations/before calling problem.solve().
>>
>> The attached version works, make a diff to see what other (minor) changes
>> needed to be done. Notably, results of both sub-problems are saved into a
>> single file.
>>
>> Cheers,
>> r.
>>
>> On 07/25/2013 11:21 PM, Ankit Mahato wrote:
>>> Hi R,
>>>
>>> I tried out modifying the thermo electric example, but I was getting
>>>
>>> convdiff: left over: ['verbose', '__builtins__', 'n_step', '__file__',
>>> '__doc__', '__name__', 't1', 'sys', 'data_dir', 't0', '__package__',
>>> '_filename', 'main', 'os', 'cwd']
>>> convdiff: reading mesh
>>>
>> (/usr/local/lib/python2.7/dist-packages/sfepy/meshes/2d/rectangle_fine_quad.mesh)...
>>
>>> convdiff: ...done in 0.02 s
>>> convdiff: creating regions...
>>> convdiff:     Wall
>>> convdiff:     Top
>>> convdiff:     Surface
>>> convdiff:     Driven
>>> convdiff:     Entry
>>> convdiff:     Omega
>>> convdiff: ...done in 0.03 s
>>> convdiff: using solvers:
>>>                   ts: ts
>>>                  nls: newton
>>>                   ls: ls
>>> convdiff: equation "balance":
>>> convdiff: + dw_div_grad.5.Omega(m.viscosity, v, u)
>>>          + dw_convect.5.Omega(v, u)
>>>          - dw_stokes.5.Omega(v, p) = 0
>>> convdiff: equation "incompressibility":
>>> convdiff: dw_stokes.5.Omega(u, q) = 0
>>> convdiff: setting up dof connectivities...
>>> convdiff: ...done in 0.00 s
>>> convdiff: updating variables...
>>> convdiff: ...done
>>> convdiff: matrix shape: (44949, 44949)
>>> convdiff: assembling matrix graph...
>>> convdiff: ...done in 0.15 s
>>> convdiff: matrix structural nonzeros: 1747752 (8.65e-04% fill)
>>> convdiff: updating materials...
>>> convdiff:     m
>>> convdiff: ...done in 0.01 s
>>> convdiff: nls: iter: 0, residual: 2.002082e-02 (rel: 1.000000e+00)
>>> convect_build_vtg(): ERR_Switch
>>> Traceback (most recent call last):
>>>     File
>>> "examples/phase_change/convective_diffusive/convective_diffusive.py",
>> line
>>> 139, in <module>
>>>       main()
>>>     File
>>> "examples/phase_change/convective_diffusive/convective_diffusive.py",
>> line
>>> 125, in main
>>>       state_el = problem.solve()
>>>     File
>> "/usr/local/lib/python2.7/dist-packages/sfepy/fem/problemDef.py",
>>> line 933, in solve
>>>       vec = solvers.nls(vec0)
>>>     File "/usr/local/lib/python2.7/dist-packages/sfepy/solvers/nls.py",
>> line
>>> 345, in __call__
>>>       mtx_a = fun_grad(vec_x)
>>>     File "/usr/local/lib/python2.7/dist-packages/sfepy/fem/evaluate.py",
>> line
>>> 66, in eval_tangent_matrix
>>>       mtx = pb.equations.eval_tangent_matrices(vec, mtx)
>>>     File "/usr/local/lib/python2.7/dist-packages/sfepy/fem/equations.py",
>>> line 640, in eval_tangent_matrices
>>>       self.evaluate(mode='weak', dw_mode='matrix',
>> asm_obj=tangent_matrix)
>>>     File "/usr/local/lib/python2.7/dist-packages/sfepy/fem/equations.py",
>>> line 526, in evaluate
>>>       asm_obj=asm_obj)
>>>     File "/usr/local/lib/python2.7/dist-packages/sfepy/fem/equations.py",
>>> line 766, in evaluate
>>>       ret_status=True)
>>>     File "/usr/local/lib/python2.7/dist-packages/sfepy/terms/terms.py",
>> line
>>> 1474, in evaluate
>>>       vals.append(self.sign * val)
>>> RuntimeError: ccore error (see above)
>>>
>>>
>>>
>>> Then I modified it to solve without any timestep and still it is
>> throwing
>>> errors:
>>>
>>> convdiff: left over: ['os', '__builtins__', '__doc__', '__name__',
>>> '__package__', 'verbose', 'sys', 'data_dir', 'cwd', '_filename', 'main',
>>> '__file__']
>>> convdiff: reading mesh
>>>
>> (/usr/local/lib/python2.7/dist-packages/sfepy/meshes/2d/rectangle_fine_quad.mesh)...
>>
>>> convdiff: ...done in 0.02 s
>>> convdiff: creating regions...
>>> convdiff:     Wall
>>> convdiff:     Top
>>> convdiff:     Surface
>>> convdiff:     Driven
>>> convdiff:     Entry
>>> convdiff:     Omega
>>> convdiff: ...done in 0.03 s
>>> convdiff: using solvers:
>>>                   ts: no ts
>>>                  nls: newton
>>>                   ls: ls
>>> convdiff: equation "balance":
>>> convdiff: + dw_div_grad.5.Omega(m.viscosity, v, u)
>>>          + dw_convect.5.Omega(v, u)
>>>          - dw_stokes.5.Omega(v, p) = 0
>>> convdiff: equation "incompressibility":
>>> convdiff: dw_stokes.5.Omega(u, q) = 0
>>> convdiff: setting up dof connectivities...
>>> convdiff: ...done in 0.00 s
>>> convdiff: updating materials...
>>> convdiff:     m
>>> convdiff: ...done in 0.01 s
>>> Traceback (most recent call last):
>>>     File
>>> "examples/phase_change/convective_diffusive/convective_diffusive.py",
>> line
>>> 126, in <module>
>>>       main()
>>>     File
>>> "examples/phase_change/convective_diffusive/convective_diffusive.py",
>> line
>>> 112, in main
>>>       flow = problem.solve()
>>>     File
>> "/usr/local/lib/python2.7/dist-packages/sfepy/fem/problemDef.py",
>>> line 929, in solve
>>>       state0.apply_ebc(force_values=force_values)
>>>     File "/usr/local/lib/python2.7/dist-packages/sfepy/fem/state.py",
>> line
>>> 107, in apply_ebc
>>>       self.variables.apply_ebc(self.vec, force_values=force_values)
>>>     File "/usr/local/lib/python2.7/dist-packages/sfepy/fem/variables.py",
>>> line 308, in apply_ebc
>>>       var.apply_ebc(vec, self.di.indx[var.name].start, force_values)
>>>     File "/usr/local/lib/python2.7/dist-packages/sfepy/fem/variables.py",
>>> line 1780, in apply_ebc
>>>       eq_map = self.eq_map
>>> AttributeError: 'FieldVariable' object has no attribute 'eq_map'
>>>
>>> I am attaching the code.
>>> I have spent lot of hours trying to find my error, but to no avail.
>>> Kindly help.
>>>
>>> Regards.
>>>
>>> On Wednesday, 3 July 2013 17:25:42 UTC+5:30, Ankit Mahato wrote:
>>>>
>>>>
>>>>
>>>> On Wednesday, 3 July 2013 17:19:57 UTC+5:30, Robert Cimrman wrote:
>>>>>
>>>>> On 07/03/2013 01:38 PM, Ankit Mahato wrote:
>>>>>>
>>>>>>
>>>>>> On Wednesday, 3 July 2013 13:14:37 UTC+5:30, Robert Cimrman wrote:
>>>>>>>
>>>>>>> On 07/03/2013 01:51 AM, Ankit Mahato wrote:
>>>>>>>> R,
>>>>>>>>
>>>>>>>> Attached is the Temperature distribution along the length with
>> Peclet
>>>>>>>> number graph which you wanted to have a look at.
>>>>>>>> I used ParaView to generate it.
>>>>>>>> It is validated by the Fig 6.2 of Computer Simulation of Flow and
>>>>> Heat
>>>>>>>> Transfer, P S Ghoshdastidar, Tata McGraw-Hill.
>>>>>>>
>>>>>>> Good! Btw. are there some analytical relations that can be verified,
>>>>> for
>>>>>>> example on some special simple geometries/boundary conditions? It
>>>>> would be
>>>>>>> interesting to see the comparison of analytical/numerical curves in
>> a
>>>>>>> single
>>>>>>> figure (I have no access to the book).
>>>>>>>
>>>>>>
>>>>>> Yes this one can be verified with the analytical solution.
>>>>>> I was about to ask you that the analytical vs simulation curve should
>>>>> be
>>>>>> plotted for how many test cases?
>>>>>
>>>>> As you wish (if it is ok :)) BTW.
>> http://terri.toybox.ca/python-soc/still does
>>>>> not show your blog posts - is the subscription correct?
>>>>>
>>>>>
>>>> Yes R I saw it yesterday and I thought maybe it is not updated.
>>>> The subscription link points to
>>>> http://ankitmahato.blogspot.in/search/label/Python
>>>> which is correct.
>>>> I think I should write to Terri
>>>>
>>>> r.
>>>>>
>>>>>>>
>>>>>>> Similar figures could be also done in sfepy directly, check [1] - it
>>>>> is
>>>>>>> mostly
>>>>>>> useful when one tweaks and runs a simulation repeatedly, as the
>> setup
>>>>>>> needs
>>>>>>> some effort...
>>>>>>>
>>>>>>
>>>>>> Okie :)
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> r.
>>>>>>>
>>>>>>> [1] http://sfepy.org/doc-devel/primer.html#probing
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>
>>
>>
>