
// ----------------------------------------------------------------- //
//                ____           __          __                      //
//               /  _/___  _____/ /_  ______/ /__  _____             //
//               / // __ \/ ___/ / / / / __  / _ \/ ___/             //
//             _/ // / / / /__/ / /_/ / /_/ /  __(__  )              //
//            /___/_/ /_/\___/_/\__,_/\__,_/\___/____/               //
//                                                                   //
// ----------------------------------------------------------------- //

Include "scif_decay_parameters.pro" ;

// ----------------------------------------------------------------- //
//       ____                                  __                    //
//      / __ \____  _________  ____ ___  ___  / /____  __________    //
//     / /_/ / __ `/ ___/ __ `/ __ `__ \/ _ \/ __/ _ \/ ___/ ___/    //
//    / ____/ /_/ / /  / /_/ / / / / / /  __/ /_/  __/ /  (__  )     //
//   /_/    \__,_/_/   \__,_/_/ /_/ /_/\___/\__/\___/_/  /____/      //
//                                                                   //
// ----------------------------------------------------------------- //

// REBCO tape parameters ------------------------------------------- //

TAPE_WIDTH	     =   4. * MM ; // Width of the REBCO tape
TAPE_THICKNESS       = 140. * UM ; // Total thickness of the REBCO tape
REBCO_THICKNESS      =   1. * UM ; // Thickness of the REBCO      layer
COPPER_THICKNESS     =  20. * UM ; //     "     "   "  copper       "
INSULATION_THICKNESS =  20. * UM ; //     "     "   "  insulation   "
HASTELLOY_THICKNESS  =  70. * UM ; //     "     "   "  Hastelloy    "

// Coil parameters ------------------------------------------------- //

INNER_RADIUS = 59. * MM ; // Inner coil radius

// Mesh parameters ------------------------------------------------- //

NB_OF_TAPE_DIVS = 100  ; // Mesh divisions across the tape width
TAPE_MESH_BUMP  = 125. ; // Mesh concentration factor at the tape edges

// Construction lines :
// Construction lines are embeded in the air domain between the REBCO
// tapes in order to limit the number of very small mesh elements near
// their edges. "CONSTRUCTION_LINE_DEPTH" gives the length of the 
// construction lines as a ratio with the half-width of the REBCO tape.

CONSTRUCTION_LINE_DEPTH = 0.05 ; // Length of construction line
CONSTRUCTION_LINE_DIVS  = 6    ; // Number of divisions on each line

// Use older .msh file version for compatibility with GetDP 2.11.3 - //

Mesh.MshFileVersion = 2 ;

// ----------------------------------------------------------------- //
//            ______                          __                     //
//           / ____/__  ____  ____ ___  ___  / /________  __         //
//          / / __/ _ \/ __ \/ __ `__ \/ _ \/ __/ ___/ / / /         //
//         / /_/ /  __/ /_/ / / / / / /  __/ /_/ /  / /_/ /          //
//         \____/\___/\____/_/ /_/ /_/\___/\__/_/   \__, /           //
//                                                 /____/            //
//                                                                   //
// ----------------------------------------------------------------- //

xct = INNER_RADIUS + INSULATION_THICKNESS + COPPER_THICKNESS 
      + REBCO_THICKNESS / 2. ;
yct = 0. ;
lxt = REBCO_THICKNESS ;
lyt = TAPE_WIDTH ;
lct = 2. * lyt / NB_OF_TAPE_DIVS ;

pc = newp ;
Point( pc   ) = { xct - lxt / 2. , 0.             , 0. , lct } ;
Point( pc+1 ) = { xct + lxt / 2. , 0.             , 0. , lct } ;
Point( pc+2 ) = { xct + lxt / 2. , yct + lyt / 2. , 0. , lxt } ;
Point( pc+3 ) = { xct - lxt / 2. , yct + lyt / 2. , 0. , lxt } ;
lc = newl ;
Line( lc   ) = { pc   , pc+1 } ;
Line( lc+1 ) = { pc+1 , pc+2 } ;
Line( lc+2 ) = { pc+2 , pc+3 } ;
Line( lc+3 ) = { pc+3 , pc   } ;
llc = newll ;
Line Loop( llc ) = { lc:lc+3 } ;
sc = news ;
Plane Surface( sc ) = { llc } ;

