123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
-
-
-
-
-
-
- #include <Merlin>
- using namespace Lemma;
-
- static constexpr Real GAMMA = 2.67518e8;
-
- std::shared_ptr<PolygonalWireAntenna> CircularLoop ( int nd, Real radius, Real Offsetx, Real Offsety, Real wL ) ;
- void MoveLoop( std::shared_ptr<PolygonalWireAntenna> Loop, int nd, Real Radius, Real Offsetx, Real Offsety, Real wL );
-
- int main(int argc, char** argv) {
-
-
-
- auto earth = LayeredEarthEM::NewSP();
- earth->SetNumberOfLayers(3);
- earth->SetLayerConductivity( (VectorXcr(3) << Complex(0.,0), Complex(1./50.,0), Complex(1./100.)).finished() );
- earth->SetLayerThickness( (VectorXr(1) << 10).finished() );
-
-
- earth->SetMagneticFieldIncDecMag( 67, 0, 52750, NANOTESLA );
-
-
-
-
- Real Larmor = earth->GetMagneticFieldMagnitude()*GAMMA/(2*PI);
-
-
- auto Tx1 = CircularLoop(21, 15, 50, 50, Larmor);
- auto Tx2 = CircularLoop(21, 15, 50, 50, Larmor);
-
- auto Kern = LoopInteractions<COUPLING>::NewSP();
- Kern->PushCoil( "Coil 1", Tx1 );
- Kern->PushCoil( "Coil 2", Tx2 );
- Kern->SetLayeredEarthEM( earth );
-
- Kern->SetIntegrationSize( (Vector3r() << 50,200,20).finished() );
- Kern->SetIntegrationOrigin( (Vector3r() << 0,0,0.1).finished() );
- Kern->SetTolerance( 1e-7 );
-
- std::vector<std::string> tx = {std::string("Coil 1")};
- std::vector<std::string> rx = {std::string("Coil 2")};
- VectorXr Offsets = VectorXr::LinSpaced(121, 0.00, 60.0);
-
- auto outfile = std::ofstream("coupling.dat");
- for (int ii=0; ii< Offsets.size(); ++ii) {
- MoveLoop(Tx2, 21, 15, 50, 50 + Offsets(ii), Larmor);
- #ifdef LEMMAUSEVTK
- Complex coupling = Kern->Calculate( tx, rx, true );
- #else
- Complex coupling = Kern->Calculate( tx, rx, false );
- #endif
- std::cout << "coupling " << coupling << std::endl;
- outfile << Offsets(ii) << "\t" << std::real(coupling) << "\t" << std::imag(coupling) << std::endl;
- }
- outfile.close();
- }
-
- std::shared_ptr<Lemma::PolygonalWireAntenna> CircularLoop ( int nd, Real Radius, Real Offsetx, Real Offsety, Real wL ) {
-
- auto Tx1 = Lemma::PolygonalWireAntenna::NewSP();
- Tx1->SetNumberOfPoints(nd);
-
- VectorXr range = VectorXr::LinSpaced(nd, 0, 2*PI);
- int ii;
- for (ii=0; ii<nd; ++ii) {
- Tx1->SetPoint(ii, Vector3r(Offsetx+Radius*std::cos(range(ii)), Offsety+Radius*std::sin(range(ii)), -1e-3));
- }
-
- Tx1->SetCurrent(1.);
- Tx1->SetNumberOfTurns(1);
- Tx1->SetNumberOfFrequencies(1);
- Tx1->SetFrequency(0,wL);
-
- return Tx1;
- }
-
- void MoveLoop( std::shared_ptr<Lemma::PolygonalWireAntenna> Tx1, int nd, Real Radius, Real Offsetx, Real Offsety, Real wL ) {
-
- Tx1->SetNumberOfPoints(nd);
-
- VectorXr range = VectorXr::LinSpaced(nd, 0, 2*PI);
- int ii;
- for (ii=0; ii<nd; ++ii) {
- Tx1->SetPoint(ii, Vector3r(Offsetx+Radius*std::cos(range(ii)), Offsety+Radius*std::sin(range(ii)), -1e-3));
- }
-
- Tx1->SetCurrent(1.);
- Tx1->SetNumberOfTurns(1);
- Tx1->SetNumberOfFrequencies(1);
- Tx1->SetFrequency(0,wL);
-
- }
|