38 double precision ::
tmf
44 double precision,
public ::
mf_vmax = 3.d6
47 integer,
private,
protected :: rho_
50 integer,
allocatable,
private,
protected :: mom(:)
53 integer,
allocatable,
private,
protected :: mag(:)
74 character(len=*),
intent(in) :: files(:)
82 open(
unitpar, file=trim(files(n)), status=
"old")
139 double precision :: dvolume(ixG^T),dsurface(ixG^T),dvone
140 double precision :: dtfff,dtfff_pe,dtnew,dx^D
141 double precision :: cwsin_theta_new,cwsin_theta_old
142 double precision :: sum_jbb,sum_jbb_ipe,sum_j,sum_j_ipe,sum_l_ipe,sum_l
143 double precision :: f_i_ipe,f_i,volumepe,volume,tmpt,time_in
144 double precision,
external :: integral_grid
148 integer :: i,iigrid, igrid, idims,ix^D,hxM^LL,fhmf,tmpit,i^D
149 integer :: common_metrics_unit
150 logical :: patchwi(ixG^T), stagger_flag,common_metrics_exists
157 if(
mype==0)
write(*,*)
'Evolving to force-free field using magnetofricitonal method...'
165 common_metrics_unit=-1
168 if(i==0 .and.
it>0) i=
it
179 call mpistop(
"mf_log_mode must be 'auto', 'append', or 'replace'")
205 do iigrid=1,igridstail; igrid=igrids(iigrid);
218 common_metrics_exists=.false.
221 exist=common_metrics_exists)
223 call mpi_bcast(common_metrics_exists,1,mpi_logical,0,
icomm,
ierrmpi)
227 '_nlfff_metrics.csv',status=
'old',position=
'append',action=
'write')
230 '_nlfff_metrics.csv',status=
'replace',action=
'write')
245 do iigrid=1,igridstail; igrid=igrids(iigrid);
249 dtfff_pe=min(dtfff_pe,dtnew)
251 call mpi_allreduce(dtfff_pe,dtfff,1,mpi_double_precision,mpi_min, &
276 if(mod(i,10)==0)
then
289 do iigrid=1,igridstail; igrid=igrids(iigrid);
295 do iigrid=1,igridstail; igrid=igrids(iigrid);
301 write(*,*)
'<CW sin theta>:',cwsin_theta_new
302 write(*,*)
'<f_i>:',f_i
303 write(*,*)
'----------------------------------------------------------'
309 if(mod(i,10)/=0)
then
320 write (*,*)
'Reach maximum iteration step!'
321 write (*,*)
'The total iteration step is:', i
335 do iigrid=1,igridstail; igrid=igrids(iigrid);
336 ps(igrid)%w(ixg^t,mom(:))=zero
343 {^ifthreed
close(common_metrics_unit)}
348 if(
mype==0)
write(*,*)
'Magnetofriction phase took : ',mpi_wtime()-time_in,
' sec'
359 do iigrid=1,igridstail; igrid=igrids(iigrid);
363 hxm^ll=
ixm^ll-
kr(idims,^d);
364 dsurface(
ixm^t)=dsurface(
ixm^t)+
block%surfaceC(hxm^t,idims)
367 call mask_inner(ixg^ll,
ixm^ll,ps(igrid)%w,ps(igrid)%x)
368 sum_jbb_ipe = sum_jbb_ipe+integral_grid_mf(ixg^ll,
ixm^ll,ps(igrid)%w,&
369 ps(igrid)%x,1,patchwi)
370 sum_j_ipe = sum_j_ipe+integral_grid_mf(ixg^ll,
ixm^ll,ps(igrid)%w,&
371 ps(igrid)%x,2,patchwi)
372 f_i_ipe=f_i_ipe+integral_grid_mf(ixg^ll,
ixm^ll,ps(igrid)%w,&
373 ps(igrid)%x,3,patchwi)
374 sum_l_ipe = sum_l_ipe+integral_grid_mf(ixg^ll,
ixm^ll,ps(igrid)%w,&
375 ps(igrid)%x,4,patchwi)
377 call mpi_allreduce(sum_jbb_ipe,sum_jbb,1,mpi_double_precision,&
379 call mpi_allreduce(sum_j_ipe,sum_j,1,mpi_double_precision,mpi_sum,&
381 call mpi_allreduce(f_i_ipe,f_i,1,mpi_double_precision,mpi_sum,&
383 call mpi_allreduce(sum_l_ipe,sum_l,1,mpi_double_precision,mpi_sum,&
385 call mpi_allreduce(volumepe,volume,1,mpi_double_precision,mpi_sum,&
389 cwsin_theta_new = sum_jbb/sum_j
397 subroutine mask_inner(ixI^L,ixO^L,w,x)
399 integer,
intent(in) :: ixI^L,ixO^L
400 double precision,
intent(in):: w(ixI^S,nw),x(ixI^S,1:ndim)
401 double precision :: xO^L
404 {xomin^d = xprobmin^d + 0.05d0*(xprobmax^d-xprobmin^d)\}
405 {xomax^d = xprobmax^d - 0.05d0*(xprobmax^d-xprobmin^d)\}
407 xomin^nd = xprobmin^nd
412 {
do ix^db=ixomin^db,ixomax^db\}
413 if({ x(ix^dd,^d) > xomin^d .and. x(ix^dd,^d) < xomax^d | .and. })
then
415 volumepe=volumepe+dvolume(ix^d)
417 patchwi(ix^d)=.false.
421 end subroutine mask_inner
423 subroutine printlog_mf
424 integer :: amode, status(MPI_STATUS_SIZE)
425 integer :: truncate_unit, ios
426 character(len=800) :: filename,filehead
427 character(len=2048) :: line,datastr
428 logical,
save :: logmfopened=.false.
429 logical :: logfile_exists
434 if(.not.logmfopened)
then
439 write(filename,
"(a,a)") trim(base_filename),
"_mflog.csv"
442 inquire(file=trim(filename),exist=logfile_exists)
446 open(newunit=truncate_unit,file=trim(filename),status=
'replace', &
447 action=
'write',iostat=ios)
448 if(ios/=0)
call mpistop(
'Unable to replace magnetofriction log file')
450 logfile_exists=.false.
453 amode=ior(mpi_mode_create,mpi_mode_wronly)
454 amode=ior(amode,mpi_mode_append)
455 call mpi_file_open(mpi_comm_self,filename,amode,mpi_info_null,fhmf,ierrmpi)
458 if(.not.logfile_exists)
then
459 filehead=
" itmf, dt, <f_i>, <CW sin theta>, <Current>, <Lorenz force>"
460 call mpi_file_write(fhmf,filehead,len_trim(filehead), &
461 mpi_character,status,ierrmpi)
462 call mpi_file_write(fhmf,achar(10),1,mpi_character,status,ierrmpi)
466 write(datastr,
'(i6,a)') i,
','
467 line=trim(line)//trim(datastr)
468 write(datastr,
'(es13.6,a)') dtfff,
','
469 line=trim(line)//trim(datastr)
470 write(datastr,
'(es13.6,a)') f_i,
','
471 line=trim(line)//trim(datastr)
472 write(datastr,
'(es13.6,a)') cwsin_theta_new,
','
473 line=trim(line)//trim(datastr)
474 write(datastr,
'(es13.6,a)') sum_j,
','
475 line=trim(line)//trim(datastr)
476 write(datastr,
'(es13.6)') sum_l
477 line=trim(line)//trim(datastr)//new_line(
'A')
478 call mpi_file_write(fhmf,line,len_trim(line),mpi_character,status,ierrmpi)
481 end subroutine printlog_mf
483 function integral_grid_mf(ixI^L,ixO^L,w,x,iw,patchwi)
486 integer,
intent(in) :: ixI^L,ixO^L,iw
487 double precision,
intent(in) :: x(ixI^S,1:ndim)
488 double precision,
intent(in) :: w(ixI^S,nw+nwauxio)
489 logical,
intent(in) :: patchwi(ixI^S)
491 double precision,
dimension(ixI^S,1:ndir) :: bvec,qvec,current
492 double precision :: integral_grid_mf,tmp(ixI^S),b_mag(ixI^S)
493 integer :: ix^D,i,idirmin,idir,jdir,kdir
495 integral_grid_mf=0.d0
500 bvec(ixi^s,:)=w(ixi^s,mag(:))+block%b0(ixi^s,mag(:),0)
502 bvec(ixi^s,:)=w(ixi^s,mag(:))
506 qvec(ixo^s,1:ndir)=zero
507 do idir=1,ndir;
do jdir=1,ndir;
do kdir=idirmin,3
508 if(lvc(idir,jdir,kdir)/=0)
then
509 tmp(ixo^s)=current(ixo^s,jdir)*bvec(ixo^s,kdir)
510 if(lvc(idir,jdir,kdir)==1)
then
511 qvec(ixo^s,idir)=qvec(ixo^s,idir)+tmp(ixo^s)
513 qvec(ixo^s,idir)=qvec(ixo^s,idir)-tmp(ixo^s)
518 {
do ix^db=ixomin^db,ixomax^db\}
519 if(patchwi(ix^d)) integral_grid_mf=integral_grid_mf+sqrt(sum(qvec(ix^d,:)**2)/&
520 sum(bvec(ix^d,:)**2))*dvolume(ix^d)
525 {
do ix^db=ixomin^db,ixomax^db\}
526 if(patchwi(ix^d)) integral_grid_mf=integral_grid_mf+sqrt(sum(current(ix^d,:)**2))*&
533 bvec(ixi^s,:)=w(ixi^s,mag(:))+block%b0(ixi^s,mag(:),0)
535 bvec(ixi^s,:)=w(ixi^s,mag(:))
537 call divvector(bvec,ixi^l,ixo^l,tmp)
538 {
do ix^db=ixomin^db,ixomax^db\}
539 if(patchwi(ix^d)) integral_grid_mf=integral_grid_mf+abs(tmp(ix^d))*&
540 dvolume(ix^d)**2/sqrt(sum(bvec(ix^d,:)**2))/dsurface(ix^d)
545 bvec(ixi^s,:)=w(ixi^s,mag(:))+block%b0(ixi^s,mag(:),0)
547 bvec(ixi^s,:)=w(ixi^s,mag(:))
549 call curlvector(bvec,ixi^l,ixo^l,current,idirmin,1,ndir)
551 qvec(ixo^s,1:ndir)=zero
552 do idir=1,ndir;
do jdir=1,ndir;
do kdir=idirmin,3
553 if(lvc(idir,jdir,kdir)/=0)
then
554 tmp(ixo^s)=current(ixo^s,jdir)*bvec(ixo^s,kdir)
555 if(lvc(idir,jdir,kdir)==1)
then
556 qvec(ixo^s,idir)=qvec(ixo^s,idir)+tmp(ixo^s)
558 qvec(ixo^s,idir)=qvec(ixo^s,idir)-tmp(ixo^s)
563 {
do ix^db=ixomin^db,ixomax^db\}
564 if(patchwi(ix^d)) integral_grid_mf=integral_grid_mf+sqrt(sum(qvec(ix^d,:)**2))*dvolume(ix^d)
568 end function integral_grid_mf
575 double precision,
intent(in) :: dtfff
576 double precision :: vhatmax,vhatmax_pe,vhatmaxgrid
577 integer :: i,iigrid, igrid
579 vhatmax_pe=smalldouble
580 do iigrid=1,igridstail; igrid=igrids(iigrid);
583 call vhat(ps(igrid)%w,ps(igrid)%x,ixg^
ll,
ixm^
ll,vhatmaxgrid)
584 vhatmax_pe=max(vhatmax_pe,vhatmaxgrid)
586 call mpi_allreduce(vhatmax_pe,vhatmax,1,mpi_double_precision,mpi_max, &
588 do iigrid=1,igridstail; igrid=igrids(iigrid);
597 subroutine vhat(w,x,ixI^L,ixO^L,vhatmaxgrid)
601 integer,
intent(in) :: ixI^L, ixO^L
602 double precision,
intent(inout) :: w(ixI^S,nw)
603 double precision,
intent(in) :: x(ixI^S,1:ndim)
604 double precision,
intent(out) :: vhatmaxgrid
606 double precision :: current(ixI^S,7-2*ndir:3),tmp(ixI^S),dxhm
607 double precision :: dxhms(ixO^S)
608 integer :: idirmin,idir,jdir,kdir
613 do idir=1,ndir;
do jdir=1,ndir;
do kdir=idirmin,3
614 if(
lvc(idir,jdir,kdir)/=0)
then
616 tmp(ixo^s)=current(ixo^s,jdir)*(w(ixo^s,mag(kdir))+
block%b0(ixo^s,kdir,0))
618 tmp(ixo^s)=current(ixo^s,jdir)*w(ixo^s,mag(kdir))
620 if(
lvc(idir,jdir,kdir)==1)
then
621 w(ixo^s,mom(idir))=w(ixo^s,mom(idir))+tmp(ixo^s)
623 w(ixo^s,mom(idir))=w(ixo^s,mom(idir))-tmp(ixo^s)
630 tmp(ixo^s)=1.d0/(sum((w(ixo^s,mag(:))+
block%b0(ixo^s,:,0))**2,dim=ndim+1)+smalldouble)
632 tmp(ixo^s)=1.d0/(sum(w(ixo^s,mag(:))**2,dim=ndim+1)+smalldouble)
638 w(ixo^s,mom(idir))=dxhm*w(ixo^s,mom(idir))*tmp(ixo^s)
641 dxhms(ixo^s)=dble(ndim)/sum(1.d0/
block%dx(ixo^s,:),dim=ndim+1)
643 w(ixo^s,mom(idir))=dxhms(ixo^s)*w(ixo^s,mom(idir))*tmp(ixo^s)
646 vhatmaxgrid=maxval(sqrt(sum(w(ixo^s,mom(:))**2,dim=ndim+1)))
653 integer,
intent(in) :: ixI^L, ixO^L
654 double precision,
intent(in) :: x(ixI^S,1:ndim),qdt,qvmax
655 double precision,
intent(inout) :: w(ixI^S,1:nw)
657 double precision :: dxhm,disbd(6),bfzone^D
658 double precision :: dxhms(ixO^S)
659 integer :: ix^D, idir
663 dxhm=dble(ndim)/(^d&1.0d0/
dxlevel(^d)+)
666 w(ixo^s,mom(:))=w(ixo^s,mom(:))*dxhm
668 dxhms(ixo^s)=dble(ndim)/sum(1.d0/
block%dx(ixo^s,:),dim=ndim+1)
669 dxhms(ixo^s)=
mf_cc*
mf_cy/qvmax*dxhms(ixo^s)/qdt
672 w(ixo^s,mom(idir))=w(ixo^s,mom(idir))*dxhms(ixo^s)
677 bfzone1=0.05d0*(xprobmax1-xprobmin1)
678 bfzone2=0.05d0*(xprobmax2-xprobmin2)
679 bfzone3=0.05d0*(xprobmax3-xprobmin3)
680 {
do ix^db=ixomin^db,ixomax^db\}
681 disbd(1)=x(ix^d,1)-xprobmin1
682 disbd(2)=xprobmax1-x(ix^d,1)
683 disbd(3)=x(ix^d,2)-xprobmin2
684 disbd(4)=xprobmax2-x(ix^d,2)
685 disbd(5)=x(ix^d,3)-xprobmin1
686 disbd(6)=xprobmax3-x(ix^d,3)
689 if(disbd(1)<bfzone1)
then
690 w(ix^d,mom(:))=(1.d0-((bfzone1-disbd(1))/bfzone1)**2)*w(ix^d,mom(:))
693 if(disbd(5)<bfzone3)
then
694 w(ix^d,mom(:))=(1.d0-((bfzone3-disbd(5))/bfzone3)**2)*w(ix^d,mom(:))
697 if(disbd(2)<bfzone1)
then
698 w(ix^d,mom(:))=(1.d0-((bfzone1-disbd(2))/bfzone1)**2)*w(ix^d,mom(:))
700 if(disbd(3)<bfzone2)
then
701 w(ix^d,mom(:))=(1.d0-((bfzone2-disbd(3))/bfzone2)**2)*w(ix^d,mom(:))
703 if(disbd(4)<bfzone2)
then
704 w(ix^d,mom(:))=(1.d0-((bfzone2-disbd(4))/bfzone2)**2)*w(ix^d,mom(:))
706 if(disbd(6)<bfzone3)
then
707 w(ix^d,mom(:))=(1.d0-((bfzone3-disbd(6))/bfzone3)**2)*w(ix^d,mom(:))
713 dxhms(ixo^s)=sqrt(sum(w(ixo^s,mom(:))**2,dim=ndim+1))/
mf_vmax+1.d-12
714 dxhms(ixo^s)=dtanh(dxhms(ixo^s))/dxhms(ixo^s)
716 w(ixo^s,mom(idir))=w(ixo^s,mom(idir))*dxhms(ixo^s)
728 integer,
intent(in) :: idim^LIM
729 double precision,
intent(in) :: qt, qdt
731 integer :: iigrid, igrid
736 do iigrid=1,igridstail; igrid=igrids(iigrid);
737 ps1(igrid)%w=ps(igrid)%w
756 do iigrid=1,igridstail; igrid=igrids(iigrid);
757 ps2(igrid)%w(ixg^t,1:nwflux)=0.75d0*ps(igrid)%w(ixg^t,1:nwflux)+0.25d0*&
758 ps1(igrid)%w(ixg^t,1:nwflux)
759 if (nw>nwflux) ps2(igrid)%w(ixg^t,nwflux+1:nw) = &
760 ps(igrid)%w(ixg^t,nwflux+1:nw)
765 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
766 ps(igrid)%w(ixg^t,1:nwflux)=1.0d0/3.0d0*ps(igrid)%w(ixg^t,1:nwflux)+&
767 2.0d0/3.0d0*ps2(igrid)%w(ixg^t,1:nwflux)
772 call mpistop(
"unkown time_stepper in advectmf")
777 subroutine advect1mf(method,dtin,dtfactor,idim^LIM,qtC,psa,qt,psb)
785 integer,
intent(in) :: idim^LIM
786 type(state) :: psa(max_blocks)
787 type(state) :: psb(max_blocks)
788 double precision,
intent(in) :: dtin,dtfactor, qtC, qt
789 integer,
intent(in) :: method(nlevelshi)
791 double precision :: qdt
792 integer :: iigrid, igrid, level, i^D
799 do iigrid=1,igridstail; igrid=igrids(iigrid);
804 psa(igrid)%w,qt,psb(igrid)%w)
844 integer,
intent(in) :: method
845 integer,
intent(in) :: igrid, ixG^L, idim^LIM
846 double precision,
intent(in) :: qdt, qtC, qt
847 double precision :: wCT(ixG^S,1:nw), w(ixG^S,1:nw)
848 double precision :: dx^D, fC(ixG^S,1:ndir,1:ndim)
855 ixo^l=ixg^l^lsubnghostcells;
861 call centdiff4mf(qdt,ixg^l,ixo^l,idim^lim,qtc,wct,qt,w,fc,dx^d,ps(igrid)%x)
866 call tvdlfmf(qdt,ixg^l,ixo^l,idim^lim,qtc,wct,qt,w,fc,dx^d,ps(igrid)%x)
869 call hancockmf(qdt,ixg^l,ixo^l,idim^lim,qtc,wct,qt,w,dx^d,ps(igrid)%x)
874 call fdmf(qdt,ixg^l,ixo^l,idim^lim,qtc,wct,qt,w,fc,dx^d,ps(igrid)%x)
876 call mpistop(
"unknown flux scheme in advect1_gridmf")
885 subroutine upwindlrmf(ixI^L,ixL^L,ixR^L,idim,w,wCT,wLC,wRC,x)
891 integer,
intent(in) :: ixI^L, ixL^L, ixR^L, idim
892 double precision,
dimension(ixI^S,1:nw) :: w, wCT
893 double precision,
dimension(ixI^S,1:nw) :: wLC, wRC
894 double precision,
dimension(ixI^S,1:ndim) :: x
896 double precision :: ldw(ixI^S), rdw(ixI^S), dwC(ixI^S)
897 integer :: jxR^L, ixC^L, jxC^L, iw
900 call mp5limiter(ixi^l,ixl^l,idim,w,wlc,wrc)
902 call ppmlimiter(ixi^l,
ixm^
ll,idim,w,wct,wlc,wrc)
904 jxr^l=ixr^l+
kr(idim,^
d);
905 ixcmax^
d=jxrmax^
d; ixcmin^
d=ixlmin^
d-
kr(idim,^
d);
906 jxc^l=ixc^l+
kr(idim,^
d);
910 w(ixcmin^
d:jxcmax^
d,iw)=dlog10(w(ixcmin^
d:jxcmax^
d,iw))
911 wlc(ixl^s,iw)=dlog10(wlc(ixl^s,iw))
912 wrc(ixr^s,iw)=dlog10(wrc(ixr^s,iw))
915 dwc(ixc^s)=w(jxc^s,iw)-w(ixc^s,iw)
919 wlc(ixl^s,iw)=wlc(ixl^s,iw)+half*ldw(ixl^s)
920 wrc(ixr^s,iw)=wrc(ixr^s,iw)-half*rdw(jxr^s)
923 w(ixcmin^
d:jxcmax^
d,iw)=10.0d0**w(ixcmin^
d:jxcmax^
d,iw)
924 wlc(ixl^s,iw)=10.0d0**wlc(ixl^s,iw)
925 wrc(ixr^s,iw)=10.0d0**wrc(ixr^s,iw)
937 integer,
intent(in) :: ixI^L, ixO^L, idir, idim
938 double precision,
intent(in) :: w(ixI^S,nw)
939 double precision,
intent(in) :: x(ixI^S,1:ndim)
940 double precision,
intent(out) :: f(ixI^S)
947 f(ixo^s)=w(ixo^s,mom(idim))*w(ixo^s,mag(idir))-w(ixo^s,mag(idim))*w(ixo^s,mom(idir))
950 +w(ixo^s,mom(idim))*
block%B0(ixo^s,idir,idim)&
951 -w(ixo^s,mom(idir))*
block%B0(ixo^s,idim,idim)
957 subroutine tvdlfmf(qdt,ixI^L,ixO^L,idim^LIM,qtC,wCT,qt,wnew,fC,dx^D,x)
963 double precision,
intent(in) :: qdt, qtC, qt, dx^D
964 integer,
intent(in) :: ixI^L, ixO^L, idim^LIM
965 double precision,
dimension(ixI^S,1:ndim),
intent(in) :: x
966 double precision,
dimension(ixI^S,1:nw) :: wCT, wnew
967 double precision,
dimension(ixI^S,1:ndir,1:ndim) :: fC
969 double precision,
dimension(ixI^S,1:nw) :: wLC, wRC, wmean
970 double precision,
dimension(ixI^S) :: fLC, fRC
971 double precision,
dimension(ixI^S) :: cmaxC
972 double precision :: dxinv(1:ndim), inv_volume(ixO^S)
973 integer :: idims, idir, ix^L, hxO^L, ixC^L, ixCR^L, jxC^L, kxC^L, kxR^L
979 ix^l=ix^l^ladd2*
kr(idims,^d);
981 if (ixi^l^ltix^l|.or.|.or.) &
982 call mpistop(
"Error in tvdlfmf: Nonconforming input limits")
984 ^d&dxinv(^d)=-qdt/dx^d;
989 hxo^l=ixo^l-
kr(idims,^d);
991 ixcmax^d=ixomax^d; ixcmin^d=hxomin^d;
993 jxc^l=ixc^l+
kr(idims,^d);
994 kxcmin^d=iximin^d; kxcmax^d=iximax^d-
kr(idims,^d);
995 kxr^l=kxc^l+
kr(idims,^d);
998 wrc(kxc^s,1:nwflux)=wct(kxr^s,1:nwflux)
999 wlc(kxc^s,1:nwflux)=wct(kxc^s,1:nwflux)
1001 call upwindlrmf(ixi^l,ixcr^l,ixcr^l,idims,wct,wct,wlc,wrc,x)
1006 wmean=0.5d0*(wlc+wrc)
1014 flc(ixc^s)=half*(flc(ixc^s)+frc(ixc^s))
1017 if (idir==idims)
then
1018 flc(ixc^s)=flc(ixc^s)-
mf_tvdlfeps*
tvdlfeps*cmaxc(ixc^s)*half*(wrc(ixc^s,mag(idir))-wlc(ixc^s,mag(idir)))
1021 fc(ixc^s,idir,idims)=flc(ixc^s)
1023 fc(ixc^s,idir,idims)=
block%surfaceC(ixc^s,idims)*flc(ixc^s)
1032 hxo^l=ixo^l-
kr(idims,^d);
1035 fc(ixi^s,:,idims)=dxinv(idims)*fc(ixi^s,:,idims)
1036 wnew(ixo^s,mag(:))=wnew(ixo^s,mag(:)) &
1037 + (fc(ixo^s,:,idims)-fc(hxo^s,:,idims))
1039 inv_volume = 1.0d0/
block%dvolume(ixo^s)
1040 fc(ixi^s,:,idims)=-qdt*fc(ixi^s,:,idims)
1043 wnew(ixo^s,mag(idir))=wnew(ixo^s,mag(idir)) + (fc(ixo^s,idir,idims)-fc(hxo^s,idir,idims)) * &
1051 call divbclean(qdt,ixi^l,ixo^l,wct,wnew,x)
1055 subroutine hancockmf(qdt,ixI^L,ixO^L,idim^LIM,qtC,wCT,qt,wnew,dx^D,x)
1064 integer,
intent(in) :: ixI^L, ixO^L, idim^LIM
1065 double precision,
intent(in) :: qdt, qtC, qt, dx^D, x(ixI^S,1:ndim)
1066 double precision,
intent(inout) :: wCT(ixI^S,1:nw), wnew(ixI^S,1:nw)
1068 double precision,
dimension(ixI^S,1:nw) :: wLC, wRC
1069 double precision,
dimension(ixI^S) :: fLC, fRC
1070 double precision :: dxinv(1:ndim)
1071 integer :: idims, idir, ix^L, hxO^L, ixtest^L
1076 ix^l=ix^l^laddkr(idims,^d);
1078 if (ixi^l^ltix^l|.or.|.or.) &
1079 call mpistop(
"Error in Hancockmf: Nonconforming input limits")
1081 ^d&dxinv(^d)=-qdt/dx^d;
1087 hxo^l=ixo^l-
kr(idims,^d);
1089 wrc(hxo^s,1:nwflux)=wct(ixo^s,1:nwflux)
1090 wlc(ixo^s,1:nwflux)=wct(ixo^s,1:nwflux)
1092 call upwindlrmf(ixi^l,ixo^l,hxo^l,idims,wct,wct,wlc,wrc,x)
1097 call getfluxmf(wrc,x,ixi^l,hxo^l,idir,idims,frc)
1098 call getfluxmf(wlc,x,ixi^l,ixo^l,idir,idims,flc)
1101 wnew(ixo^s,mag(idir))=wnew(ixo^s,mag(idir))+dxinv(idims)* &
1102 (flc(ixo^s)-frc(hxo^s))
1104 wnew(ixo^s,mag(idir))=wnew(ixo^s,mag(idir))-qdt/
block%dvolume(ixo^s) &
1105 *(
block%surfaceC(ixo^s,idims)*flc(ixo^s) &
1106 -
block%surfaceC(hxo^s,idims)*frc(hxo^s))
1116 subroutine fdmf(qdt,ixI^L,ixO^L,idim^LIM,qtC,wCT,qt,wnew,fC,dx^D,x)
1118 double precision,
intent(in) :: qdt, qtC, qt, dx^D
1119 integer,
intent(in) :: ixI^L, ixO^L, idim^LIM
1120 double precision,
dimension(ixI^S,1:ndim),
intent(in) :: x
1122 double precision,
dimension(ixI^S,1:nw),
intent(inout) :: wCT, wnew
1123 double precision,
dimension(ixI^S,1:ndir,1:ndim),
intent(out) :: fC
1125 double precision,
dimension(ixI^S) :: fCT
1126 double precision,
dimension(ixI^S,1:nw) :: fm, fp, fmR, fpL
1127 double precision,
dimension(ixI^S) :: v
1128 double precision :: dxinv(1:ndim)
1129 integer :: idims, idir, ixC^L, ix^L, hxO^L, ixCR^L
1131 ^d&dxinv(^d)=-qdt/dx^d;
1138 hxo^l=ixo^l-
kr(idims,^d);
1140 ixmax^d=ixomax^d; ixmin^d=hxomin^d;
1144 call getfluxmf(wct,x,ixg^
ll,ixcr^l,idir,idims,fct)
1156 fc(ix^s,idir,idims) = dxinv(idims) * (fpl(ix^s,mag(idir)) + fmr(ix^s,mag(idir)))
1157 wnew(ixo^s,mag(idir))=wnew(ixo^s,mag(idir))+ &
1158 (fc(ixo^s,idir,idims)-fc(hxo^s,idir,idims))
1160 fc(ix^s,idir,idims)=-qdt*
block%surfaceC(ix^s,idims) * (fpl(ix^s,mag(idir)) + fmr(ix^s,mag(idir)))
1161 wnew(ixo^s,mag(idir))=wnew(ixo^s,mag(idir))+ &
1162 (fc(ixo^s,idir,idims)-fc(hxo^s,idir,idims))/
block%dvolume(ixo^s)
1169 call divbclean(qdt,ixi^l,ixo^l,wct,wnew,x)
1177 integer,
intent(in) :: ixI^L, iL^L, idims
1178 double precision,
intent(in) :: w(ixI^S,1:nw)
1180 double precision,
intent(out) :: wLC(ixI^S,1:nw)
1182 double precision :: ldw(ixI^S), dwC(ixI^S)
1183 integer :: jxR^L, ixC^L, jxC^L, kxC^L, iw
1187 call mp5limiterl(ixi^l,il^l,idims,w,wlc)
1189 call weno5limiterl(ixi^l,il^l,idims,w,wlc,1)
1191 call weno5limiterl(ixi^l,il^l,idims,w,wlc,2)
1194 kxcmin^
d=iximin^
d; kxcmax^
d=iximax^
d-
kr(idims,^
d);
1196 wlc(kxc^s,1:nwflux) = w(kxc^s,1:nwflux)
1198 jxr^l=il^l+
kr(idims,^
d);
1200 ixcmax^
d=jxrmax^
d; ixcmin^
d=ilmin^
d-
kr(idims,^
d);
1201 jxc^l=ixc^l+
kr(idims,^
d);
1204 dwc(ixc^s)=w(jxc^s,iw)-w(ixc^s,iw)
1208 wlc(il^s,iw)=wlc(il^s,iw)+half*ldw(il^s)
1218 integer,
intent(in) :: ixI^L, iL^L, idims
1219 double precision,
intent(in) :: w(ixI^S,1:nw)
1221 double precision,
intent(out) :: wRC(ixI^S,1:nw)
1223 double precision :: rdw(ixI^S), dwC(ixI^S)
1224 integer :: jxR^L, ixC^L, jxC^L, kxC^L, kxR^L, iw
1228 call mp5limiterr(ixi^l,il^l,idims,w,wrc)
1230 call weno5limiterr(ixi^l,il^l,idims,w,wrc,1)
1232 call weno5limiterr(ixi^l,il^l,idims,w,wrc,2)
1235 kxcmin^
d=iximin^
d; kxcmax^
d=iximax^
d-
kr(idims,^
d);
1236 kxr^l=kxc^l+
kr(idims,^
d);
1238 wrc(kxc^s,1:nwflux)=w(kxr^s,1:nwflux)
1240 jxr^l=il^l+
kr(idims,^
d);
1241 ixcmax^
d=jxrmax^
d; ixcmin^
d=ilmin^
d-
kr(idims,^
d);
1242 jxc^l=ixc^l+
kr(idims,^
d);
1245 dwc(ixc^s)=w(jxc^s,iw)-w(ixc^s,iw)
1248 wrc(il^s,iw)=wrc(il^s,iw)-half*rdw(jxr^s)
1254 subroutine centdiff4mf(qdt,ixI^L,ixO^L,idim^LIM,qtC,wCT,qt,w,fC,dx^D,x)
1263 integer,
intent(in) :: ixI^L, ixO^L, idim^LIM
1264 double precision,
intent(in) :: qdt, qtC, qt, dx^D
1265 double precision :: wCT(ixI^S,1:nw), w(ixI^S,1:nw)
1266 double precision,
intent(in) :: x(ixI^S,1:ndim)
1267 double precision :: fC(ixI^S,1:ndir,1:ndim)
1269 double precision :: v(ixI^S,ndim), f(ixI^S)
1270 double precision,
dimension(ixI^S,1:nw) :: wLC, wRC
1271 double precision,
dimension(ixI^S) :: vLC, vRC,cmaxLC,cmaxRC
1272 double precision :: dxinv(1:ndim)
1273 integer :: idims, idir, idirmin,ix^D
1274 integer :: ix^L, hxO^L, ixC^L, jxC^L, hxC^L, kxC^L, kkxC^L, kkxR^L
1279 ix^l=ix^l^ladd2*
kr(idims,^d);
1282 if (ixi^l^ltix^l|.or.|.or.)
then
1283 call mpistop(
"Error in evolve_CentDiff4: Non-conforming input limits")
1285 ^d&dxinv(^d)=-qdt/dx^d;
1290 ix^l=ixo^l^ladd2*
kr(idims,^d);
1291 hxo^l=ixo^l-
kr(idims,^d);
1293 ixcmin^d=hxomin^d; ixcmax^d=ixomax^d;
1294 hxc^l=ixc^l-
kr(idims,^d);
1295 jxc^l=ixc^l+
kr(idims,^d);
1296 kxc^l=ixc^l+2*
kr(idims,^d);
1298 kkxcmin^d=iximin^d; kkxcmax^d=iximax^d-
kr(idims,^d);
1299 kkxr^l=kkxc^l+
kr(idims,^d);
1300 wrc(kkxc^s,1:nwflux)=wct(kkxr^s,1:nwflux)
1301 wlc(kkxc^s,1:nwflux)=wct(kkxc^s,1:nwflux)
1303 call upwindlrmf(ixi^l,ixc^l,ixc^l,idims,wct,wct,wlc,wrc,x)
1309 vlc(ixc^s)=max(cmaxrc(ixc^s),cmaxlc(ixc^s))
1313 call getfluxmf(wct,x,ixi^l,ix^l,idir,idims,f)
1316 fc(ixc^s,idir,idims)=(-f(kxc^s)+7.0d0*(f(jxc^s)+f(ixc^s))-f(hxc^s))/12.0d0
1321 *(wrc(ixc^s,mag(idir))-wlc(ixc^s,mag(idir)))
1324 fc(ixc^s,idir,idims)=dxinv(idims)*fc(ixc^s,idir,idims)
1326 w(ixo^s,mag(idir))=w(ixo^s,mag(idir))+(fc(ixo^s,idir,idims)-fc(hxo^s,idir,idims))
1328 fc(ixc^s,idir,idims)=-qdt*
block%surfaceC(ixc^s,idims)*fc(ixc^s,idir,idims)
1329 w(ixo^s,mag(idir))=w(ixo^s,mag(idir))+ &
1330 (fc(ixo^s,idir,idims)-fc(hxo^s,idir,idims))/
block%dvolume(ixo^s)
1345 integer,
intent(in) :: ixI^L, ixO^L
1346 double precision,
intent(in) :: x(ixI^S,1:ndim)
1347 double precision,
intent(inout) :: w(ixI^S,1:nw), dtnew
1349 double precision :: courantmax, dxinv(1:ndim)
1350 double precision :: cmax(ixI^S),tmp(ixI^S),alfven(ixI^S)
1361 tmp(ixo^s)=cmax(ixo^s)/
block%dx(ixo^s,idims)
1362 courantmax=max(courantmax,maxval(tmp(ixo^s)))
1364 tmp(ixo^s)=cmax(ixo^s)*dxinv(idims)
1365 courantmax=max(courantmax,maxval(tmp(ixo^s)))
1369 if (courantmax>smalldouble) dtnew=min(dtnew,
mf_cc/courantmax)
1376 logical :: new_cmax,needcmin
1377 integer,
intent(in) :: ixI^L, ixO^L, idims
1378 double precision,
intent(in) :: w(ixI^S,1:nw)
1379 double precision,
intent(out) :: cmax(ixI^S)
1383 cmax(ixo^s)=sqrt(sum((w(ixo^s,mag(:))+
block%b0(ixo^s,:,0))**2,dim=
ndim+1)/w(ixo^s,rho_))
1385 cmax(ixo^s)=sqrt(sum(w(ixo^s,mag(:))**2,dim=
ndim+1)/w(ixo^s,rho_))
1387 cmax(ixo^s)=cmax(ixo^s)+abs(w(ixo^s,mom(idims)))
1396 integer,
intent(in) :: ixI^L, ixO^L
1397 double precision,
intent(in) :: x(ixI^S,1:ndim),wCT(ixI^S,1:nw),qdt
1398 double precision,
intent(inout) :: w(ixI^S,1:nw)
1399 double precision :: divb(ixI^S),graddivb(ixI^S),bdivb(ixI^S,1:ndir)
1400 integer :: idims, ix^L, ixp^L, i^D, iside
1411 call gradient(divb,ixi^l,ixp^l,idims,graddivb)
1417 graddivb(ixp^s)=graddivb(ixp^s)*
mf_cdivb &
1418 /(^d&1.0d0/
block%dx(ixp^s,^d)**2+)
1425 w(ixp^s,mag(idims))=w(ixp^s,mag(idims))+&
1436 integer,
intent(in) :: ixI^L, ixO^L
1437 double precision,
intent(in) :: qdt, x(ixI^S,1:ndim)
1438 double precision,
intent(inout) :: wCT(ixI^S,1:nw), w(ixI^S,1:nw)
1440 double precision :: tmp(ixI^S)
1442 integer :: mr_,mphi_
1443 integer :: br_,bphi_
1445 mr_=mom(1); mphi_=mom(1)-1+
phi_
1446 br_=mag(1); bphi_=mag(1)-1+
phi_
1452 tmp(ixo^s)=(wct(ixo^s,bphi_)*wct(ixo^s,mom(1)) &
1453 -wct(ixo^s,br_)*wct(ixo^s,mom(3)))
1454 w(ixo^s,bphi_)=w(ixo^s,bphi_)+qdt*tmp(ixo^s)/x(ixo^s,1)
1460 tmp(ixo^s)= wct(ixo^s,mom(1))*wct(ixo^s,mag(2)) &
1461 -wct(ixo^s,mom(2))*wct(ixo^s,mag(1))
1463 tmp(ixo^s)=tmp(ixo^s)+wct(ixo^s,mom(1))*
block%b0(ixo^s,2,0) &
1464 -wct(ixo^s,mom(2))*
block%b0(ixo^s,1,0)
1467 w(ixo^s,mag(2))=w(ixo^s,mag(2))+qdt*tmp(ixo^s)/x(ixo^s,1)
1472 tmp(ixo^s)=wct(ixo^s,mom(1))*wct(ixo^s,mag(3)) &
1473 -wct(ixo^s,mom(3))*wct(ixo^s,mag(1)){^nooned &
1474 -(wct(ixo^s,mom(3))*wct(ixo^s,mag(2)) &
1475 -wct(ixo^s,mom(2))*wct(ixo^s,mag(3)))*dcos(x(ixo^s,2)) &
1478 tmp(ixo^s)=tmp(ixo^s)+wct(ixo^s,mom(1))*
block%b0(ixo^s,3,0) &
1479 -wct(ixo^s,mom(3))*
block%b0(ixo^s,1,0){^nooned &
1480 -(wct(ixo^s,mom(3))*
block%b0(ixo^s,2,0) &
1481 -wct(ixo^s,mom(2))*
block%b0(ixo^s,3,0))*dcos(x(ixo^s,2)) &
1485 w(ixo^s,mag(3))=w(ixo^s,mag(3))+qdt*tmp(ixo^s)/x(ixo^s,1)
1498 integer :: ixO^L, idirmin, ixI^L
1499 double precision :: w(ixI^S,1:nw)
1502 double precision :: current(ixI^S,7-2*ndir:3),bvec(ixI^S,1:ndir)
1507 bvec(ixi^s,1:ndir)=w(ixi^s,mag(1:ndir))
1509 call curlvector(bvec,ixi^l,ixo^l,current,idirmin,idirmin0,ndir)
1511 if(
b0field) current(ixo^s,idirmin0:3)=current(ixo^s,idirmin0:3)+&
1512 block%J0(ixo^s,idirmin0:3)
1521 integer,
intent(in) :: ixI^L, ixO^L
1522 double precision,
intent(in) :: w(ixI^S,1:nw)
1523 double precision :: divb(ixI^S)
1525 double precision :: bvec(ixI^S,1:ndir)
1527 bvec(ixi^s,:)=w(ixi^s,mag(:))
subroutine, public resettree
reset AMR and (de)allocate boundary flux storage at level changes
subroutine, public mpistop(message)
Exit MPI-AMRVAC with an error message.
Module for flux conservation near refinement boundaries.
subroutine, public init_comm_fix_conserve(idimlim, nwfluxin)
subroutine, public recvflux(idimlim)
subroutine, public sendflux(idimlim)
subroutine, public store_flux(igrid, fc, idimlim, nwfluxin)
subroutine, public fix_conserve(psb, idimlim, nw0, nwfluxin)
Module with geometry-related routines (e.g., divergence, curl)
subroutine divvector(qvec, ixil, ixol, divq, nth_in)
integer, parameter spherical
integer, parameter cylindrical
subroutine curlvector(qvec, ixil, ixol, curlvec, idirmin, idirmin0, ndir0, fourthorder)
Calculate curl of a vector qvec within ixL Options to employ standard second order CD evaluations use...
subroutine gradient(q, ixil, ixol, idir, gradq, nth_in)
subroutine divvectors(qvec, ixil, ixol, divq)
Calculate divergence of a vector qvec within ixL using limited extrapolation to cell edges.
update ghost cells of all blocks including physical boundaries
integer, dimension(0:3^d &), target type_recv_p_p1
integer, dimension( :^d &), pointer type_recv_r
integer, dimension(-1:1^d &), target type_send_srl_p1
integer, dimension(-1:1^d &), target type_send_r_p2
subroutine getbc(time, qdt, psb, nwstart, nwbc)
do update ghost cells of all blocks including physical boundaries
integer, dimension(0:3^d &), target type_send_p_f
subroutine create_bc_mpi_datatype(nwstart, nwbc, nwfull)
integer, dimension( :^d &), pointer type_send_p
integer, dimension(0:3^d &), target type_recv_p_p2
integer, dimension( :^d &), pointer type_send_srl
integer, dimension(-1:1^d &), target type_send_r_p1
integer, dimension(-1:1^d &), target type_send_srl_p2
integer, dimension(0:3^d &), target type_send_p_p2
integer, dimension(0:3^d &), target type_recv_r_f
integer, dimension(-1:1^d &), target type_recv_srl_f
integer, dimension(-1:1^d &), target type_send_r_f
integer, dimension(-1:1^d &), target type_send_srl_f
integer, dimension(0:3^d &), target type_send_p_p1
integer, dimension( :^d &), pointer type_send_r
integer, dimension(0:3^d &), target type_recv_r_p1
integer, dimension(0:3^d &), target type_recv_r_p2
integer, dimension(-1:1^d &), target type_recv_srl_p2
integer, dimension( :^d &), pointer type_recv_p
integer, dimension(-1:1^d &), target type_recv_srl_p1
integer, dimension(0:3^d &), target type_recv_p_f
integer, dimension( :^d &), pointer type_recv_srl
This module contains definitions of global parameters and variables and some generic functions/subrou...
type(state), pointer block
Block pointer for using one block and its previous state.
double precision tvdlfeps
integer, dimension(:), allocatable typepred1
The spatial discretization for the predictor step when using a two step PC method.
integer, parameter fs_tvdlf
integer, dimension(3, 3, 3) lvc
Levi-Civita tensor.
integer, parameter unitpar
file handle for IO
double precision global_time
The global simulation time.
integer istep
Index of the sub-step in a multi-step time integrator.
integer, dimension(3, 3) kr
Kronecker delta tensor.
integer, parameter threestep
integer snapshotini
Resume from the snapshot with this index.
integer it
Number of time steps taken.
logical, dimension(:), allocatable loglimit
integer ditregrid
Reconstruct the AMR grid once every ditregrid iteration(s)
integer, parameter ndim
Number of spatial dimensions for grid variables.
logical stagger_grid
True for using stagger grid.
double precision cmax_global
global fastest wave speed needed in fd scheme and glm method
character(len=std_len), dimension(:), allocatable par_files
Which par files are used as input.
integer icomm
The MPI communicator.
integer b0i
background magnetic field location indicator
integer mype
The rank of the current MPI task.
character(len=std_len) typediv
integer, parameter plevel_
double precision dt
global time step
integer ndir
Number of spatial dimensions (components) for vector variables.
integer ixm
the mesh range of a physical block without ghost cells
integer ierrmpi
A global MPI error return code.
integer, dimension(:), allocatable flux_method
Which flux scheme of spatial discretization to use (per grid level)
double precision, dimension(:), allocatable, parameter d
logical slab
Cartesian geometry or not.
double precision unit_velocity
Physical scaling factor for velocity.
logical prolongprimitive
prolongate primitive variables in level-jump ghost cells
logical b0field
split magnetic field as background B0 field
double precision, dimension(:,:), allocatable rnode
Corner coordinates.
integer, dimension(:), allocatable type_limiter
Type of slope limiter used for reconstructing variables on cell edges.
integer, parameter twostep
integer, parameter onestep
integer nghostcells
Number of ghost cells surrounding a grid.
double precision, dimension(^nd) dxlevel
store unstretched cell size of current level
integer t_stepper
time stepper type
integer, parameter fs_cd4
logical slab_uniform
uniform Cartesian geometry or not (stretched Cartesian)
character(len=std_len) base_filename
Base file name for simulation output, which will be followed by a number.
integer refine_max_level
Maximal number of AMR levels.
integer, parameter fs_hancock
integer, dimension(:,:), allocatable node
Module with slope/flux limiters.
integer, parameter limiter_ppm
subroutine dwlimiter2(dwc, ixil, ixcl, idims, typelim, ldw, rdw)
Limit the centered dwC differences within ixC for iw in direction idim. The limiter is chosen accordi...
integer, parameter limiter_weno5
integer, parameter limiter_wenoz5
integer, parameter limiter_mp5
module mod_magnetofriction.t Purpose: use magnetofrictional method to relax 3D magnetic field to forc...
subroutine fdmf(qdt, ixil, ixol, idimlim, qtc, wct, qt, wnew, fc, dxd, x)
subroutine getdtfff_courant(w, x, ixil, ixol, dtnew)
subroutine hancockmf(qdt, ixil, ixol, idimlim, qtc, wct, qt, wnew, dxd, x)
subroutine getfluxmf(w, x, ixil, ixol, idir, idim, f)
subroutine magnetofriction
subroutine reconstructrmf(ixil, ill, idims, w, wrc)
subroutine getcmaxfff(w, ixil, ixol, idims, cmax)
subroutine divbclean(qdt, ixil, ixol, wct, w, x)
Clean divergence of magnetic field by Janhunen's and Linde's source terms.
subroutine centdiff4mf(qdt, ixil, ixol, idimlim, qtc, wct, qt, w, fc, dxd, x)
double precision mf_tvdlfeps
TVDLF dissipation coefficient controls the dissipation term.
character(len=16) mf_log_mode
How to open the MF diagnostics CSV: auto, append, or replace.
subroutine magnetofriction_init()
Initialize the module.
double precision, public mf_vmax
maximal limit of magnetofrictional velocity in cm s^-1 (Pomoell 2019 A&A)
subroutine vhat(w, x, ixil, ixol, vhatmaxgrid)
double precision tmf
time in magnetofriction process
subroutine get_current(w, ixil, ixol, idirmin, current)
Calculate idirmin and the idirmin:3 components of the common current array make sure that dxlevel(^D)...
double precision mf_cy_max
subroutine addgeometrymf(qdt, ixil, ixol, wct, w, x)
logical mf_continue_run
Whether this run continues an existing MF diagnostics series.
subroutine frictional_velocity(w, x, ixil, ixol, qvmax, qdt)
double precision mf_cdivb
divb cleaning coefficient controls diffusion speed of divb
subroutine upwindlrmf(ixil, ixll, ixrl, idim, w, wct, wlc, wrc, x)
subroutine mf_velocity_update(dtfff)
double precision cmax_mype
maximal speed for fd scheme
subroutine process1_gridmf(method, igrid, qdt, ixgl, idimlim, qtc, wct, qt, w)
subroutine advect1mf(method, dtin, dtfactor, idimlim, qtc, psa, qt, psb)
double precision mf_cy
frictional velocity coefficient
logical fix_conserve_at_step
subroutine advectmf(idimlim, qt, qdt)
double precision mf_tvdlfeps_min
character(len=256) mf_log_filename
Optional diagnostics filename; empty uses <base_filename>_mflog.csv.
subroutine tvdlfmf(qdt, ixil, ixol, idimlim, qtc, wct, qt, wnew, fc, dxd, x)
double precision mf_cdivb_max
double precision mf_cc
stability coefficient controls numerical stability
subroutine mf_params_read(files)
Read this module"s parameters from a file.
double precision cmax_global
maximal speed for fd scheme
subroutine reconstructlmf(ixil, ill, idims, w, wlc)
logical mf_write_detailed_history
Write the legacy, method-specific MF diagnostics history.
subroutine get_divb(w, ixil, ixol, divb)
Calculate div B within ixO.
Common user-facing diagnostics for NLFFF relaxation and extrapolation.
subroutine, public write_nlfff_metrics_header(unit)
subroutine, public write_nlfff_metrics_row(unit, iteration, metrics)
subroutine, public evaluate_nlfff_metrics_amrvac(iw_b, metrics)
Evaluate the common metrics on all active AMRVAC cells. The local cell size makes epsilon_force and e...
This module defines the procedures of a physics module. It contains function pointers for the various...
procedure(sub_convert), pointer phys_to_primitive
procedure(sub_convert), pointer phys_to_conserved
Module with all the methods that users can customize in AMRVAC.
procedure(p_no_args), pointer usr_before_main_loop