APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Mesh2D Object example for EjsS5.1 (javascript)? post and replies

Return to the Mesh2D Object example for EjsS5.1 (javascript)? thread
Login to post to this thread

How to use "Mesh2D" (javascript)
Chi-Feng Lin
28 Posts

Dear All

Is there any example for "Mesh2D"?

I am very grateful for any tips and hints.


Replies to How to use "Mesh2D" (javascript)

Re: How to use "Mesh2D" (javascript) -
Francisco Esquembre
237 Posts

Ok. It took me a while, because I discovered a bug (somewhere else) while creating this example.

You need to download the newer release of EjsS that fixes this bug: http://fem.um.es/EjsWiki/uploads/Download/EJS_5.1_150205.zip

Then, you can use the attached example.

Paco

Attached File: ejss_src_Mesh2DExample.zip



Re: Re: How to use "Mesh2D" (javascript) -
Chi-Feng Lin
28 Posts

Dear Paco

I appreciate your help. I spent several hours digesting your example.

Now I contribute my example about "Mesh2D" to see if anyone has an interest in it.


Chi-Feng Lin

Attached File: Mesh2D20150203.zip



Re: Re: Re: How to use "Mesh2D" (javascript) -
Francisco Esquembre
237 Posts

Yes. My example is a bit advanced. Your will be appreciated buy beginners.
Please, consider including the information on the PDF in the Description pages and then publish it in Compadre.org/osp

Paco



Re: Re: Re: Re: How to use "Mesh2D" (javascript) -
Chi-Feng Lin
28 Posts

Dear Paco

Sorry about I didn't publish this example in in Compadre.org/osp because I don't know how to do.

However, I give another example here for a cantilever beam with distribution of stress if someone need it.

Chi-Feng

Attached File: ejss_src_Catilevel_Beam_stress_20150429.zip



Re: Re: Re: Re: Re: How to use "Mesh2D" (javascript) -
Wolfgang
192 Posts

It is easy to suggest a Tracker experiment file, EjsS model, or OSP program to the ComPADRE digital library.  First login to the OSP Collection.  Then click on the "suggest a resource" link in the upper right hand corner of the html page.

Please make sure that your material is documented and follows good programming practice before it is submitted.

Attached File: OSPLinks.jpg



Re: Re: Re: Re: Re: How to use "Mesh2D" (javascript) -
lookang Avatar
lookang
245 Posts

hi Professor Paco,

can you post an example that is rectangular in cells?


i tried to remix your codes but was unsuccessful

part 1 points  // i tried to add to my exisiting codes
for (i=0; i points[number][0] = x = xmin+(xmax-xmin)*i/(number-1); //mesh2D lookang
y = ymin; // added to test set
  for (j=0; j  points[number][1] =  y = ymin+(ymax-ymin)*j/(number-1); //mesh2D lookang
    //  sum[i][j]= (A1*Math.cos(omega*t-k*d[i][j])+A2*Math.cos(omega*t-k*d2[i][j]+phase));
    if (coherence===true) {
      z = sum[i][j]= (A1*Math.cos(omega*t-k*d[i][j])+A2*Math.cos(omega*t-k*d2[i][j]+phase));

      // z needed for right screen view
      //z = (A1*Math.cos(omega*t-k*d[i][j])+A2*Math.cos(omega*t-k*d2[i][j]+phase));
    }


part 2 cells // was unable to render this correctly for rectangles
for (var i=1, cell=0; i    for (var j=1; j      var thisTile = cells[cell];
      // xmin+(xmax-xmin)*i/(number-1)
      var corner = xmin+(xmax-xmin)*i/(number-1) + j;
      thisTile[0] = corner-number-1;
      thisTile[1] = corner-number;
      thisTile[2] = corner;
      thisTile[3] = corner-1;
    }
  }

part 3 FieldAtPoint // is it equivalent to my variable sum ?


i am trying to recreate this ejs into ejss
http://iwant2study.org/lookangejss/04waves_11superposition/ejs/ejs_model_Ripple_Tank_Interferencewee13.jar

thank you in advance! and great job making EJSS :)

Attached File: ejss_src_Ripple_Tank_Interferencewee13.zip


OSP@SG blog
OSP@SG Digital Library


Re: Re: Re: Re: Re: Re: How to use "Mesh2D" (javascript) -
lookang Avatar
lookang
245 Posts

i have successful remixed the mesh2D.

links are the results http://iwant2study.org/lookangejss/00workshop/ejss_model_lookangtemplatemesh2d.zip http://iwant2study.org/lookangejss/00workshop/ejss_src_lookangtemplatemesh2d.zip http://iwant2study.org/lookangejss/00workshop/ejss_model_lookangtemplatemesh2d/lookangtemplatemesh2d_Simulation.xhtml

 

by the way, Dear paco, i think i found a bug, the mesh2D is always on the top layer, causing the other objects to be on the lower layers automatically, thus only the mesh2D is visible. 

for your kind information please.

 

 

Post edited August 5, 2015 at 11:24 PM EST.

Post edited August 5, 2015 at 11:25 PM EST.

Attached File: 2015-08-06_1120.png


OSP@SG blog
OSP@SG Digital Library


Re: Re: Re: Re: Re: Re: Re: How to use "Mesh2D" (javascript) -
Francisco Esquembre
237 Posts

Dear LooKang,

I studied your problem yesterday but was not sure that you wanted to use a Mesh element. maybe a cellLattice would be enough.

Anyway, you were faster than me!

The bug you report is fixed, but the EjsS releasethat has fixed it is still beta. You can find it here: http://fem.um.es/EjsWiki/uploads/Download/EJS_5.1_150805.zip

Recall, this is a beta release! :-)

Best,

Paco



OSP Projects:
Open Source Physics - EJS Modeling
Tracker
Physlet Physics
Physlet Quantum Physics
STP Book