[FLASH-USERS] Question about resistivity varying in space

Leland Ellison lee at pacificfusion.energy
Tue Nov 14 11:29:06 EST 2023


Hi Ernesto,

To make a custom magnetic resistivity model that depends on spatial
coordinates, I'd do this by customizing the
MagneticResitivity_fullState.f90 file in your problem directory. Notice
that the fullState version gets passed in the full vector of unknowns and
not just the density and temperature. If you look carefully at e.g.
diff_advanceMag, it's actually calling the fullState version by passing in
the solnVec so this is the one you want to customize. Next, as you noticed,
you don't typically have the spatial coordinates available in your solnVec,
but it's quite straightforward to add them. For instance, you can add:

VARIABLE XCTR
VARIABLE YCTR
VARIABLE ZCTR

in the Config file for your problem, and then in your Simulation_initBlock
you can populate these mesh variables with cell centered coordinates, e.g.:

! inside your i,j,k mesh loop after you've fetched the spatial coordinates
#ifdef XCTR_VAR
        solnData(XCTR_VAR, i,j,k) = xCoord(i)
#endif

Then these coordinates will be present in your solnVec for use inside of
your customized MagneticResistivity_fullState routine.

Hope this helps!
Lee

________________
Leland Ellison PhD


On Tue, Nov 14, 2023 at 7:56 AM Ernesto Zurbriggen <ezurbriggen at unc.edu.ar>
wrote:

> Hi all!
> I'm carrying out some single fluid resistive MHD runs with constant
> resistivity using the
> */MagneticResistivity/MagneticResistivityMain/Constant* unit.
> Now I would like to implement a spatially dependent resistivity, but I'm
> not sure which is the easiest way without modifying different subroutines
> in different units.
>
> The optimal implementation would be to create a new unit that keeps the
> structure of the */MagneticResistivity/MagneticResistivityMain/Constant*
> unit,
> so I didn't have to change anything else in other units. But the problem
> with this idea is that the *MagneticResistivity subroutine*,
> which calculates the resistivity, has no notion of spatial coordinates.
> And to provide this subroutine with the spatial coordinates doesn't seem
> obvious.
>
> Another possibility might be to save the resistivity in a scratchcenter
> variable, but in this case I couldn't take advantage of the structure of
> the */MagneticResistivity/MagneticResistivityMain/Constant* unit.
>
> Any ideas or suggestions will be appreciated!
>
> Thanks in advance!
>
> --
>
> *PhD Ernesto Zurbriggen,*
> *Assistant researcher (CONICET)*
>
>
>
> *Email: ezurbriggen@ <ernesto.zurbriggen at craam.mackenzie.br>unc.edu.ar
> <http://unc.edu.ar/>IP phone: (+54) 351-535 3776 (int. 75601)*
> *Instituto de Astronomía Teórica y Experimental (IATE-CONICET), *
> *Francisco Laprida sth 922**, X5000BGR, **Córdoba, **Argentina. *
> _______________________________________________
> flash-users mailing list
> flash-users at flash.rochester.edu
>
> For list info, including unsubscribe:
> https://flash.rochester.edu/mailman/listinfo/flash-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://flash.rochester.edu/pipermail/flash-users/attachments/20231114/209d5e77/attachment.htm>


More information about the flash-users mailing list