Transfinite Line { lc   , -(lc+2) } = 1. ;
Transfinite Line { lc+1 , -(lc+3) } = Ceil[ NB_OF_TAPE_DIVS / 2 ] Using Progression 0.9 ;
Transfinite Surface { sc } ;
Recombine Surface { sc } ;

r_int = AIR_DOMAIN_R_INT ;
lca   = ( AIR_DOMAIN_R_EXT - AIR_DOMAIN_R_INT ) / 2. ; 

pa = newp ;
Point( pa   ) = { 0.    ,  0.    , 0. , lca } ;
Point( pa+1 ) = { r_int ,  0.    , 0. , lca } ;
Point( pa+2 ) = { 0.    ,  r_int , 0. , lca } ;
la = newl ;
Line( la   )   = { pa   , pc   } ;
Line( la+1 )   = { pc+1 , pa+1 } ;
Circle( la+2 ) = { pa+1 , pa , pa+2 } ;
Line( la+3 )   = { pa+2 , pa   } ;
lla = newll ;
Line Loop( lla ) = { la , -(lc+3) , -(lc+2) , -(lc+1) , la+1:la+3  } ;
sa = news ;
Plane Surface( sa ) = { lla } ;

r_ext = AIR_DOMAIN_R_EXT ;

pi = newp ;
Point( pi   ) = { r_ext ,  0.    , 0. , lca } ;
Point( pi+1 ) = { 0.    ,  r_ext , 0. , lca } ;
li = newl ;
Line( li   )   = { pa+1 , pi  } ;
Circle( li+1 ) = { pi   , pa , pi+1 } ;
Line( li+2 )   = { pi+1 , pa+2 } ;
lli = newll ;
Line Loop( lli ) = { li:li+2 , -(la+2) } ;
si = news ;
Plane Surface( si ) = { lli } ;

// ----------------------------------------------------------------- // 
//                       ______                                      //
//                      /_  __/___  ____  _____                      //
//                       / / / __ `/ __ `/ ___/                      //
//                      / / / /_/ / /_/ (__  )                       //
//                     /_/  \__,_/\__, /____/                        //
//                               /____/                              //
//                                                                   //
// ----------------------------------------------------------------- //

// Physical tags are associated with the elementary geometry ------- //

// All the superconducting tapes grouped together...
Physical Surface( "Superconductor" , PT_SUPRA ) = { sc } ;
// ... and the skin of the superconducting domain
Physical Line( "Superconductor cut"  , PT_SUPRA_CUT  ) = { lc        } ;
Physical Line( "Superconductor skin" , PT_SUPRA_SKIN ) = { lc+1:lc+3 } ;

// The air domain (close)
Physical Surface( "Air" , PT_AIR ) = { sa } ;

// The parts of the X-axis
Physical Line( "X-axis 0" , PT_X_AXIS_0 ) = { la } ;
Physical Line( "X_axis 1" , PT_X_AXIS_1 ) = { la+1 , li } ;

// The outer, pseudo-infinite air domain
Physical Surface( "Pseudo-infinite air" , PT_AIR_INF ) = { si } ;

// Outer boundary of the modelled region
Physical Line( "Far limit" , PT_FAR_LIMIT ) = { li+1 } ;

// ----------------------------------------------------------------- //
//                   ____  _            __                           //
//                  / __ \(_)________  / /___  __  __                //
//                 / / / / / ___/ __ \/ / __ `/ / / /                //
//                / /_/ / (__  ) /_/ / / /_/ / /_/ /                 //
//               /_____/_/____/ .___/_/\__,_/\__, /                  //
//                           /_/            /____/                   //
//                                                                   //
// ----------------------------------------------------------------- //

Include "scif_decay_display.geo" ;
