Hello Matthew Turk,
I forget to put the function used on:
def vort_z_func(field, data):
return (
+ data['boxlib', 'v_mixt_gradient_x']
- data['boxlib', 'u_mixt_gradient_y']
)
By the way, I am sorry that I am not familiar with the term [
ValidateSpatial "validator" ]best wishes,
He Yifeng
From: Matthew Turk <matthewturk@gmail.com>
Date: 2022-05-12 20:27:19
To: Discussion of the yt analysis package <yt-users@python.org>
Subject: [yt-users] Re: Runtime error when plot derived field>Hi He Yifeng,
>
>I believe, but I'm not totally sure, that the issue might be in that
>you require a ValidateSpatial "validator" for the derived field.
>Would it be possible to show the source code of the functions you're
>using?
>
>On Thu, May 12, 2022 at 5:55 AM <hyf@stu.pku.edu.cn> wrote:
>>
>> Hi everyone:
>>
>> I met trouble when I tried to plot derived vorticity field in yt.
>>
>> The dataset is written in AMRex form (multiple layers).
>>
>> However, it will call Runtimeerror raised by "in _fill_fields" in construction_data_containers.py.
>>
>> I will be appreciate if anyone can give me some suggestions!
>>
>> --------------------------------------------------------------------------------------------------------------------------------------------
>> Here is python command in brief (ds is dataset, u,v are velocity component in x, y direction, vor_z is Vorticity in z direction):
>>
>> for ds in ts.piter():
>> ds.periodicity=(False,False,False)
>> u_gradient = ds.add_gradient_fields(("boxlib","u_mixt"))
>> v_gradient = ds.add_gradient_fields(("boxlib","v_mixt"))
>>
>> derived_fields = [ # field name, units, displayname
>> ('vort_z', '1 / cm', 'Vorticity in z direction'),
>> ]
>> for name, unitstr, dispname in derived_fields:
>> ds.add_field(
>> ('boxlib', name),
>> units = unitstr,
>> function = eval(name + '_func'),
>> sampling_type = 'cell',
>> display_name = dispname
>> )
>>
>> chang =0.112
>> kuan =0.056
>> slc = yt.SlicePlot(ds, 'z', 'vort_z', width=((chang,'cm'),(kuan,'cm')),center=([0.48,0.028,0.01],'cm'))
>> slc.save()
>> ------------------------------------------------------------------------------------------------------------------------
>> Here is the error info:
>> yt : [ERROR ] RuntimeError:
>> 1005 application called MPI_Abort(MPI_COMM_WORLD, 1) - process 4
>> 1006 File "vorfield.py", line 90, in <module>
>> 1007 slc = yt.SlicePlot(ds, 'z', 'vort_z', width=((chang,'cm'),(kuan,'cm')),center=([0.46,0.028,0.01],'cm'))
>> 1008 File "/WORK/anaconde/envs/test/lib/python3.8/site-packages/yt/visualization/plot_window.py", line 1986, in SlicePlot
>> 1009 return AxisAlignedSlicePlot(ds, normal, fields, *args, **kwargs)
>> 1010 File "/WORK/anaconde/envs/test/lib/python3.8/site-packages/yt/visualization/plot_window.py", line 1282, in __init__
>> 1011 slc.get_data(fields)
>> 1012 File "/WORK/anaconde/envs/test/lib/python3.8/site-packages/yt/data_objects/data_containers.py", line 1583, in get_data
>> 1013 self._generate_fields(fields_to_generate)
>> 1014 File "/WORK/anaconde/envs/test/lib/python3.8/site-packages/yt/data_objects/data_containers.py", line 1603, in _generate_fields
>> 1015 fd = self._generate_field(field)
>> 1016 File "/WORK/anaconde/envs/test/lib/python3.8/site-packages/yt/data_objects/data_containers.py", line 293, in _generate_field
>> 1017 tr = self._generate_fluid_field(field)
>> 1018 File "/WORK/anaconde/envs/test/lib/python3.8/site-packages/yt/data_objects/data_containers.py", line 311, in _generate_fluid_field
>> 1019 rv = self._generate_spatial_fluid(field, ngt_exception.ghost_zones)
>> 1020 File "/WORK/anaconde/envs/test/lib/python3.8/site-packages/yt/data_objects/data_containers.py", line 341, in _generate_spatial_fluid
>> 1021 gz[field][ngz:-ngz, ngz:-ngz, ngz:-ngz],
>> 1022 File "/WORK/anaconde/envs/test/lib/python3.8/site-packages/yt/data_objects/data_containers.py", line 256, in __getitem__
>> 1023 self.get_data(f)
>> 1024 File "/WORK/anaconde/envs/test/lib/python3.8/site-packages/yt/data_objects/construction_data_containers.py", line 691, in get_data
>> 1025 if len(fill) > 0: self._fill_fields(fill)
>> 1026 File "/WORK/anaconde/envs/test/lib/python3.8/site-packages/yt/data_objects/construction_data_containers.py", line 1060, in _fill_fields
>> 1027 raise RuntimeError
>>
>> best wishes,
>>
>> He Yifeng
>> _______________________________________________
>> yt-users mailing list -- yt-users@python.org
>> To unsubscribe send an email to yt-users-leave@python.org
>> https://mail.python.org/mailman3/lists/yt-users.python.org/
>> Member address: matthewturk@gmail.com
>_______________________________________________
>yt-users mailing list -- yt-users@python.org
>To unsubscribe send an email to yt-users-leave@python.org
>https://mail.python.org/mailman3/lists/yt-users.python.org/
>Member address: hyf@stu.pku.edu.cn