Adding new slice outputs for a special module

23 views
Skip to first unread message

Hongzhe Zhou

unread,
Feb 2, 2024, 3:07:57 AMFeb 2
to pencil-code-discuss
Hi All,

I'm creating a new special module with a few new variables f(:,:,:,inew1), f(:,:,:,inew2) etc.
I'm wondering how to add new output of slices (i.e. video files) of these new variables (say p%inew1) and their combinations (say p%inew1**2+p%inew2**2)? I tried to look into other modules to find an example but got confused. If someone could clarify the calling tree it would be great!

Best regards,
Hongzhe

Matthias Rheinhardt

unread,
Feb 2, 2024, 8:23:25 AMFeb 2
to pencil-code-discuss

Hi Hongzhe,


best you look into hydro.f90. For slices, which contain simply f-array variables, 

you do something like


        case ('uu'); call assign_slices_vec(slices,f,iuu)


in get_slices_hydro. For slices, which contain derived quantities like your p%inew1**2+p%inew2**2

you have to declare slice buffers as for divu in hydro (divu_xy etc.), you have to allocate them like


      if (ivid_divu/=0) call alloc_slice_buffers(divu_xy,divu_xz,divu_yz,divu_xy2,divu_xy3,divu_xy4,divu_xz2,divu_r)


to fill them in calc_diagnostics_special like


        if (ivid_divu/=0) call store_slices(p%divu,divu_xy,divu_xz,divu_yz,divu_xy2,divu_xy3,divu_xy4,divu_xz2,divu_r)


and finally to store them in get_slices_special like 


          call assign_slices_scal(slices,divu_xy,divu_xz,divu_yz,divu_xy2,divu_xy3,divu_xy4,divu_xz2,divu_r)

.

Best,

Matthias


Von: pencil-co...@googlegroups.com <pencil-co...@googlegroups.com> im Auftrag von Hongzhe Zhou <zhouh...@gmail.com>
Gesendet: Freitag, 2. Februar 2024 09:07:57
An: pencil-code-discuss
Betreff: Adding new slice outputs for a special module
 
--
You received this message because you are subscribed to the Google Groups "pencil-code-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pencil-code-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pencil-code-discuss/cd75d325-1609-4605-ab3a-c481dc21367en%40googlegroups.com.

Hongzhe Zhou

unread,
Feb 4, 2024, 4:33:44 AMFeb 4
to pencil-code-discuss
Hi Matthias,

It works for me. Thanks a lot!

Hongzhe

Reply all
Reply to author
Forward
0 new messages